From 7e247648201b208cfb5a5901803f784b7dbda948 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期三, 31 七月 2024 01:54:17 +0800 Subject: [PATCH] 1 --- sub_pages/customer/trade/list.vue | 7 sub_pages/supplier/supplier-info/supplier-info.vue | 9 sub_pages/customer/shopping/shopping.vue | 59 + common/global.scss | 4 sub_pages/customer/self/history.vue | 102 ++ pages/home/supplier-home.vue | 149 ++++ App.vue | 4 pages/order/order-sale/order-sale-detail.vue | 2 pages/user/address/address.vue | 29 store/index.js | 88 ++ sub_pages/customer/trade/detail.vue | 92 ++ sub_pages/partner/partner-info/partner-info.vue | 18 pages/order/order-delivery-detail.vue | 17 sub_pages/supplier/flower-manage/flower-add.vue | 77 + sub_pages/customer/self/collect.vue | 95 ++ sub_pages/customer/shop/shop.vue | 85 + sub_pages/customer/shopping/confirm.vue | 11 pages/order/order.vue | 170 ++++ sub_pages/customer/trade/trade.vue | 25 pages/order/order-detail.vue | 4 pages/order/order-delivery.vue | 6 sub_pages/customer/customer-info/customer-info.vue | 612 +++++++++--------- pages/home/components/home-category.vue | 149 ++-- 23 files changed, 1,269 insertions(+), 545 deletions(-) diff --git a/App.vue b/App.vue index 157231c..c721ede 100644 --- a/App.vue +++ b/App.vue @@ -402,7 +402,9 @@ .m-t-15 { margin-top: 30rpx; } - + .p-t-12{ + padding-top: 30rpx; + } .m-t-icon { margin-top: 8rpx; } diff --git a/common/global.scss b/common/global.scss index 946058e..f4c913e 100644 --- a/common/global.scss +++ b/common/global.scss @@ -227,8 +227,8 @@ .curnums { line-height: 60rpx; - margin-left: 12rpx; - margin-right: 12rpx; + padding-left: 20rpx; + padding-right: 20rpx; } } } diff --git a/pages/home/components/home-category.vue b/pages/home/components/home-category.vue index 8e1e69e..ec946c9 100644 --- a/pages/home/components/home-category.vue +++ b/pages/home/components/home-category.vue @@ -1,85 +1,88 @@ <template> - <view class="home-category"> - <view class="flex"> - <view class="t1">{{today}}(今日)第一场交易中</view> - <view class="t2">当前在售123435扎</view> - </view> - <view class="m-t-12 flex"> - <view class="item" v-for="(item,index) of list" :key="index" @click.stop="toList(item)"> - <image class="icon img100" :src="item.url"></image> - <view>{{ item.name || '-' }}</view> - </view> - </view> - </view> + <view class="home-category"> + <view class="flex"> + <view class="t1">{{today}}(今日)第一场交易中</view> + <view class="t2">当前在售123435扎</view> + </view> + <view class="m-t-12 flex"> + <view class="item" v-for="(item,index) of list" :key="index" @click.stop="toList(item)"> + <image class="icon img100" :src="item.url"></image> + <view>{{ item.name || '-' }}</view> + </view> + </view> + </view> </template> <script> -export default { - beforeMount() { - this.today = this.$util.toDate(new Date()) - this.$http.request('get', '/api/customer/flower/category/tree', {}).then(res => { - var data = res.data - this.list = [] - var arr = data || [] - for (let i = 0; i < arr.length && i < 10; i++) { - this.list.push({ - id: arr[i].id, - name: arr[i].name, - url: arr[i].imageUrl - }) - } - }) - }, - methods: { - toList(item){ - uni.navigateTo({ - url:'/sub_pages/customer/trade/list?categoryId='+item.id - }) - } - }, - data() { - return { - list: [], - today:'', + export default { + beforeMount() { + this.today = this.$util.toDate(new Date()) + this.$http.request('get', '/api/customer/flower/category/tree', {}).then(res => { + var data = res.data + this.list = [] + var arr = data || [] + for (let i = 0; i < arr.length && i < 10; i++) { + this.list.push({ + id: arr[i].id, + name: arr[i].name, + url: arr[i].imageUrl + }) + } + }) + }, + methods: { + toList(item) { + // uni.navigateTo({ + // url:'/sub_pages/customer/trade/list?categoryId='+item.id + // }) + uni.navigateTo({ + url: '/sub_pages/customer/trade/trade?categoryId=' + item.id + }) + } + }, + data() { + return { + list: [], + today: '', - }; - } -} + }; + } + } </script> <style lang="scss"> -.home-category { - .item { - text-align: center; - font-weight: 400; - font-size: 28rpx; - color: #000000; - line-height: 40rpx; - min-width: 20%; - margin-bottom: 28rpx; + .home-category { + .item { + text-align: center; + font-weight: 400; + font-size: 28rpx; + color: #000000; + line-height: 40rpx; + min-width: 20%; + margin-bottom: 28rpx; - .icon { - width: 94rpx; - height: 94rpx; - border-radius: 50%; - } - } + .icon { + width: 94rpx; + height: 94rpx; + border-radius: 50%; + } + } - .t1 { - font-size: 28rpx; - color: #333333; - line-height: 50rpx; - font-weight: 600; - } + .t1 { + font-size: 28rpx; + color: #333333; + line-height: 50rpx; + font-weight: 600; + } - .t2 { - margin-left: auto; - padding: 8rpx; - font-size: 24rpx; - color: #5B8C71; - line-height: 34rpx; - background: #E1F0E7; - border-radius: 4rpx; - } -} + .t2 { + margin-left: auto; + padding: 8rpx; + font-size: 24rpx; + color: #5B8C71; + line-height: 34rpx; + background: #E1F0E7; + border-radius: 4rpx; + } + } </style> \ No newline at end of file diff --git a/pages/home/supplier-home.vue b/pages/home/supplier-home.vue index 5d17578..0693bff 100644 --- a/pages/home/supplier-home.vue +++ b/pages/home/supplier-home.vue @@ -14,7 +14,8 @@ </view> <view class="flex user-info" v-if="currentInfo&&(currentInfo.id)"> <!-- 头像 --> - <image class="user-icon" v-if="!currentInfo.picture" src='https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png' + <image class="user-icon" v-if="!currentInfo.picture" + src='https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png' mode="aspectFit"></image> <image class="user-icon" v-if="currentInfo.picture" :src="currentInfo.picture" mode="aspectFit"></image> @@ -163,12 +164,12 @@ </view> <view class="order-desc syst">售后理赔</view> </view> - <!-- <view class="nav row margin-tb" @click="goto('/sub_pages/supplier/order-records/order-records',true)"> + <!-- <view class="nav row margin-tb" @click="printDeliveryOrder"> <view class="img-c"> <image class="icon margin-bottom order-icon kkjl" src="/static/images/supplier/user/user-icon-kkjl.png" mode="scaleToFill" /> </view> - <view class="order-desc wbsp">扣款记录</view> + <view class="order-desc wbsp">测试蓝牙</view> </view> --> </view> </view> @@ -198,8 +199,8 @@ }, scrollable: false, - cacheUserId:'', - tj:{} + cacheUserId: '', + tj: {} }; }, @@ -211,12 +212,12 @@ const url = options.q ? decodeURIComponent(options.q) : ''; const urlcode = options.url && decodeURIComponent(options.url) || '' }, - onShow(){ + onShow() { this.getTj() }, created() { //公告 - this.$http.request('get', '/api/announcement/page', { + this.$http.request('get', '/api/pub/announcement/list', { params: { size: 5, status: 'A' @@ -258,9 +259,137 @@ }, methods: { + printDeliveryOrder(item) { + //蓝牙打印 + var that = this; + wx.getBluetoothAdapterState({ + success: (result) => { + console.log('b s', result) + console.log("蓝牙状态:\n" + result.errMsg) + if (result.adapterState.available) { + if (result.adapterState.discovering) { + that.blueSearchDeviceCheck() + } else { + that.blueSearchDevice() + } + } else { + //打开蓝牙 + wx.openBluetoothAdapter({ + success: function(res) { + console.log("蓝牙已打开") + that.blueSearchDevice() + + }, + fail: function(res) { + console.log('res', res) + that.$message.showToast('蓝牙未打开') + } + }) + + } + }, + fail: (res) => { + console.log("蓝牙状态",res) + that.$message.showToast('获取蓝牙状态失败') + + } + }) + }, + blueSearchDevice() { + var that = this; + + wx.startBluetoothDevicesDiscovery({ + success: (res) => { + //打印调试日志 + console.log("搜索设备返回" + JSON.stringify(res)) + that.blueSearchDeviceCheck() + + }, + fail: (res) => { + console.log('error search', res) + that.$message.showToast('打开蓝牙搜索设备失败') + + } + }) + + }, + blueSearchDeviceCheck() { + let that = this + wx.getBluetoothDevices({ + success: (res) => { + var printDevice = undefined + for (var device of res.devices) { + if (device.name.indexOf('GP-M') >= 0) { + printDevice = device + // RSSI: -57 + // advertisServiceUUIDs: Array(2) + // 0: "000018f0-0000-1000-8000-00805f9b34fb" + // 1: "e7810a71-73ae-499d-8c15-faa9aef0c3f2" + // length: 2 + // nv_length: (...) + // __proto__: Array(0) + // deviceId: "89:E2:AF:33:46:2B" + // name: "GP-M322-5565_BLE" + break + } else { + + } + } + if (!printDevice) { + that.$message.showToast('未找到可用打印机,请联系客服') + that.stopBluetoothDevicesDiscovery() + + } else { + wx.createBLEConnection({ + deviceId: printDevice.deviceId, + success: function(res) { + // https: //blog.csdn.net/weixin_51375107/article/details/116009436 + console.log('连接设备返回:' + res.errMsg); + that.$message.showToast('连接设备返回:' + res.errMsg) + // escpos怎么来 →点击查看智谱清言的回答https://chatglm.cn/share/FEXaC + + }, + fail: function(res) { + console.log('createBLEConnection fail',res) + that.$message.showToast('连接打印机失败') + }, + complete() { + that.stopBluetoothDevicesDiscovery() + + } + }) + } + // res.devices.forEach((device, i) => { + // console.log('device', + // device) + // // if (device.deviceId == that.data + // // .deviceId) { + // // console.log("物联网设备已找到") + // // that.$message.showToast( + // // '打印设备已找到') + // // return; + // // } + // }) + }, + fail: (res) => { + console.log('getBluetoothDevices', + res) + that.$message.showToast('获取蓝牙设备失败') + + } + }) + }, + stopBluetoothDevicesDiscovery() { + var that = this; + wx.stopBluetoothDevicesDiscovery({ + success: (res) => { + console.log("停止扫描设备") + }, + }) + }, getTj() { // /api/supplier/delivery - + if (this.currentInfo.id && this.currentInfo.id !== this.cacheUserId) { this.cacheUserId = this.currentInfo.id let that = this @@ -280,10 +409,10 @@ } }) // #endif - + }, 200) } - + }, async toFlowManage() { diff --git a/pages/order/order-delivery-detail.vue b/pages/order/order-delivery-detail.vue index 55591f4..f4b1ccb 100644 --- a/pages/order/order-delivery-detail.vue +++ b/pages/order/order-delivery-detail.vue @@ -78,6 +78,9 @@ uni.navigateBack() } }, + printDeliveryOrder(item) { + this.$message.showToast('敬请期待') + } } } @@ -125,7 +128,6 @@ </view> </view> - <view class="line"></view> <view class="delivery-form"> <view class="form-item"> @@ -138,6 +140,12 @@ </view> </view> + <view class="line"></view> + <view class="buttons"> + <view class="button button-1 m-r-0" @click="printDeliveryOrder(item)">打印</view> + </view> + + </view> </view> @@ -192,6 +200,7 @@ border-radius: 4rpx; border: 2rpx dashed #CECECE; } + .order-sale-list { .order-sale-item { background-color: #fff; @@ -270,12 +279,14 @@ color: #CF0000; } } - .form{ - .form-item{ + + .form { + .form-item { height: unset; // min-height: ; } } + .delivery-form { display: flex; flex-wrap: wrap; diff --git a/pages/order/order-delivery.vue b/pages/order/order-delivery.vue index 1c64565..3e7da4e 100644 --- a/pages/order/order-delivery.vue +++ b/pages/order/order-delivery.vue @@ -69,6 +69,7 @@ <view class="line"></view> <view class="buttons"> + <view class="button button-1 m-r-10" v-if="item.status==='PENDING'" @click="toDetail(item,'PENDING')">确认入位</view> <view class="button button-0" @click="toDetail(item,'')">查看详情</view> @@ -101,6 +102,8 @@ this.query.status = options.status || '' } this.listApi = '/api/supplier/delivery/list/today' + this.listApi = '/api/supplier/delivery/list' + this.getList() }, @@ -130,7 +133,8 @@ uni.navigateTo({ url: `/pages/order/order-delivery-detail?id=${item.id}&status=${status}` }) - } + }, + } } </script> diff --git a/pages/order/order-detail.vue b/pages/order/order-detail.vue index 0445373..ec156d5 100644 --- a/pages/order/order-detail.vue +++ b/pages/order/order-detail.vue @@ -326,9 +326,9 @@ {{ item.supplierName }} </view> <view class="flex m-t-12"> - <radio :checked="submitForm.orderItems.indexOf(item.id)>=0" @click="changeSalesOrderItem(item)"></radio> + <radio v-if="showSales" :checked="submitForm.orderItems.indexOf(item.id)>=0" @click="changeSalesOrderItem(item)"></radio> - <image class="flower-img img100 m-r-6" :src="item.flowerCover" @click="previewImg(item.flowerCover)"> + <image class="flower-img img100 br-4 m-r-6" :src="item.flowerCover" @click="previewImg(item.flowerCover)"> </image> <view class="flex1"> <view class=" flex"> diff --git a/pages/order/order-sale/order-sale-detail.vue b/pages/order/order-sale/order-sale-detail.vue index 2425d94..93997d7 100644 --- a/pages/order/order-sale/order-sale-detail.vue +++ b/pages/order/order-sale/order-sale-detail.vue @@ -74,7 +74,7 @@ {{ item.supplierName }} </view> <view class="flex m-t-12 flex-wrap-normal"> - <image class="flower-img img100 m-r-6" :src="item.flowerCover" @click="previewImg(item.flowerCover)"> + <image class="flower-img img100 br-4 m-r-6" :src="item.flowerCover" @click="previewImg(item.flowerCover)"> </image> <view class="flex1"> <view class=" flex"> diff --git a/pages/order/order.vue b/pages/order/order.vue index 6891a36..bb7f423 100644 --- a/pages/order/order.vue +++ b/pages/order/order.vue @@ -211,68 +211,116 @@ </view> </view> <no-data v-if="!list||list.length===0" style="width: 100%;" class="m-t-12"></no-data> - <view v-for="(item,index) in list" :key="index" class="m-t-12"> + <view v-for="(dto,index) in list" :key="index" class="m-t-12"> <view class="order-item list-item"> <view class="title flex"> <view> - 订单:{{ item.orderNo }} + 订单:{{ dto.orderNo }} </view> - <view class="status t-red m-l-a m-r-0">¥{{ item.paymentAmount || item.totalAmount || '0'}}</view> + <view class="status t-red m-l-a m-r-0">¥{{ dto.paymentAmount || dto.totalAmount || '0'}}</view> </view> <view class="desc flex" v-if="!query.status"> <view class="label"> 订单状态: </view> - <view class="value">{{ item.statusBackendStr }}</view> + <view class="value">{{ dto.statusBackendStr }}</view> </view> <view class="desc flex"> <view class="label"> 收货人: </view> - <view class="value">{{ item.customer }}</view> + <view class="value">{{ dto.customer }}</view> </view> <view class="desc flex"> <view class="label"> 收货人手机号码: </view> - <view class="value">{{ item.customerTel }}</view> + <view class="value">{{ dto.customerTel }}</view> </view> <view class="desc flex"> <view class="label"> 收货地址: </view> - <view class="value">{{ item.customerAddress }}</view> + <view class="value">{{ dto.customerAddress }}</view> </view> - <view class="desc flex" v-if="item.statusBackend!=='PENDING'"> + <view class="desc flex" v-if="dto.statusBackend!=='PENDING'"> <view class="label"> 支付时间: </view> - <view class="value">{{ item.paymentTime }}</view> + <view class="value">{{ dto.paymentTime }}</view> + </view> + <view class="flower-info m-b-5 m-t-12 br-4" v-for="(item,index) of dto.items" :key="index"> + <view class="line-gray"></view> + + <view class="supplier-name "> + <image class="icon-dp br-4" src="/static/common/icon-dp.png"></image> + {{ item.supplierName }} + </view> + <view class="flex m-t-12 flex-wrap-normal"> + <image class="flower-img img100 m-r-6" :src="item.flowerCover" @click="previewImg(item.flowerCover)"> + </image> + <view class="flex1"> + <view class=" flex"> + <view class="title"><span class="level">{{ item.flowerCategory }}</span><span + class="level">{{ item.flowerLevelStr }}</span>{{ item.flowerName }} + </view> + </view> + <view class="each-list"> + <view class="each-item"> + <view class="label">颜色</view> + <view class="value">{{ item.flowerColor || '-' }}</view> + + </view> + <view class="each-item"> + <view class="label">规格</view> + <view class="value">{{ item.flowerUnit || '-' }}</view> + </view> + + <view class="each-item"> + <view class="label">数量</view> + <view class="value">{{ item.num || 0 }}</view> + + </view> + <view class="each-item"> + <view class="label">售价</view> + <view class="value">¥{{ item.price || 0 }}</view> + + </view> + <view class="each-item"> + <view class="label">商品总金额</view> + <view class="value">¥{{ item.total || 0 }}</view> + + </view> + </view> + </view> + </view> + </view> <view class="line-gray"></view> + <view class="flex buttons"> - <view class="button button-0 m-l-a m-r-15" v-if="item.statusBackend==='PENDING'" - @click="buttonClick(item,'cancelOrder')">取消订单</view> - <view class="button button-1 m-l-15 m-r-15" v-if="item.statusBackend==='PENDING'" - @click="buttonClick(item,'payAgain')">重新支付</view> + <view class="button button-0 m-l-a m-r-15" v-if="dto.statusBackend==='PENDING'" + @click="buttonClick(dto,'cancelOrder')">取消订单</view> + <view class="button button-1 m-l-15 m-r-15" v-if="dto.statusBackend==='PENDING'" + @click="buttonClick(dto,'payAgain')">重新支付</view> - <view class="button button-0 m-l-a m-r-15" @click="buttonClick('refund')" v-if="item.couldRefund"> + <view class="button button-0 m-l-a m-r-15" @click="buttonClick(dto,'refund')" v-if="dto.couldRefund"> 申请退款 </view> - <view class="button button-0 m-l-a m-r-15" @click="buttonClick('confirm')" - v-if="item.statusBackend ==='RECEIVE'"> 确认收货 + <view class="button button-0 m-l-a m-r-15" @click="buttonClick(dto,'confirm')" + v-if="dto.statusBackend ==='RECEIVE'"> 确认收货 </view> - <view class="button button-1 m-l-a m-r-15" @click="toDetailSale(item)" - v-if=" item.statusBackend === 'EVALUATE'||item.statusBackend=='COMPLETED'"> 申请售后 + <view class="button button-1 m-l-a m-r-15" @click="toDetailSale(dto)" + v-if="dto.statusBackend === 'EVALUATE'||item.statusBackend=='COMPLETED'"> 申请售后 </view> - <view class="button button-0 m-l-a m-r-15" @click="buttonClick(item,'evaluate')" - v-if=" item.statusBackend === 'EVALUATE'"> 评价 + <view class="button button-0 m-l-a m-r-15" @click="buttonClick(dto,'evaluate')" + v-if="dto.statusBackend === 'EVALUATE'"> 评价 </view> - <view class="button button-1 m-l-15 m-r-0" @click="toDetail(item)">查看详情</view> + <view class="button button-1 m-l-a m-r-0" @click="toDetail(dto)">查看详情</view> </view> </view> @@ -333,6 +381,7 @@ background: #20613D; text-align: center; border-radius: 30rpx; + min-width: 80rpx; } @@ -348,6 +397,85 @@ border: 2rpx solid #20613D; } } + .flower-info { + padding: 0rpx; + + background: #FFFFFF; + border-radius: 8rpx; + + .supplier-name { + border-bottom: 2rpx solid #EEEEEE; + font-weight: 600; + font-size: 28rpx; + color: #000000; + padding-bottom: 10rpx; + line-height: 40rpx; + + .icon-dp { + width: 27rpx; + height: 27rpx; + display: inline-block; + vertical-align: middle; + } + } + + .title { + font-weight: 600; + font-size: 28rpx; + color: #000000; + line-height: 40rpx; + + .level { + font-weight: 400; + font-size: 28rpx; + color: #20613D; + line-height: 40rpx; + margin-right: 20rpx; + } + } + + .flower-img { + width: 128rpx; + height: 118rpx; + min-width: 128rpx; + min-height: 118rpx; + } + + .each-list { + display: flex; + flex-wrap: wrap; + margin-top: 6rpx; + + .each-item { + min-width: 40%; + max-width: 50%; + text-align: center; + margin-left: 0rpx; + margin-right: auto; + display: flex; + + .label { + font-weight: 400; + font-size: 24rpx; + color: #666666; + text-align: left; + padding-right: 10rpx; + } + + .label::after { + content: ": " + } + + .value { + font-weight: 400; + font-size: 24rpx; + color: #666666; + } + } + } + + } + } diff --git a/pages/user/address/address.vue b/pages/user/address/address.vue index 21b77d1..5deb06e 100644 --- a/pages/user/address/address.vue +++ b/pages/user/address/address.vue @@ -129,7 +129,9 @@ // import qqmapwx from '@/plugins/qqmap-wx-jssdk.min.js'; // const lockey = 'VUHBZ-2AMLP-B7AD7-VUQZ7-D4TW5-MFFVN'; //使用在腾讯位置服务申请的key // const chooseLocation = requirePlugin('chooseLocation'); - + import { + mapState + } from 'vuex' export default { async onPullDownRefresh() { this.page.current = 0 @@ -186,7 +188,14 @@ this.submitForm.province = '' this.submitForm.city = '' this.submitForm.region = '' - if (e.detail.value.length <= 3) { + if (e.detail.value.length == 2) { + if (!!e.detail.value[0]) + this.submitForm.province = e.detail.value[0].value + if (!!e.detail.value[0]) + this.submitForm.city = e.detail.value[0].value + if (!!e.detail.value[1]) + this.submitForm.region = e.detail.value[1].value + } else if (e.detail.value.length <= 3) { if (!!e.detail.value[0]) this.submitForm.province = e.detail.value[0].value if (!!e.detail.value[1]) @@ -209,9 +218,13 @@ } }, async init_area() { - const res = await this.$http.request('get', '/api/pub/china/area/json') - this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll('name', - 'text')) || [] + if (this.regionDataPlus && this.regionDataPlus.length > 0) { + const res = await this.$http.request('get', '/api/pub/china/area/json') + this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll( + 'name', + 'text')) || [] + } + }, chooseLocation() { //前往接口挑选位置 @@ -347,8 +360,10 @@ this.$message.hideLoading() } else { this.submitForm = { - name: this.currentInfo && this.currentInfo.nickName || '', - tel: this.currentInfo && this.currentInfo.tel || '', + // name: this.currentInfo && this.currentInfo.nickName || '', + // tel: this.currentInfo && this.currentInfo.tel || '', + name: '', + tel: '', address: '', isDefault: false, province: '', diff --git a/store/index.js b/store/index.js index 4f2f98b..28bbe52 100644 --- a/store/index.js +++ b/store/index.js @@ -403,7 +403,7 @@ dispatch, state }, data) { - if(!state.currentInfo.id){ + if (!state.currentInfo.id) { message.showToast('请先登录') return } @@ -414,32 +414,88 @@ }) if (res.content && res.confirm) { var t = res.content - if (!isNaN(parseInt(t)) && t > 0) { - message.showLoading() - const resp = await http.request('post', '/api/customer/flower/cart/change-num', { - data: { - id: data.id, - num: parseInt(t) + if (!isNaN(parseInt(t)) && t >= 0) { + if ((t) === 0) { + message.showLoading() + const resp = await http.request('get', '/api/customer/flower/cart/delete', { + params: { + id: data.id, + } + }) + message.hideLoading() + if (resp && resp.code === 0) { + message.showToast('操作成功') + dispatch('sign_add', 'shopping') + return { + code: 0, + data: 0 + } } - }) - message.hideLoading() - - if (resp && resp.code === 0) { - message.showToast('添加购物车成功') - dispatch('sign_add', 'shopping') - return resp } else { + if (parseInt(t) <= 0) { + } else { + //提示没有库存 + if (!data.stock) { + message.showToast('没有库存了,更新失败') + + return { + code: 1, + data: parseInt(t) + } + } else { + if (data.stock == 0) { + message.showToast('库存为0,更新失败') + + return { + code: 1, + data: parseInt(t) + } + } else if (data.stock > 0 && data.stock < ( + parseInt(t))) { + message.showToast('超过库存,更新失败') + + return { + code: 1, + data: parseInt(t) + } + } + } + // console.log('data',) + } + message.showLoading() + + const resp = await http.request('post', '/api/customer/flower/cart/change-num', { + data: { + id: data.id, + num: parseInt(t) + } + }) + message.hideLoading() + + if (resp && resp.code === 0) { + message.showToast('添加购物车成功') + dispatch('sign_add', 'shopping') + return { + code: 0, + data: parseInt(t) + } + } } - return resp + + // return { + // code: 1, + // data: 0 + // } } else { + console.log('res.content', res.content) message.showToast('输入数目需要大于0') } } return { code: 1, - data: {} + data: 0 } }, countShopping: async function({ diff --git a/sub_pages/customer/customer-info/customer-info.vue b/sub_pages/customer/customer-info/customer-info.vue index 527fb66..8d30ff2 100644 --- a/sub_pages/customer/customer-info/customer-info.vue +++ b/sub_pages/customer/customer-info/customer-info.vue @@ -1,372 +1,378 @@ <template> - <view class="container-page" style="padding: 0rpx;"> - <view v-if="source==='step'" class="" style="padding-top:40rpx"> - <u-steps current="0"> - <u-steps-item title="信息填写" class="u-steps-item" style="font-size: 28rpx;"> - </u-steps-item> - <u-steps-item title="提交申请" class="u-steps-item"></u-steps-item> - </u-steps> - </view> - <view class="p20"> - <view class="form-item before-line"> - <view class="label required">店铺名称</view> - <view class="m-l-a m-r-0 flex"> - <input v-model="dto.name" placeholder="请输入联系人姓名" - style="margin-top: 16px;text-align: right;"></input> + <view class="container-page" style="padding: 0rpx;"> + <view v-if="source==='step'" class="" style="padding-top:40rpx"> + <u-steps current="0"> + <u-steps-item title="信息填写" class="u-steps-item" style="font-size: 28rpx;"> + </u-steps-item> + <u-steps-item title="提交申请" class="u-steps-item"></u-steps-item> + </u-steps> + </view> + <view class="p20"> + <view class="form-item before-line"> + <view class="label required">店铺名称</view> + <view class="m-l-a m-r-0 flex"> + <input v-model="dto.name" placeholder="请输入联系人姓名" + style="margin-top: 16px;text-align: right;"></input> - </view> - </view> + </view> + </view> - <view class="form-item before-line"> - <view class="label ">地区</view> + <view class="form-item before-line"> + <view class="label ">地区</view> - <view class="m-l-a m-r-0 flex " :class="[!dto['province']?'desc-gray':'']"> - <uni-data-picker :area="true" @change="(e)=>{PickArea(dto,e)}" placeholder="" - :localdata="regionDataPlus"> - {{ dto['province'] || '请选择' }}{{ dto['city'] && ('/' + dto['city']) || '' }}{{ + <view class="m-l-a m-r-0 flex " :class="[!dto['province']?'desc-gray':'']"> + <uni-data-picker :area="true" @change="(e)=>{PickArea(dto,e)}" placeholder="" + :localdata="regionDataPlus"> + {{ dto['province'] || '请选择' }}{{ dto['city'] && ('/' + dto['city']) || '' }}{{ dto['region'] && ('/' + dto['region']) || '' }} - </uni-data-picker> - <u-icon class="m-l-a" name="arrow-right"></u-icon> - </view> + </uni-data-picker> + <u-icon class="m-l-a" name="arrow-right"></u-icon> + </view> - </view> - <view class="form-item before-line"> - <view class="label ">地址</view> - <view class="m-l-a m-r-0 flex"> - <input v-model="dto.address" placeholder="请输入地址" - style="margin-top: 16px;text-align: right;"></input> + </view> + <view class="form-item before-line"> + <view class="label ">地址</view> + <view class="m-l-a m-r-0 flex"> + <input v-model="dto.address" placeholder="请输入地址" + style="margin-top: 16px;text-align: right;"></input> - </view> - </view> - <view class="form-item before-line"> - <view class="label ">店铺简介</view> - <view class="m-l-a m-r-0 flex1"> - <view class="m-t-12 m-b-12"> - <u-textarea v-model="dto.description" placeholder="请输入店铺简介"> + </view> + </view> + <view class="form-item before-line"> + <view class="label ">店铺简介</view> + <view class="m-l-a m-r-0 flex1"> + <view class="m-t-12 m-b-12"> + <u-textarea v-model="dto.description" placeholder="请输入店铺简介"> - </u-textarea> - </view> - <!-- <input v-model="dto.description" placeholder="请输入地址"--> - <!-- style="margin-top: 16px;text-align: right;"></input>--> + </u-textarea> + </view> + <!-- <input v-model="dto.description" placeholder="请输入地址"--> + <!-- style="margin-top: 16px;text-align: right;"></input>--> - </view> - </view> + </view> + </view> - <view class="form-item before-line m-t-20" @click="uploadIcon"> - <view class="label ">上传店铺封面</view> - <view class="m-l-a m-r-0 flex m-b-12"> - <view class="component-button-upload"> + <view class="form-item before-line m-t-20" @click="uploadIcon"> + <view class="label ">上传店铺封面</view> + <view class="m-l-a m-r-0 flex m-b-12"> + <view class="component-button-upload"> - </view> + </view> - </view> - </view> + </view> + </view> - <view class="flex p20" style="padding-top: 0rpx;padding-bottom: 10rpx" - v-if="dto.cover"> - <view class="m-t-12 m-r-10"> - <image class="banner-img" :src="dto.cover" @click.stop="previewImg(dto.cover)"> + <view class="flex p20" style="padding-top: 0rpx;padding-bottom: 10rpx" v-if="dto.cover"> + <view class="m-t-12 m-r-10"> + <image class="banner-img" :src="dto.cover" @click.stop="previewImg(dto.cover)"> - </image> - <view class="t-red text-center" @click.stop="dto.cover=''">删除</view> - </view> - </view> + </image> + <view class="t-red text-center" @click.stop="dto.cover=''">删除</view> + </view> + </view> - <view class="button-green-1 m-t-20 button-fixed-bottom before-line " @click="submit"> - {{ source === 'step' ? '下一步' : '更新' }} + <view class="button-green-1 m-t-20 button-fixed-bottom before-line " @click="submit"> + {{ source === 'step' ? '下一步' : '更新' }} - </view> + </view> - </view> + </view> - <view style="min-height: 200rpx;"> - - </view> + <view style="min-height: 200rpx;"> + + </view> - </view> + </view> </template> <script> -import environments from '@/environments' + import environments from '@/environments' -import { - mapState -} from 'vuex' + import { + mapState + } from 'vuex' -export default { + export default { - data() { - return { - id: '', - source: '', + data() { + return { + id: '', + source: '', - refresh: false, - api: '', - dto: { - cover: '', - address: '', - id: '', - userId: '', - name: '', - description: '', - province: '', - city: '', - region: '', - }, - requireFields: [ + refresh: false, + api: '', + dto: { + cover: '', + address: '', + id: '', + userId: '', + name: '', + description: '', + province: '', + city: '', + region: '', + }, + requireFields: [ - { - name: '店铺名称', - key: 'name' - } - ], - regionDataPlus: [], - } - }, - onLoad(options) { - //判断是不是来自登录步骤,是等话需要从缓存里面拿信息 - this.source = options.source || '' + { + name: '店铺名称', + key: 'name' + } + ], + regionDataPlus: [], + } + }, + onLoad(options) { + //判断是不是来自登录步骤,是等话需要从缓存里面拿信息 + this.source = options.source || '' - if (this.source === 'step') { - var tjson = this.$storage.getItem('cache_customer_info') - if (tjson) { - this.dto = { - ...this.dto, - ...JSON.parse(tjson) - } - } - } else { - this.getCurrentInfo() - } + if (this.source === 'step') { + var tjson = this.$storage.getItem('cache_customer_info') + if (tjson) { + this.dto = { + ...this.dto, + ...JSON.parse(tjson) + } + } + } else { + this.getCurrentInfo() + } - this.init_area() -// www.hmyxianhua.com/wx-jump + this.init_area() + // www.hmyxianhua.com/wx-jump - }, + }, - methods: { - PickArea(item, e) { - console.log('PickArea', item, e) - if (e.detail.value) { - this.dto.province = '' - this.dto.city = '' - this.dto.region = '' - if (e.detail.value.length <= 3) { - if (!!e.detail.value[0]) - this.dto.province = e.detail.value[0].value - if (!!e.detail.value[1]) - this.dto.city = e.detail.value[1].value - if (!!e.detail.value[2]) - this.dto.region = e.detail.value[2].value - } else { - //说明有重复的 - var plusnum = e.detail.value.length - 3 - if (!!e.detail.value[plusnum + 0]) - this.dto.province = e.detail.value[plusnum + 0].value - if (!!e.detail.value[plusnum + 1]) - this.dto.city = e.detail.value[plusnum + 1].value - if (!!e.detail.value[plusnum + 2]) - this.dto.region = e.detail.value[plusnum + 2].value - } + methods: { + PickArea(item, e) { + console.log('PickArea', item, e) + if (e.detail.value) { + this.dto.province = '' + this.dto.city = '' + this.dto.region = '' + if (e.detail.value.length == 2) { + if (!!e.detail.value[0]) + this.dto.province = e.detail.value[0].value + if (!!e.detail.value[0]) + this.dto.city = e.detail.value[0].value + if (!!e.detail.value[1]) + this.dto.region = e.detail.value[1].value + } else if (e.detail.value.length <= 3) { + if (!!e.detail.value[0]) + this.dto.province = e.detail.value[0].value + if (!!e.detail.value[1]) + this.dto.city = e.detail.value[1].value + if (!!e.detail.value[2]) + this.dto.region = e.detail.value[2].value + } else { + //说明有重复的 + var plusnum = e.detail.value.length - 3 + if (!!e.detail.value[plusnum + 0]) + this.dto.province = e.detail.value[plusnum + 0].value + if (!!e.detail.value[plusnum + 1]) + this.dto.city = e.detail.value[plusnum + 1].value + if (!!e.detail.value[plusnum + 2]) + this.dto.region = e.detail.value[plusnum + 2].value + } - this.$forceUpdate() + this.$forceUpdate() - } - }, - async init_area() { - const res = await this.$http.request('get', '/api/pub/china/area/json') - // console.log('area', JSON.parse(res.data)) - this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll('name', - 'text')) || [] - }, + } + }, + async init_area() { + const res = await this.$http.request('get', '/api/pub/china/area/json') + // console.log('area', JSON.parse(res.data)) + this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll('name', + 'text')) || [] + }, - async getCurrentInfo() { - this.$message.showLoading() - const { - code, - data - } = await this.$http.request('get', "/api/current/customer", {}) - if (code === 0) { - this.dto = { - ...data, + async getCurrentInfo() { + this.$message.showLoading() + const { + code, + data + } = await this.$http.request('get', "/api/current/customer", {}) + if (code === 0) { + this.dto = { + ...data, - } - this.dto.userId = this.currentInfo.id + } + this.dto.userId = this.currentInfo.id - } + } - this.$message.hideLoading() - }, - async submit() { - for (var field of this.requireFields) { - if (!this.dto[field.key]) { - this.$message.showToast(`${field.name}信息未填写`) - return - } - } - await this.$message.confirm(`是否确定提交更新信息`) - if (this.source === 'step') { - //先保存下来,进入下一步,然后注册成功后再保存 - this.$storage.setItem("cache_customer_info", JSON.stringify({ - ...this.dto - })) + this.$message.hideLoading() + }, + async submit() { + for (var field of this.requireFields) { + if (!this.dto[field.key]) { + this.$message.showToast(`${field.name}信息未填写`) + return + } + } + await this.$message.confirm(`是否确定提交更新信息`) + if (this.source === 'step') { + //先保存下来,进入下一步,然后注册成功后再保存 + this.$storage.setItem("cache_customer_info", JSON.stringify({ + ...this.dto + })) - uni.navigateTo({ - url: '/pages/login/supplier-reg?source=step' - }) + uni.navigateTo({ + url: '/pages/login/supplier-reg?source=step' + }) - } else { - var dto = { - ...this.dto, - } - this.$message.showLoading() - const re = await this.$http.request('post', '/api/customer/addOrUpdate', { - data: dto - }) - this.$message.hideLoading() - if (re.code == 2000 || re.code == 0) { - this.$message.showToast('操作成功') - this.$store.dispatch('getCurrentInfo') - this.backpage() - } else { - console.log('error re', re) - if (re.code === 30000 && Array.isArray(re.msg)) { - this.$message.showToast('字段未填写完整') - } - } - } + } else { + var dto = { + ...this.dto, + } + this.$message.showLoading() + const re = await this.$http.request('post', '/api/customer/addOrUpdate', { + data: dto + }) + this.$message.hideLoading() + if (re.code == 2000 || re.code == 0) { + this.$message.showToast('操作成功') + this.$store.dispatch('getCurrentInfo') + this.backpage() + } else { + console.log('error re', re) + if (re.code === 30000 && Array.isArray(re.msg)) { + this.$message.showToast('字段未填写完整') + } + } + } - }, + }, - uploadIcon() { - const that = this - uni.chooseImage({ - count: 1, // 最多可以选择的图片张数,默认9 - sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有 - sourceType: ['camera', 'album'], //album 从相册选图,camera 使用相机,默认二者都有。如需直接开相机或直接选相册,请只使用一个选项 - success: function ({ - errMsg, - tempFiles - }) { - if (errMsg === 'chooseImage:ok') { - if (tempFiles[0].size > 1024 * 1024 * 5) { - that.$message.confirm('图片最多支持5M大小,超出大小限制') - return - } - that.$message.showLoading() - that.$http.upload(tempFiles[0].path).then(async res => { - var pic = res.data && res.data.length > 0 && res.data[ - 0] || {} - that.$message.hideLoading() - that.dto.cover = (pic || {}).url || '' - console.log('pic', that.dto) + uploadIcon() { + const that = this + uni.chooseImage({ + count: 1, // 最多可以选择的图片张数,默认9 + sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有 + sourceType: ['camera', 'album'], //album 从相册选图,camera 使用相机,默认二者都有。如需直接开相机或直接选相册,请只使用一个选项 + success: function({ + errMsg, + tempFiles + }) { + if (errMsg === 'chooseImage:ok') { + if (tempFiles[0].size > 1024 * 1024 * 5) { + that.$message.confirm('图片最多支持5M大小,超出大小限制') + return + } + that.$message.showLoading() + that.$http.upload(tempFiles[0].path).then(async res => { + var pic = res.data && res.data.length > 0 && res.data[ + 0] || {} + that.$message.hideLoading() + that.dto.cover = (pic || {}).url || '' + console.log('pic', that.dto) - that.$forceUpdate() - }).catch(res => { - that.$message.hideLoading() + that.$forceUpdate() + }).catch(res => { + that.$message.hideLoading() - }) - } - } - }) - }, + }) + } + } + }) + }, - }, - computed: { - ...mapState(['currentInfo']) - }, - components: {} -} + }, + computed: { + ...mapState(['currentInfo']) + }, + components: {} + } </script> <style lang="scss" scoped> -.banner-img { - width: 96rpx; - height: 96rpx; - border-radius: 4rpx; - border: 2rpx dashed #CECECE; -} + .banner-img { + width: 96rpx; + height: 96rpx; + border-radius: 4rpx; + border: 2rpx dashed #CECECE; + } -.form-item { - // padding: 40rpx; - border-bottom: 2rpx solid #F3F3F3; - display: flex; - // height: 100px; + .form-item { + // padding: 40rpx; + border-bottom: 2rpx solid #F3F3F3; + display: flex; + // height: 100px; - .label { - width: 300rpx; - line-height: 60px; + .label { + width: 300rpx; + line-height: 60px; - } + } - .flex { - line-height: 60px; + .flex { + line-height: 60px; - .flex1 { - flex: 1; - text-align: center; - color: var(--selfblue) - } + .flex1 { + flex: 1; + text-align: center; + color: var(--selfblue) + } - } -} + } + } -.form-item.bottom-border-no { - border-bottom: none; -} + .form-item.bottom-border-no { + border-bottom: none; + } -.container-page { - padding: 40rpx; - background-color: #FFFFFF; - // min-height: calc(100vh - 80rpx); - min-height: 100vh; -} + .container-page { + padding: 40rpx; + background-color: #FFFFFF; + // min-height: calc(100vh - 80rpx); + min-height: 100vh; + } -.style { - width: fit-content; - margin: 0 auto; - line-height: 64rpx; - border-radius: 8rpx; - padding-left: 20rpx; - padding-right: 20rpx; - // padding-top: 5rpx; - // padding-bottom: 5rpx; - border: 2rpx solid var(--selfblue); - background-color: var(--selfbluebg); - min-width: 100rpx; -} + .style { + width: fit-content; + margin: 0 auto; + line-height: 64rpx; + border-radius: 8rpx; + padding-left: 20rpx; + padding-right: 20rpx; + // padding-top: 5rpx; + // padding-bottom: 5rpx; + border: 2rpx solid var(--selfblue); + background-color: var(--selfbluebg); + min-width: 100rpx; + } -.style-1 { - border: 1px solid rgb(122, 187, 255); - border: 1px solid #409EFF; - color: #409EFF; - background-color: rgb(240, 247, 255); -} + .style-1 { + border: 1px solid rgb(122, 187, 255); + border: 1px solid #409EFF; + color: #409EFF; + background-color: rgb(240, 247, 255); + } -.style-2 { - border: 1px solid rgb(255, 184, 78); - border: 1px solid #FE9044; - color: #FE9044; - background-color: rgb(255, 247, 235); -} + .style-2 { + border: 1px solid rgb(255, 184, 78); + border: 1px solid #FE9044; + color: #FE9044; + background-color: rgb(255, 247, 235); + } -.style-3 { - border: 1px solid #19be6b; - color: #19be6b; - background-color: rgb(231, 244, 238); -} + .style-3 { + border: 1px solid #19be6b; + color: #19be6b; + background-color: rgb(231, 244, 238); + } -.style-4 { - border: 1px solid #F56c6c; - color: #F56c6c; - background-color: rgb(254, 243, 243); -} + .style-4 { + border: 1px solid #F56c6c; + color: #F56c6c; + background-color: rgb(254, 243, 243); + } </style> \ No newline at end of file diff --git a/sub_pages/customer/self/collect.vue b/sub_pages/customer/self/collect.vue index 490e57f..68fd238 100644 --- a/sub_pages/customer/self/collect.vue +++ b/sub_pages/customer/self/collect.vue @@ -69,8 +69,15 @@ async submitShopping(dto) { //提交到购物车中 // this.$message.showLoading() - await this.$store.dispatch('submitShopping', dto); // this.$message.hideLoading() + const { + code, + data + } = await this.$store.dispatch('submitShopping', dto); + if (code == 0) { + dto.shopnum = data || 0 + this.$forceUpdate() + } }, select_level(e) { this.level_show = false @@ -85,6 +92,67 @@ this.query.column = e.value[0].value this.refreshList() + }, + async updateItemNum(item) { + const res = await this.$message.confirm('', { + editable: true, + title: '请输入想要购买的数量' + }) + if (res.content && res.confirm) { + // 发送请求 + var t = parseInt(res.content) + if (isNaN(t) || t < 0) { + this.$message.showToast('数目需要大于等于0') + + } else { + if (!item.stock || t > item.stock) { + this.$message.showToast('库存不足无法修改') + return + } + this.addnum(item, (t - item.shopnum)) + + } + } else { + + } + }, + async addnum(item, addnum) { + if (!this.currentInfo.id) { + await this.$message.confirm('请前往登录') + uni.navigateTo({ + url: '/pages/user/supplier-user' + }) + return + } + if (!item.shopnum) { + item.shopnum = 0 + } + if (!item.stock) { + item.stock = 0 + } + if (item.shopnum + addnum > item.stock) { + this.$message.showToast('库存不足,无法修改') + return + } + if (item.shopnum + addnum >= 0) { + + } else { + return + } + this.$message.showLoading() + const { + code + } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { + data: { + id: item.id, + num: addnum + } + }) + this.$message.hideLoading() + if (code === 0) { + item.shopnum += addnum + this.$forceUpdate() + } }, } } @@ -123,11 +191,10 @@ @cancel="order_show=false"></u-picker> <view class="trade-list-container"> - <view class="trade-info-container flex" v-for="(dto,index) of list" :key="index" - @click.stop="toDetail(dto)"> - <image class="img img100 br-4 m-r-10" :src="dto.url||dto.cover"></image> + <view class="trade-info-container flex" v-for="(dto,index) of list" :key="index"> + <image class="img img100 br-4 m-r-10" :src="dto.url||dto.cover" @click.stop="toDetail(dto)"></image> <view class="flex1"> - <view class="flex"> + <view class="flex" @click.stop="toDetail(dto)"> <view class="title"> <span class="m-r-5" style="display: inline-block;" v-if="dto.categoryStr">{{dto.categoryStr||''}}</span> @@ -140,13 +207,23 @@ </view> </view> <view class="flex"> - <view class="desc m-t-12 flex"> + <view class="desc p-t-12 flex" @click.stop="toDetail(dto)"> <view class="m-r-15">剩余:{{ dto.stock || 0 }}</view> <view class="m-r-15">颜色:{{ dto.color || '-' }}</view> </view> <view class="button-icons flex m-l-a m-r-0 m-t-20" v-if="dto.status=='UP'"> - <view class="m-r-0 gwc" @click.stop="submitShopping(dto)"> + <view class="m-r-0 gwc" @click.stop="submitShopping(dto)" v-if="!dto.shopnum"> + 购物车 + </view> + <view class="m-r-0 flex" v-if="dto.shopnum"> + <uni-icons v-if="dto.shopnum&&dto.shopnum>=1" type="minus" size="32" + @click.stop="addnum(dto,-1)"></uni-icons> + <view class="curnums" @click.stop="updateItemNum(dto)" + v-if="dto.shopnum&&dto.shopnum>=1"> + {{ dto.shopnum }} + </view> + <uni-icons v-if="!dto.shopnum||dto.shopnum<=99" type="plus-filled" size="32" + @click.stop="addnum(dto,1)"></uni-icons> </view> </view> </view> @@ -237,8 +314,8 @@ line-height: 40rpx; .curnums { - margin-left: 10rpx; - margin-right: 10rpx; + padding-left: 20rpx; + padding-right: 20rpx; } } diff --git a/sub_pages/customer/self/history.vue b/sub_pages/customer/self/history.vue index a137606..d6513f6 100644 --- a/sub_pages/customer/self/history.vue +++ b/sub_pages/customer/self/history.vue @@ -69,7 +69,12 @@ async submitShopping(dto) { //提交到购物车中 // this.$message.showLoading() - await this.$store.dispatch('submitShopping', dto); + const res = await this.$store.dispatch('submitShopping', dto); + console.log('res',res) + if (res&&res.code == 0){ + dto.shopnum = res.data || 0 + this.$forceUpdate() + } // this.$message.hideLoading() }, select_level(e) { @@ -85,6 +90,67 @@ this.query.column = e.value[0].value this.refreshList() + }, + async updateItemNum(item) { + const res = await this.$message.confirm('', { + editable: true, + title: '请输入想要购买的数量' + }) + if (res.content && res.confirm) { + // 发送请求 + var t = parseInt(res.content) + if (isNaN(t) || t < 0) { + this.$message.showToast('数目需要大于等于0') + + } else { + if(!item.stock || t>item.stock){ + this.$message.showToast('库存不足无法修改') + return + } + this.addnum(item, (t - item.shopnum)) + + } + } else { + + } + }, + async addnum(item, addnum) { + if (!this.currentInfo.id) { + await this.$message.confirm('请前往登录') + uni.navigateTo({ + url: '/pages/user/supplier-user' + }) + return + } + if (!item.shopnum) { + item.shopnum = 0 + } + if (!item.stock) { + item.stock = 0 + } + if (item.shopnum + addnum > item.stock) { + this.$message.showToast('库存不足,无法修改') + return + } + if (item.shopnum + addnum >= 0) { + + } else { + return + } + this.$message.showLoading() + const { + code + } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { + data: { + id: item.id, + num: addnum + } + }) + this.$message.hideLoading() + if (code === 0) { + item.shopnum += addnum + this.$forceUpdate() + } }, } } @@ -124,10 +190,10 @@ <view class="trade-list-container"> <view class="trade-info-container flex" v-for="(dto,index) of list" :key="index" - @click.stop="toDetail(dto)"> - <image class="img img100 br-4 m-r-10" :src="dto.url||dto.cover"></image> - <view class="flex1"> - <view class="flex"> + > + <image class="img img100 br-4 m-r-10" :src="dto.url||dto.cover" @click.stop="toDetail(dto)"></image> + <view class="flex1" > + <view class="flex" @click.stop="toDetail(dto)"> <view class="title"> <span class="m-r-5" style="display: inline-block;" v-if="dto.categoryStr">{{dto.categoryStr||''}}</span> @@ -140,14 +206,24 @@ </view> </view> <view class="flex"> - <view class="desc m-t-12 flex"> + <view class="desc p-t-12 flex" @click.stop="toDetail(dto)"> <view class="m-r-15">剩余:{{ dto.stock || 0 }}</view> <view class="m-r-15">颜色:{{ dto.color || '-' }}</view> </view> <view class="button-icons flex m-l-a m-r-0 m-t-20" v-if="dto.status=='UP'"> - <view class="m-r-0 gwc" @click.stop="submitShopping(dto)"> + <view class="m-r-0 gwc" @click.stop="submitShopping(dto)" v-if="!dto.shopnum"> + 购物车 </view> + <view class="m-r-0 flex" v-if="dto.shopnum"> + <uni-icons v-if="dto.shopnum&&dto.shopnum>=1" type="minus" size="32" + @click.stop="addnum(dto,-1)"></uni-icons> + <view class="curnums" @click.stop="updateItemNum(dto)" v-if="dto.shopnum&&dto.shopnum>=1"> + {{ dto.shopnum }} + </view> + <uni-icons v-if="!dto.shopnum||dto.shopnum<=999" type="plus-filled" size="32" + @click.stop="addnum(dto,1)"></uni-icons> + </view> + </view> </view> </view> @@ -161,7 +237,7 @@ <style lang="scss" scoped> .page-collect { min-height: 99vh; - + .search-container { display: flex; margin: 12rpx 0rpx 20rpx 0rpx; @@ -182,21 +258,23 @@ line-height: 70rpx !important; } } + .trade-list-container { min-height: calc(100vh - 300rpx); overflow-y: scroll; border-top-right-radius: 40rpx; border-top-left-radius: 40rpx; padding: 20rpx; - + } + .trade-info-container { background-color: #fff; border-radius: 20rpx; margin-bottom: 20rpx; padding: 20rpx; overflow: hidden; - + overflow-y: scroll; .img { @@ -237,8 +315,8 @@ line-height: 40rpx; .curnums { - margin-left: 10rpx; - margin-right: 10rpx; + padding-left: 20rpx; + padding-right: 20rpx; } } diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue index 6cc13c3..7d50de6 100644 --- a/sub_pages/customer/shop/shop.vue +++ b/sub_pages/customer/shop/shop.vue @@ -82,8 +82,7 @@ <view class="component-shop-item flex" v-for="(item,index) of list" :key="index" @click.stop="toDetail(item)"> <view class="img"> - <image class="img img100" - :src="item.cover" lazy-load> + <image class="img img100" :src="item.cover" lazy-load> </image> <view class="level"> {{item.levelStr||''}} @@ -120,7 +119,9 @@ <view class="icons flex"> <uni-icons v-if="item.shopnum&&item.shopnum>=1" type="minus" size="32" @click.stop="addnum(item,-1)"></uni-icons> - <view class="curnums" v-if="item.shopnum&&item.shopnum>=1">{{ item.shopnum }}</view> + <view class="curnums" @click="updateItemNum(item)" v-if="item.shopnum&&item.shopnum>=1"> + {{ item.shopnum }} + </view> <uni-icons v-if="!item.shopnum||item.shopnum<=99" type="plus-filled" size="32" @click.stop="addnum(item,1)"></uni-icons> </view> @@ -134,7 +135,7 @@ <trade :hidefooter="true" :catgoryTree="catgoryTree" v-if="catgoryTree" ref="trade"></trade> <!-- // 构建一个分类树 --> <!-- catgoryTree --> - + </view> <view v-if="flg==='2'" class="brand-info-3"> <view class="title"> @@ -191,7 +192,7 @@ dto: {}, list: [], id: '', - catgoryTree:undefined, + catgoryTree: undefined, } }, onLoad(options) { @@ -200,16 +201,17 @@ if (this.id) { this.getDetail() } - this.listApi = `/api/customer/flower/list` - this.query.supplierId = this.id + this.listApi = `/api/customer/flower/list` + this.query.supplierId = this.id this.getList('post') }, - onReachBottom(){ - if(this.flg==='0'){ + onReachBottom() { + if (this.flg === '0') { this.getMore('post') } }, methods: { + async getDetail() { { this.$message.showLoading() @@ -249,10 +251,10 @@ }, //update 关注 - async updateGz(type) { - if(!this.currentInfo.id){ - this.$message.showToast('请先登录') - return + async updateGz(type) { + if (!this.currentInfo.id) { + this.$message.showToast('请先登录') + return } this.$message.showLoading() const { @@ -276,11 +278,12 @@ }, async changeTab(flg) { console.log('changeTab', flg) - if('1'===(''+flg)){ - if(!this.catgoryTree){ + if ('1' === ('' + flg)) { + if (!this.catgoryTree) { this.$message.showLoading() const { - code,data + code, + data } = await this.$http.request('get', `/api/customer/flower/category/tree`, { data: { supplierId: this.dto.supplierId || this.dto.id @@ -293,7 +296,7 @@ // data 分类树 this.catgoryTree = data || [] let tmp = this - this.$nextTick(()=>{ + this.$nextTick(() => { tmp.$refs.trade.refInit(tmp.catgoryTree) }) } @@ -302,13 +305,35 @@ } this.flg = '' + flg //如果没有加载数据,需要加载一下 - + }, buttonSearchFlow() { }, + async updateItemNum(item) { + const res = await this.$message.confirm('', { + editable: true, + title: '请输入想要购买的数量' + }) + if (res.content && res.confirm) { + // 发送请求 + var t = parseInt(res.content) + if (isNaN(t) || t < 0) { + this.$message.showToast('数目需要大于等于0') + } else { + if (!item.stock || t > item.stock) { + this.$message.showToast('库存不足无法修改') + return + } + this.addnum(item, (t - item.shopnum)) + + } + } else { + + } + }, async addnum(item, addnum) { if (!this.currentInfo.id) { await this.$message.confirm('请前往登录') @@ -319,13 +344,13 @@ } if (!item.shopnum) { item.shopnum = 0 - } - if (!item.stock) { - item.stock = 0 - } - if (item.shopnum + addnum > item.stock) { - this.$message.showToast('库存不足,无法添加') - return + } + if (!item.stock) { + item.stock = 0 + } + if (item.shopnum + addnum > item.stock) { + this.$message.showToast('库存不足,无法修改') + return } if (item.shopnum + addnum >= 0) { @@ -335,7 +360,7 @@ this.$message.showLoading() const { code - } = await http.request('post', '/api/customer/flower/cart/change-num', { + } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { data: { id: item.id, num: addnum @@ -343,7 +368,7 @@ }) this.$message.hideLoading() if (code === 0) { - item.shopnum += addnum + item.shopnum += addnum this.$forceUpdate() } }, @@ -378,10 +403,12 @@ padding-left: 20rpx; } } - .brand-info-1{ + + .brand-info-1 { // padding: 40rpx 30rpx; - + } + .brand-info-3 { padding: 40rpx 30rpx; diff --git a/sub_pages/customer/shopping/confirm.vue b/sub_pages/customer/shopping/confirm.vue index 0827637..5faf578 100644 --- a/sub_pages/customer/shopping/confirm.vue +++ b/sub_pages/customer/shopping/confirm.vue @@ -126,7 +126,9 @@ } if (!this.address.id) { - this.$message.showToast('请选择收货地址') + this.$message.showToast('请选择收货地址',{ + duration: 2000 + }) return } this.dto.addressId = this.address.id @@ -170,9 +172,11 @@ await tmp.$store.dispatch('sign_add', 'shopping') uni.navigateBack() }, - fail(err) { + async fail(err) { console.error('pay fail', err) tmp.$message.showToast('支付失败') + await tmp.$store.dispatch('sign_add', 'shopping') + uni.navigateBack() } }) @@ -338,6 +342,8 @@ background-color: #ffffff; left: 0rpx; padding: 20rpx; + z-index: 99; + z-index: 11; right: 0rpx; bottom: 0rpx; } @@ -435,6 +441,7 @@ margin-right: auto; max-width: 32%; width: 130rpx; + min-width: 130rpx; .title { font-weight: 400; diff --git a/sub_pages/customer/shopping/shopping.vue b/sub_pages/customer/shopping/shopping.vue index a9f17ef..6f1f5f5 100644 --- a/sub_pages/customer/shopping/shopping.vue +++ b/sub_pages/customer/shopping/shopping.vue @@ -25,7 +25,7 @@ <view v-for="(dto,j) of item.flowerList" :key="j"> <u-divider v-if="j>0"></u-divider> <u-swipe-action> - <u-swipe-action-item :options="options1" @click="(e)=>{clickSwipeButton(dto)}"> + <u-swipe-action-item :options="options1" @click="(e)=>{clickSwipeButton(dto,true)}"> <view class="item-each flex"> <radio :checked="ids.indexOf(dto.id)>=0" @click="changeItem(dto,'flower')"></radio> <image class="img img100 m-r-6 br-4" :src="dto.url||dto.cover"></image> @@ -46,7 +46,7 @@ <view class="button-icons flex m-l-a m-r-0"> <uni-icons v-if="dto.num&&dto.num>=1" type="minus" size="32" @click.stop="addnum(dto,-1)"></uni-icons> - <view class="curnums" v-if="dto.num&&dto.num>=1">{{ dto.num }}</view> + <view class="curnums" @click.stop="updateItemNum(dto)" v-if="dto.num&&dto.num>=1">{{ dto.num }}</view> <uni-icons type="plus-filled" size="32" @click.stop="addnum(dto,1)"></uni-icons> </view> @@ -104,6 +104,10 @@ mounted() { this.init() }, + async onPullDownRefresh(){ + await this.init() + uni.stopPullDownRefresh() + }, computed: { totalprice() { @@ -146,7 +150,7 @@ const { code, data - } = await http.request('post', '/api/customer/flower/order/confirm/info', { + } = await this.$http.request('post', '/api/customer/flower/order/confirm/info', { data: { flowers: arr, } @@ -159,13 +163,18 @@ }) } }, - async clickSwipeButton(item) { + async clickSwipeButton(item,check) { //删除商品,重新加载数据? + if(check){ + this.$message.confirm('是否删除商品') + return + + } this.$message.showLoading() const { code - } = await http.request('get', '/api/customer/flower/cart/delete', { + } = await this.$http.request('get', '/api/customer/flower/cart/delete', { params: { id: item.id, } @@ -289,23 +298,47 @@ } }, + async updateItemNum(item) { + const res = await this.$message.confirm('', { + editable: true, + title: '请输入想要购买的数量' + }) + if (res.content && res.confirm) { + // 发送请求 + var t = parseInt(res.content) + if (isNaN(t) || t < 0) { + this.$message.showToast('数目需要大于等于0') + + } else { + if (!item.stock || t > item.stock) { + this.$message.showToast('库存不足无法修改') + return + } + this.addnum(item, (t - item.num)) + + } + } else { + + } + }, async addnum(dto, addnum) { if (dto.num + addnum >= 0) { } else { + console.log('addnum',dto,addnum) return } if (!dto.stock) { dto.stock = 0 } if (dto.num + addnum > dto.stock) { - this.$message.showToast('库存不足,无法添加') + this.$message.showToast('库存不足,无法修改') return } this.$message.showLoading() const { code - } = await http.request('post', '/api/customer/flower/cart/change-num', { + } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { data: { id: dto.id, num: addnum @@ -316,12 +349,17 @@ dto.num += addnum if (dto.num < 1) { //id删除清空,并且 - await this.clickSwipeButton(dto) + await this.clickSwipeButton(dto,false) // await this.init() } + this.$forceUpdate() } }, async init() { + + this.ids = [] + this.checkall = false + if (!this.currentInfo.id) { this.$message.showToast('请先登录') return @@ -364,6 +402,7 @@ padding: 20rpx; right: 0rpx; bottom: 160rpx; + z-index: 11; } .shopping-item { @@ -417,8 +456,8 @@ line-height: 40rpx; .curnums { - margin-left: 10rpx; - margin-right: 10rpx; + padding-left: 20rpx; + padding-right: 20rpx; } } } diff --git a/sub_pages/customer/trade/detail.vue b/sub_pages/customer/trade/detail.vue index 0b17700..b645d37 100644 --- a/sub_pages/customer/trade/detail.vue +++ b/sub_pages/customer/trade/detail.vue @@ -39,9 +39,19 @@ <image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image> </view> - <view class="m-r-0 gwc" @click="submitShopping(dto)"> + <view class="m-r-0 gwc" @click="submitShopping(dto)" v-if="!dto.shopnum"> + 购物车 </view> + <view class="m-r-0 button-icons flex" v-if="dto.shopnum"> + <uni-icons v-if="dto.shopnum&&dto.shopnum>=1" type="minus" size="32" + @click.stop="addnum(dto,-1)"></uni-icons> + <view class="curnums" @click.stop="updateItemNum(dto)" v-if="dto.shopnum&&dto.shopnum>=1"> + {{ dto.shopnum }} + </view> + <uni-icons v-if="!dto.shopnum||dto.shopnum<=99" type="plus-filled" size="32" + @click.stop="addnum(dto,1)"></uni-icons> + </view> + </view> </view> <view class="line"> @@ -138,6 +148,9 @@ shopnum: 0, } }, + onShow() { + this.refreshShopNum() + }, onLoad(options) { this.id = options.id || '' if (this.id) { @@ -146,6 +159,69 @@ this.refreshShopNum() }, methods: { + async updateItemNum(item) { + const res = await this.$message.confirm('', { + editable: true, + title: '请输入想要购买的数量' + }) + if (res.content && res.confirm) { + // 发送请求 + var t = parseInt(res.content) + if (isNaN(t) || t < 0) { + this.$message.showToast('数目需要大于等于0') + + } else { + if (!item.stock || t > item.stock) { + this.$message.showToast('库存不足无法修改') + return + } + this.addnum(item, (t - item.shopnum)) + + } + } else { + + } + }, + async addnum(item, addnum) { + if (!this.currentInfo.id) { + await this.$message.confirm('请前往登录') + uni.navigateTo({ + url: '/pages/user/supplier-user' + }) + return + } + if (!item.shopnum) { + item.shopnum = 0 + } + if (!item.stock) { + item.stock = 0 + } + if (item.shopnum + addnum > item.stock) { + this.$message.showToast('库存不足,无法修改') + return + } + if (item.shopnum + addnum >= 0) { + + } else { + return + } + this.$message.showLoading() + const { + code + } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { + data: { + id: item.id, + num: addnum + } + }) + this.$message.hideLoading() + if (code === 0) { + item.shopnum += addnum + this.refreshShopNum() + this.$forceUpdate() + } + }, + async refreshShopNum() { this.shopnum = await this.$store.dispatch('countShopping'); }, @@ -180,11 +256,14 @@ //提交到购物车中 // this.$message.showLoading() const { - code + code, + data } = await this.$store.dispatch('submitShopping', dto); // this.$message.hideLoading() if (code == 0) { + dto.shopnum = data || 0 this.refreshShopNum() + this.$forceUpdate() } }, @@ -255,6 +334,15 @@ } } + .button-icons { + line-height: 40rpx; + + .curnums { + padding-left: 20rpx; + padding-right: 20rpx; + } + } + .desc { font-weight: 400; font-size: 28rpx; diff --git a/sub_pages/customer/trade/list.vue b/sub_pages/customer/trade/list.vue index 9e4cc2d..b884fef 100644 --- a/sub_pages/customer/trade/list.vue +++ b/sub_pages/customer/trade/list.vue @@ -237,6 +237,9 @@ this.page.current = 1 await this.getList('post') uni.stopPullDownRefresh() + }, + onShow(){ + this.refreshShopNum() }, methods: { async refreshShopNum() { @@ -339,7 +342,7 @@ item.shopnum = 0 } if (item.shopnum + addnum > item.stock) { - this.$message.showToast('库存不足,无法添加') + this.$message.showToast('库存不足,无法修改') return } @@ -351,7 +354,7 @@ this.$message.showLoading() const { code - } = await http.request('post', '/api/customer/flower/cart/change-num', { + } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { data: { id: item.id, num: addnum diff --git a/sub_pages/customer/trade/trade.vue b/sub_pages/customer/trade/trade.vue index fd3f498..1bfcc37 100644 --- a/sub_pages/customer/trade/trade.vue +++ b/sub_pages/customer/trade/trade.vue @@ -122,8 +122,8 @@ uni.stopPullDownRefresh() }) }, - async onLoad() { - + async onLoad(options) { + let selectId = options.categoryId || '' //加载分类 this.$message.showLoading() this.$http.request('get', '/api/customer/flower/category/tree', {}).then(res => { @@ -131,8 +131,19 @@ var data = res.data this.list = data || [] if (this.list.length > 0) { - this.query.categoryId = this.list[0].id || '' - this.currentCategory = this.list[0] || {} + if (selectId) { + for (var item of this.list) { + if (item.id == selectId) { + this.query.categoryId = item.id || '' + this.currentCategory = item + break + } + } + } else { + this.query.categoryId = this.list[0].id || '' + this.currentCategory = this.list[0] || {} + } + } }) }, @@ -354,9 +365,9 @@ font-weight: 500; font-size: 28rpx; color: #000000; - line-height: 40rpx; - min-height: 80rpx; - text-align:center; + line-height: 40rpx; + min-height: 80rpx; + text-align: center; } .desc { diff --git a/sub_pages/partner/partner-info/partner-info.vue b/sub_pages/partner/partner-info/partner-info.vue index 1d88b3b..c103c88 100644 --- a/sub_pages/partner/partner-info/partner-info.vue +++ b/sub_pages/partner/partner-info/partner-info.vue @@ -7,7 +7,7 @@ <u-steps current="0"> <u-steps-item title="信息填写" class="u-steps-item" style="font-size: 28rpx;"> </u-steps-item> - <u-steps-item title="提交申请" class="u-steps-item"></u-steps-item> + <u-steps-item title="提交申请" class="u-steps-item"></u-steps-item> </u-steps> </view> <view class="p20"> @@ -33,11 +33,11 @@ <view class="m-l-a m-r-0 flex"> <input v-model="dto.cityWarehouse" placeholder="请输入城市仓名称" style="margin-top: 16px;text-align: right;"></input> - + </view> </view> - - + + <view class="form-item before-line"> <view class="label required">地区</view> @@ -199,7 +199,15 @@ this.dto.province = '' this.dto.city = '' this.dto.region = '' - if (e.detail.value.length <= 3) { + if (e.detail.value.length == 2) { + if (!!e.detail.value[0]) + this.dto.province = e.detail.value[0].value + if (!!e.detail.value[0]) + this.dto.city = e.detail.value[0].value + if (!!e.detail.value[1]) + this.dto.region = e.detail.value[1].value + } + else if(e.detail.value.length <= 3) { if (!!e.detail.value[0]) this.dto.province = e.detail.value[0].value if (!!e.detail.value[1]) diff --git a/sub_pages/supplier/flower-manage/flower-add.vue b/sub_pages/supplier/flower-manage/flower-add.vue index 2382501..0fd1182 100644 --- a/sub_pages/supplier/flower-manage/flower-add.vue +++ b/sub_pages/supplier/flower-manage/flower-add.vue @@ -197,8 +197,8 @@ <view v-for="(item,i) in dto.params" :key="i" class="m-t-20"> <view class="title topic-font" style="font-size: 40rpx;font-weight: 600;">{{item.name}}</view> <view class="m-t-12 flex value-items"> - <view class="value-item" @click="updateValue(item,each)" :class="[item.value===each?'cur':'']" - v-for="(each, j) in item.values" :key="j"> + <view class="value-item" @click="updateValue(item,each)" + :class="[item.value.indexOf(each)>=0?'cur':'']" v-for="(each, j) in item.values" :key="j"> {{each || '-'}} </view> </view> @@ -338,10 +338,15 @@ methods: { updateValue(item, value) { - item.value = value - this.$set(item, 'value', value) + if (item.value.indexOf(value) >= 0) { + item.value.splice(item.value.indexOf(value), 1) + } else { + item.value.push(value) + } + // item.value = value + // this.$set(item, 'value', value) this.$forceUpdate() - console.log('updateValue') + // console.log('updateValue') }, async updateSearch(search) { this.columns_categorys_search = search || '' @@ -385,7 +390,7 @@ } } }, - mapCategoryTree(node, arr,parentCheckTrue=false) { + mapCategoryTree(node, arr, parentCheckTrue = false) { var has = true if (arr) { var hasTrue = false @@ -396,9 +401,9 @@ has = true if (this.columns_categorys_search) { has = false - } - if(parentCheckTrue){ - has = true + } + if (parentCheckTrue) { + has = true } var tmp = { ...item, @@ -423,11 +428,11 @@ this.columns_categorys_dict['@' + item.id] = item if (item.children && item.children.length > 0) { //如果上级已经有了,下级都包含 - tmp.children = [] - var childrenhas = this.mapCategoryTree(tmp.children, item.children,has) - if (childrenhas) { - has = true - hasTrue = true + tmp.children = [] + var childrenhas = this.mapCategoryTree(tmp.children, item.children, has) + if (childrenhas) { + has = true + hasTrue = true } } else { @@ -496,6 +501,14 @@ if (res.code == 0) { // this.columns_params = res.data || [] this.dto.params = res.data || [] + for (var k of this.dto.params) { + if (!k.value) { + k.value = [] + } else { + k.value = k.value.split(',') || [] + } + } + // console.log('init params',this.dto.params) } } @@ -523,7 +536,17 @@ // // console.log('this.dto', this.dto) if (!this.dto.bannerList) { this.dto.bannerList = [] - } + } + if(this.dto.params){ + for (var k of this.dto.params) { + if (!k.value) { + k.value = [] + } else { + k.value = k.value.split(',') || [] + } + } + } + // if (this.dto.category) { // await this.refresh_category() // } @@ -557,9 +580,9 @@ this.$message.showToast('商品价格不能小于等于0') return } - tmp = parseFloat(this.dto.stock) - if (isNaN(tmp) || ('' + tmp.toFixed(0)) !== ('' + this.dto.stock) || tmp < 0) { - this.$message.showToast('商品库存格式错误,需要大于等于0') + tmp = parseInt(this.dto.stock) + if (isNaN(tmp) || ('' + tmp.toFixed(0)) !== ('' + this.dto.stock) || tmp <= 0) { + this.$message.showToast('商品库存格式错误,需要大于0') return } @@ -568,13 +591,14 @@ this.$message.showToast(`${field.name}信息未填写`) return } - } + } + if (this.dto.params.length < 1) { this.$message.showToast('商品参数详情未设置') return } else { for (var item of this.dto.params) { - if (!item.value) { + if (item.value.length < 1) { this.$message.showToast('存在商品参数详情未设置') return } @@ -597,10 +621,11 @@ // this.$message.showToast('1') // return - var dto = { - ...this.dto, - // applicationDate: this.$util.toDate(new Date()), - // applicantId: this.currentInfo.id + var dto = JSON.parse(JSON.stringify(this.dto)) + if(dto.params){ + for(var k of dto.params){ + k.value = k.value.join(",") + } } this.$message.showLoading() const re = await this.$http.request('post', `/api/supplier/flower/list/${this.id?'edit':'new'}`, { @@ -707,7 +732,7 @@ var strs = [] for (var i of this.dto.params) { if (i.value) { - strs.push(i.value) + strs.push(i.value.join(",")) } } return strs.join(',') @@ -739,7 +764,7 @@ .label { width: 240rpx; - line-height: 60px; + line-height: 60px; min-width: 240rpx; } diff --git a/sub_pages/supplier/supplier-info/supplier-info.vue b/sub_pages/supplier/supplier-info/supplier-info.vue index 19bb742..95e2205 100644 --- a/sub_pages/supplier/supplier-info/supplier-info.vue +++ b/sub_pages/supplier/supplier-info/supplier-info.vue @@ -311,7 +311,14 @@ this.dto.province = '' this.dto.city = '' this.dto.region = '' - if (e.detail.value.length <= 3) { + if (e.detail.value.length == 2) { + if (!!e.detail.value[0]) + this.dto.province = e.detail.value[0].value + if (!!e.detail.value[0]) + this.dto.city = e.detail.value[0].value + if (!!e.detail.value[1]) + this.dto.region = e.detail.value[1].value + }else if(e.detail.value.length <= 3) { if (!!e.detail.value[0]) this.dto.province = e.detail.value[0].value if (!!e.detail.value[1]) -- Gitblit v1.9.3