From d18a571aa4dacab6928dbc8c6c45d5aa3f291afb Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期三, 31 七月 2024 23:34:01 +0800 Subject: [PATCH] update --- common/selfvar.scss | 2 sub_pages/customer/trade/list.vue | 75 +++-- common/self.scss | 3 sub_pages/customer/shopping/shopping.vue | 40 +- common/global.scss | 17 + sub_pages/customer/self/history.vue | 2 sub_pages/partner/delivery/delivery.vue | 9 pages.json | 104 ++++--- mixin/mixin.js | 10 pages/home/components/home-top-flow.vue | 2 components/footer/main.scss | 2 App.vue | 4 store/index.js | 16 + sub_pages/customer/trade/detail.vue | 6 pages/order/order-delivery-detail.vue | 38 +- components/top-tabs.vue | 1 sub_pages/supplier/print/print-list.vue | 323 ++++++++++++++++-------- manifest.json | 2 sub_pages/customer/self/collect.vue | 2 pages/login/login.scss | 1 sub_pages/customer/trade/trade.vue | 7 pages/order/order-delivery.vue | 113 +++++-- 22 files changed, 506 insertions(+), 273 deletions(-) diff --git a/App.vue b/App.vue index c721ede..d8ad526 100644 --- a/App.vue +++ b/App.vue @@ -776,7 +776,6 @@ .msg-tip { font-size: 24rpx; - font-family: PingFangSC, PingFang SC; font-weight: 400; color: #999999; line-height: 34rpx; @@ -894,7 +893,6 @@ border-radius: 62rpx; font-size: 32rpx; - font-family: PingFangSC, PingFang SC; font-weight: 600; color: #FFFFFF; line-height: 80rpx; @@ -911,7 +909,6 @@ border-radius: 62rpx; border: 2rpx solid #666666; font-size: 32rpx; - font-family: PingFangSC, PingFang SC; font-weight: 400; color: #666666; line-height: 92rpx; @@ -922,7 +919,6 @@ .close-parent { position: relative; font-size: 28rpx; - font-family: PingFangSC, PingFang SC; font-weight: 600; color: #000000; line-height: 40rpx; diff --git a/common/global.scss b/common/global.scss index f4c913e..0d7be60 100644 --- a/common/global.scss +++ b/common/global.scss @@ -137,6 +137,23 @@ line-height: 78rpx; } } +.component-stock-zero::after{ + position: absolute; + line-height: 100%; + // font-size: ; + left: 0rpx; + right: 0rpx; + // top: 0rpx; + bottom: 0rpx; + font-size: 600; + content: '已售罄'; + color: #fff; + text-align: center; + top: calc(50% - 20rpx); +} +.component-stock-zero{ + position: relative; +} .component-popup_input{ margin: 0 auto; margin-top: 160rpx; diff --git a/common/self.scss b/common/self.scss index df3ae5f..9916e79 100644 --- a/common/self.scss +++ b/common/self.scss @@ -19,5 +19,6 @@ $u-primary: #20613D; body { --tcolor: #3140A2; - font-family: PingFangSC-Regular, PingFang SC; + // font-family: , PingFang SC; + font-family: PingFangSC, PingFang SC,PingFangSC-Regular; } diff --git a/common/selfvar.scss b/common/selfvar.scss index df3ae5f..a89577c 100644 --- a/common/selfvar.scss +++ b/common/selfvar.scss @@ -19,5 +19,5 @@ $u-primary: #20613D; body { --tcolor: #3140A2; - font-family: PingFangSC-Regular, PingFang SC; + font-family: PingFangSC, PingFang SC,PingFangSC-Regular; } diff --git a/components/footer/main.scss b/components/footer/main.scss index 9fa8c65..ad0da37 100644 --- a/components/footer/main.scss +++ b/components/footer/main.scss @@ -24,7 +24,6 @@ .item { - font-family: PingFangSC-Regular, PingFang SC; font-weight: 400; // color: #A1A6B3; color: var(--topicgray); @@ -125,7 +124,6 @@ .item { - font-family: PingFangSC-Regular, PingFang SC; font-weight: 400; color: #A1A6B3; diff --git a/components/top-tabs.vue b/components/top-tabs.vue index 5779e66..d6675d8 100644 --- a/components/top-tabs.vue +++ b/components/top-tabs.vue @@ -48,7 +48,6 @@ // border-bottom: 8rpx solid #000; // 底部的线条 - font-family: PingFangSC, PingFang SC; font-weight: 600; font-size: 36rpx; color: #ffffff; diff --git a/manifest.json b/manifest.json index 651a10c..a3c7ecb 100644 --- a/manifest.json +++ b/manifest.json @@ -49,7 +49,7 @@ "quickapp" : {}, /* 快应用特有相关 */ "mp-weixin" : { - "appid" : "wx1441324401626290", + "appid" : "wx3203fd935a6ffe09", "setting" : { "urlCheck" : false, "es6" : true, diff --git a/mixin/mixin.js b/mixin/mixin.js index ee51659..e1c5c9d 100644 --- a/mixin/mixin.js +++ b/mixin/mixin.js @@ -127,12 +127,22 @@ } else { //根据id去重正常 var ids = [] + var idsMap = {} for (var item of this.list) { ids.push(item.id) + if (item.id) { + idsMap[item.id] = item + } } for (var item of data.records) { if (ids.indexOf(item.id) < 0) { this.list.push(item) + } else { + //最好更新一下 + idsMap[item.id] = { + ...idsMap[item.id], + ...item,//覆盖了 + } } } diff --git a/pages.json b/pages.json index 9a6b995..dc76b13 100644 --- a/pages.json +++ b/pages.json @@ -19,23 +19,23 @@ "navigationBarTitleText": "收货地址" } }, - // #endif - { - "path": "pages/login/supplier-login", - "style": { - "navigationBarTitleText": "登录", - "enablePullDownRefresh": false, - "navigationStyle": "custom" - } - }, - { - "path": "pages/home/supplier-home", - "style": { - "navigationBarTitleText": "首页", - "enablePullDownRefresh": true, - "navigationStyle": "custom" - } - }, + // #endif + { + "path": "pages/login/supplier-login", + "style": { + "navigationBarTitleText": "登录", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/home/supplier-home", + "style": { + "navigationBarTitleText": "首页", + "enablePullDownRefresh": true, + "navigationStyle": "custom" + } + }, { "path": "pages/login/supplier-reg", "style": { @@ -133,9 +133,15 @@ ], "subPackages": [{ "root": "sub_pages/supplier", - "pages": [ + "pages": [{ + "path": "protocol", + "style": { + "navigationBarTitleText": "协议", + "enablePullDownRefresh": false + } + } // #ifdef PUB_SUPPLIER - { + ,{ "path": "supplier-info/supplier-info", "style": { "navigationBarTitleText": "信息维护", @@ -165,23 +171,29 @@ "navigationBarBackgroundColor": "#E6F2EB" } }, + { - "path": "protocol", + "path": "print/print-list", "style": { - "navigationBarTitleText": "协议", + "navigationBarTitleText": "打印", "enablePullDownRefresh": false } - }, - { - "path": "print/print-list", - "style": { - "navigationBarTitleText": "打印", - "enablePullDownRefresh": false - } - + + }, { + "path": "order-settlement/order-settlement", + "style": { + "navigationBarTitleText": "账单结算", + "enablePullDownRefresh": true + } + }, + { + "path": "order-settlement/order-settlement-detail", + "style": { + "navigationBarTitleText": "结算单详情" + } } // #endif - // #ifdef PUB_PARTNER || PUB_SUPPLIER + // #ifdef PUB_PARTNER ,{ "path": "order-settlement/order-settlement", "style": { @@ -209,15 +221,15 @@ "navigationBarTitleText": "信息维护", "enablePullDownRefresh": false } - }, - { - "path": "partner-info/partner-code", - "style": { - "navigationBarTitleText": "二维码", - "enablePullDownRefresh": false - } - }, - + }, + { + "path": "partner-info/partner-code", + "style": { + "navigationBarTitleText": "二维码", + "enablePullDownRefresh": false + } + }, + { "path": "order-manage/order-manage", "style": { @@ -313,13 +325,13 @@ "navigationBarTitleText": "我的关注", "enablePullDownRefresh": true } - }, - { - "path": "self/history", - "style": { - "navigationBarTitleText": "浏览记录", - "enablePullDownRefresh": true - } + }, + { + "path": "self/history", + "style": { + "navigationBarTitleText": "浏览记录", + "enablePullDownRefresh": true + } }, { "path": "self/collect", diff --git a/pages/home/components/home-top-flow.vue b/pages/home/components/home-top-flow.vue index 8807ad4..9bb5cf1 100644 --- a/pages/home/components/home-top-flow.vue +++ b/pages/home/components/home-top-flow.vue @@ -2,7 +2,7 @@ <view class="home-top-flow"> <view class="item flex" v-for="(item,index) of list" :key="index" @click="toDetail(item)"> <view class="img"> - <image class="img img100" :src="item.cover"> + <image class="img img100" :class="[!item.stock?'component-stock-zero':'']" :src="item.cover"> </image> <view class="level"> {{ item.levelStr}} diff --git a/pages/login/login.scss b/pages/login/login.scss index b673239..cf64315 100644 --- a/pages/login/login.scss +++ b/pages/login/login.scss @@ -21,7 +21,6 @@ line-height: 28px; } .title-2{ - font-family: PingFangSC, PingFang SC; font-weight: 600; font-size: 24px; color: #000000; diff --git a/pages/order/order-delivery-detail.vue b/pages/order/order-delivery-detail.vue index 07e5372..ab2e6d1 100644 --- a/pages/order/order-delivery-detail.vue +++ b/pages/order/order-delivery-detail.vue @@ -79,11 +79,11 @@ } }, printDeliveryOrder(item) { - this.$message.showToast('敬请期待') - // this.$storage.setItem('cache_delivery_order_print',JSON.stringify(item)) - // uni.navigateTo({ - // url:'/sub_pages/supplier/print/print-list' - // }) + // this.$message.showToast('敬请期待') + this.$storage.setItem('cache_delivery_order_print',JSON.stringify(item)) + uni.navigateTo({ + url:'/sub_pages/supplier/print/print-list' + }) } } @@ -94,7 +94,7 @@ <view class="list-container order-delivery supplier"> <view class="p15"> <no-data v-if="!list||list.length==0" style="width: 100%;"></no-data> - <view v-for="(item,index) in list" :key="index" @click="toDetail(item)" + <view v-for="(item,index) in list" :key="index" class="m-b-24 order-sale-list list-container"> <view class="order-sale-item list-item"> <view class="title flex"> @@ -110,23 +110,23 @@ <view class="title">{{item.flowerName }} </view> </view> - <view class="each-list flex"> - <view class="each-item"> + <view class="each-list "> + <view class="each-item flex1 flex"> <view class="label">颜色</view> <view class="value">{{ item.flowerColor || '-' }}</view> </view> - <view class="each-item"> + <view class="each-item flex1 flex"> <view class="label">规格</view> <view class="value">{{ item.flowerUnit || '-' }}</view> </view> </view> </view> <view class="each-list price"> - <view class="each-item"> + <view class="each-item flex1"> <view class="value">¥{{ item.price || '-' }}</view> </view> - <view class="each-item"> + <view class="each-item flex1"> <view class="value">x {{ item.num || 0 }}</view> </view> </view> @@ -134,17 +134,17 @@ </view> <view class="line"></view> <view class="delivery-form"> - <view class="form-item"> + <view class="form-item flex1"> <view class="label">仓库名称</view> <view class="value red">{{item.warehouseName}}</view> </view> - <view class="form-item"> + <view class="form-item flex1"> <view class="label">库位名称</view> <view class="value red">{{item.warehouseLocationCode}}</view> </view> </view> - <!-- #ifdef PUB_CUSTOMER --> + <!-- #ifdef PUB_SUPPLIER --> <view class="line"></view> <view class="buttons"> <view class="button button-1 m-r-0" @click="printDeliveryOrder(item)">打印</view> @@ -213,6 +213,16 @@ background-color: #fff; margin-bottom: 20rpx; padding: 22rpx; + .each-item{ + .label{ + min-width: 120rpx; + + } + .label:after{ + content: ":"; + margin-right: 10rpx; + } + } .buttons { display: flex; diff --git a/pages/order/order-delivery.vue b/pages/order/order-delivery.vue index 3e7da4e..536b677 100644 --- a/pages/order/order-delivery.vue +++ b/pages/order/order-delivery.vue @@ -10,59 +10,70 @@ </view> <view class="p15" style="min-height: calc(100vh - 160rpx);"> <no-data v-if="!list||list.length==0" style="width: 100%;"></no-data> - <view v-for="(item,index) in list" :key="index" class="m-b-24 order-sale-list list-container"> + <view v-for="(dto,index) in list" :key="index" class="m-b-24 order-sale-list list-container"> <view class="order-sale-item list-item"> <view class="title flex"> - <view>订单单号:{{item.orderNo}}</view> - <view class="m-l-a m-r-0 status">{{item.statusStr}}</view> + <view>订单单号:{{dto.orderNo}}</view> + <view class="m-l-a m-r-0 status">{{dto.statusStr}}</view> </view> - <view class="line" v-if="false"></view> - <view class="flower flex" v-if="false"> - <image class="image img100 m-r-6" :src="item.flowerCover" @click="previewImg(item.flowerCover)"> - </image> - <view class="flex1"> - <view class=" flex"> - <view class="title">{{item.flowerName }} - </view> + <view v-if="dto.items"> + <view v-for="(item,k) of dto.items" :key="k"> + <view class="line" v-if="true"></view> + <view class="supplier-name "> + <image class="icon-dp" src="/static/common/icon-dp.png"></image> + {{ item.supplierName }} </view> - <view class="each-list flex"> - <view class="each-item"> - <view class="label">颜色</view> - <view class="value">{{ item.flowerColor || '-' }}</view> + <view class="flower flex m-t-12" v-if="true"> - </view> - <view class="each-item"> - <view class="label">规格</view> - <view class="value">{{ item.flowerUnit || '-' }}</view> - </view> - </view> - </view> - <view class="each-list price"> - <view class="each-item"> - <view class="value">¥{{ item.price || '-' }}</view> - </view> - <view class="each-item"> - <view class="value">x {{ item.num || 0 }}</view> - </view> - </view> + <image class="image img100 m-r-6" :src="item.flowerCover" + @click="previewImg(item.flowerCover)"> + </image> + <view class="flex1"> + <view class=" flex"> + <view class="title">{{item.flowerName }} + </view> + </view> + <view class="each-list"> + <view class="each-item flex1 flex"> + <view class="label">颜色</view> + <view class="value">{{ item.flowerColor || '-' }}</view> + </view> + <view class="each-item flex1 flex"> + <view class="label">规格</view> + <view class="value">{{ item.flowerUnit || '-' }}</view> + </view> + </view> + </view> + <view class="each-list price"> + <view class="each-item flex1"> + <view class="value">¥{{ item.price || '-' }}</view> + </view> + <view class="each-item flex1"> + <view class="value">x {{ item.num || 0 }}</view> + </view> + </view> + + </view> + + </view> </view> <view class="line"></view> <view class="delivery-form"> <view class="form-item" style="max-width: 100%;"> <view class="label">下单时间</view> - <view class="value">{{item.paymentTime}}</view> + <view class="value">{{dto.paymentTime}}</view> </view> </view> <view class="delivery-form"> <view class="form-item"> <view class="label">仓库名称</view> - <view class="value red">{{item.warehouseName || '待分配'}}</view> + <view class="value red">{{dto.warehouseName || '待分配'}}</view> </view> <view class="form-item"> <view class="label">库位名称</view> - <view class="value red">{{item.warehouseLocationCode || '待分配'}}</view> + <view class="value red">{{dto.warehouseLocationCode || '待分配'}}</view> </view> </view> @@ -70,9 +81,9 @@ <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> + <view class="button button-1 m-r-10" v-if="dto.status==='PENDING'" + @click="toDetail(dto,'PENDING')">确认入位</view> + <view class="button button-0" @click="toDetail(dto,'')">查看详情</view> </view> @@ -103,7 +114,7 @@ } this.listApi = '/api/supplier/delivery/list/today' this.listApi = '/api/supplier/delivery/list' - + this.getList() }, @@ -134,7 +145,7 @@ url: `/pages/order/order-delivery-detail?id=${item.id}&status=${status}` }) }, - + } } </script> @@ -145,6 +156,32 @@ background-color: #fff; margin-bottom: 20rpx; padding: 22rpx; + .each-item{ + .label{ + min-width: 120rpx; + + } + .label:after{ + content: ":"; + margin-right: 10rpx; + } + } + + .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; + } + } .buttons { display: flex; diff --git a/store/index.js b/store/index.js index 6146367..528e0f9 100644 --- a/store/index.js +++ b/store/index.js @@ -108,6 +108,16 @@ console.log('sign_add', key) state.sign[key] = 1 }, + // sign_add_value: async function({ + // commit, + // state + // }, { + // key, + // value + // }) { + // console.log('sign_add', key) + // state.sign[key] = value || 0 + // }, sign_clear: async function({ commit, state @@ -506,7 +516,11 @@ state }, data) { if (state.currentInfo.id) { - const resp = await http.request('get', '/api/customer/flower/cart/flower/count', {}) + const resp = await http.request('get', '/api/customer/flower/cart/flower/count', { + params: { + // flowerId: data || null + } + }) if (resp && resp.code === 0) { return resp.data || 0 } else { diff --git a/sub_pages/customer/self/collect.vue b/sub_pages/customer/self/collect.vue index 7f2c6ed..1e4fcd1 100644 --- a/sub_pages/customer/self/collect.vue +++ b/sub_pages/customer/self/collect.vue @@ -229,7 +229,7 @@ <view class="trade-list-container"> <view class="trade-info-container flex" :class="[dto.status!=='UP'?'OFF':'']" 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> + <image class="img img100 br-4 m-r-10" :class="[!dto.stock?'component-stock-zero':'']" :src="dto.url||dto.cover" @click.stop="toDetail(dto)"></image> <view class="flex1"> <view class="flex" @click.stop="toDetail(dto)"> <view class="title"> diff --git a/sub_pages/customer/self/history.vue b/sub_pages/customer/self/history.vue index 8044427..29bd4b1 100644 --- a/sub_pages/customer/self/history.vue +++ b/sub_pages/customer/self/history.vue @@ -191,7 +191,7 @@ <view class="trade-list-container"> <view class="trade-info-container flex" :class="[dto.status!=='UP'?'OFF':'']" 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> + <image class="img img100 br-4 m-r-10" :class="[!dto.stock?'component-stock-zero':'']" :src="dto.url||dto.cover" @click.stop="toDetail(dto)"></image> <view class="flex1"> <view class="flex" @click.stop="toDetail(dto)"> <view class="title"> diff --git a/sub_pages/customer/shopping/shopping.vue b/sub_pages/customer/shopping/shopping.vue index 6f1f5f5..32be4c3 100644 --- a/sub_pages/customer/shopping/shopping.vue +++ b/sub_pages/customer/shopping/shopping.vue @@ -28,7 +28,7 @@ <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> + <image class="img img100 m-r-6 br-4" :class="[!dto.stock?'component-stock-zero':'']" :src="dto.url||dto.cover"></image> <view class="flex1"> <view class="title" @click.stop="toDetail(dto)"><span class="m-r-5" style="display: inline-block;">{{dto.categoryStr||''}}</span><span @@ -46,7 +46,8 @@ <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" @click.stop="updateItemNum(dto)" 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> @@ -97,14 +98,15 @@ } }, onShow() { - if (this.sign['shopping']) { - this.init() - } - }, - mounted() { + // if (this.sign['shopping']) { + + // } this.init() }, - async onPullDownRefresh(){ + mounted() { + // this.init() + }, + async onPullDownRefresh() { await this.init() uni.stopPullDownRefresh() }, @@ -163,12 +165,12 @@ }) } }, - async clickSwipeButton(item,check) { + async clickSwipeButton(item, check) { //删除商品,重新加载数据? - if(check){ + if (check) { this.$message.confirm('是否删除商品') return - + } this.$message.showLoading() @@ -308,30 +310,30 @@ 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) + console.log('addnum', dto, addnum) return } if (!dto.stock) { dto.stock = 0 } - if (dto.num + addnum > dto.stock) { + if (addnum > 0 && dto.num + addnum > dto.stock) { this.$message.showToast('库存不足,无法修改') return } @@ -349,17 +351,17 @@ dto.num += addnum if (dto.num < 1) { //id删除清空,并且 - await this.clickSwipeButton(dto,false) + 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 diff --git a/sub_pages/customer/trade/detail.vue b/sub_pages/customer/trade/detail.vue index 5bf0d9e..dec4ff7 100644 --- a/sub_pages/customer/trade/detail.vue +++ b/sub_pages/customer/trade/detail.vue @@ -172,7 +172,7 @@ } else { if (!item.stock || t > item.stock) { - this.$message.showToast('库存不足无法修改') + this.$message.showToast('库存不足无法修改') return } this.addnum(item, (t - item.shopnum)) @@ -223,7 +223,9 @@ }, async refreshShopNum() { - this.shopnum = await this.$store.dispatch('countShopping'); + this.shopnum = await this.$store.dispatch('countShopping'); + this.$store.dispatch('sign_add','shopnum') + }, async collectItem(dto) { if (!this.currentInfo.id) { diff --git a/sub_pages/customer/trade/list.vue b/sub_pages/customer/trade/list.vue index 125734f..2724ba3 100644 --- a/sub_pages/customer/trade/list.vue +++ b/sub_pages/customer/trade/list.vue @@ -35,7 +35,7 @@ <!-- 查询条件 --> <view class="component-filter-container"> <view class="flex1" @click.stop="order_show=true"> - {{ query.columnStr || '排序' }} + 排序{{ query.columnStr&&('-'+query.columnStr) || '' }} <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image> </view> <view class="flex1" @click.stop="level_show=true"> @@ -59,7 +59,7 @@ <view class="component-shop-item flex" v-for="(item,index) of list" :key="index"> <view class="img" @click.stop="toDetail(item)"> - <image class="img img100" :src="item.cover"> + <image class="img img100" :class="[!item.stock?'component-stock-zero':'']" :src="item.cover"> </image> <view class="level"> {{item.levelStr||''}} @@ -129,8 +129,8 @@ <view v-for="(item,i) in 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> @@ -138,12 +138,13 @@ <view class="button-space"></view> <view> <view class="button-green" - style="background-color: #fff;border: 2rpx solid #666; color: #666;width: 200rpx;left: 40rpx;right: unset;" - @click="closeParamPopAndQuery"> - 查询 + style="background-color: #fff;border: 2rpx solid #666; color: #666;min-width: 240rpx;left: 40rpx;right: unset;" + @click="closeParamPop"> + 关闭 </view> - <view class="button-green" style="width: 200rpx;right: 40rpx;left: unset;" @click="closeParamPop">关闭 + <view class="button-green" style="min-width: 240rpx;right: 40rpx;left: unset;" + @click="closeParamPopAndQuery">查询 </view> </view> </view> @@ -237,13 +238,19 @@ this.page.current = 1 await this.getList('post') uni.stopPullDownRefresh() - }, - onShow(){ - this.refreshShopNum() }, - methods: { - async refreshShopNum() { - this.shoptotal = await this.$store.dispatch('countShopping'); + async onShow() { + if (this.sign['shopnum']) { + await this.$store.dispatch('sign_clear', 'shopnum'); + //重新获取商品数目 + //只需要刷新列表的部分信息即可 + this.getList('post') + } + this.refreshShopNum() + }, + methods: { + async refreshShopNum() { + this.shoptotal = await this.$store.dispatch('countShopping'); }, async getDetail() { this.$message.showLoading() @@ -262,8 +269,13 @@ } }, updateValue(item, value) { - item.value = value - this.$set(item, 'value', value) + // item.value = value + // this.$set(item, 'value', value) + if (item.value.indexOf(value) < 0) { + item.value.push(value) + } else { + item.value.splice(item.value.indexOf(value), 1) + } this.$forceUpdate() }, closeParamPop() { @@ -274,10 +286,10 @@ //设置参数 this.query.params = [] for (var param of this.params) { - if (param.value) { + if (param.value && param.value.length > 0) { this.query.params.push({ id: param.id, - value: param.value + value: param.value.join(',') }) } } @@ -286,7 +298,7 @@ async showSelectParams() { //得有分类才有参数 this.$message.showLoading() - const res = await this.$http.request('get', '/api/supplier/flower/params', { + const res = await this.$http.request('get', '/api/customer/flower/params', { params: { categoryId: this.query.category } @@ -295,6 +307,13 @@ if (res.code === 0) { // this.columns_params = res.data || [] this.params = res.data || [] + for (var k of this.params) { + if (!k.value) { + k.value = [] + } else { + k.value = k.value.split(',') || [] + } + } this.$refs.popup_param.open() } @@ -337,15 +356,15 @@ } if (!item.stock) { item.stock = 0 - } - if (!item.shopnum) { - item.shopnum = 0 + } + if (!item.shopnum) { + item.shopnum = 0 } if (addnum > 0 & item.shopnum + addnum > item.stock) { this.$message.showToast('库存不足,无法修改') return } - + if (item.shopnum + addnum >= 0) { } else { @@ -362,11 +381,11 @@ }) this.$message.hideLoading() if (code === 0) { - item.shopnum += addnum - this.$forceUpdate() - - this.refreshShopNum() - + item.shopnum += addnum + this.$forceUpdate() + + this.refreshShopNum() + } }, } diff --git a/sub_pages/customer/trade/trade.vue b/sub_pages/customer/trade/trade.vue index 1bfcc37..b892b91 100644 --- a/sub_pages/customer/trade/trade.vue +++ b/sub_pages/customer/trade/trade.vue @@ -39,13 +39,14 @@ @click.stop="toDetailList(item)"> <view class="m-r-10"> <!-- @click.stop="previewImg(item.imageUrl)" --> - <image :src="item.imageUrl" mode="scaleToFill" class="cover" :lazy-load="true"> + <image :src="item.imageUrl" :class="[!item.stock?'component-stock-zero':'']" + mode="scaleToFill" class="cover" :lazy-load="true"> </image> </view> <view class="cateen_infos list"> <view class="title">{{item.name}}</view> - <view class="price">¥{{minWeightPrice(item)}}-{{maxWeightPrice(item)}}</view> - <view class="desc">在售 {{item.stock||'-'}} 扎</view> + <view class="price">¥{{item.priceLow || 0}}-{{item.priceHigh||0}}</view> + <view class="desc">在售 {{item.stock||'0'}} 扎</view> </view> diff --git a/sub_pages/partner/delivery/delivery.vue b/sub_pages/partner/delivery/delivery.vue index 95fb407..1311844 100644 --- a/sub_pages/partner/delivery/delivery.vue +++ b/sub_pages/partner/delivery/delivery.vue @@ -30,12 +30,13 @@ type: 'DELIVERY_ORDER_STATUS' } }).then(res => { - var data = res.data + var data = res.data||[] this.status_columns = [data || []] this.status_columns[0].unshift({ label: '全部', value: '' }) + console.log('status_columns',this.status_columns) }) }, @@ -59,8 +60,8 @@ }, select_status(e) { this.show_select_status = false - this.query.statusStr = e.value[0].name - this.query.status = e.value[0].id + this.query.statusStr = e.value[0].label + this.query.status = e.value[0].value this.refreshList() }, toDetail(item) { @@ -160,7 +161,7 @@ <footer-msg :more="page.total>0&&page.total>page.current*page.size"></footer-msg> <u-picker @confirm="select_station" keyName="name" @cancel="show_select_station=false" :show="show_select_station" :columns="columns_station"></u-picker> - <u-picker @confirm="select_status" keyName="name" @cancel="show_select_status=false" :show="show_select_status" + <u-picker @confirm="select_status" keyName="label" @cancel="show_select_status=false" :show="show_select_status" :columns="status_columns"></u-picker> diff --git a/sub_pages/supplier/print/print-list.vue b/sub_pages/supplier/print/print-list.vue index 4fa77ed..2bebd11 100644 --- a/sub_pages/supplier/print/print-list.vue +++ b/sub_pages/supplier/print/print-list.vue @@ -17,23 +17,23 @@ <view class="title">{{item.flowerName }} </view> </view> - <view class="each-list flex"> - <view class="each-item"> + <view class="each-list "> + <view class="each-item flex1 flex"> <view class="label">颜色</view> <view class="value">{{ item.flowerColor || '-' }}</view> </view> - <view class="each-item"> + <view class="each-item flex1 flex"> <view class="label">规格</view> <view class="value">{{ item.flowerUnit || '-' }}</view> </view> </view> </view> <view class="each-list price"> - <view class="each-item"> + <view class="each-item flex1"> <view class="value">¥{{ item.price || '-' }}</view> </view> - <view class="each-item"> + <view class="each-item flex1"> <view class="value">x {{ item.num || 0 }}</view> </view> </view> @@ -51,6 +51,15 @@ </view> </view> + <!-- 罗列详细参数 --> + <view class="line" v-if="item.params"></view> + <view class="delivery-form" v-if="item.params"> + <view class="form-item" v-for="(p,k) of item.params" :key="k"> + <view class="label">{{p.name||'-'}}:</view> + <view class="value red">{{p.value}}</view> + </view> + </view> + </view> </view> </view> @@ -69,6 +78,7 @@ <script> var tsc = require("@/plugins/tsc.js"); + // var app = uni.getApp() export default { data() { @@ -80,6 +90,7 @@ readCharacter: false, notifyCharacter: false, isScanning: false, + deviceId: '', //打印的 sendContent: "", looptime: 0, @@ -96,13 +107,71 @@ printerNum: 1, currentPrint: 1, isReceiptSend: false, - isLabelSend: false + isLabelSend: false, + //写入的 + writeServiceId: '', + writeCharaterId: '', + notifyCharaterId: {}, + notifyServiceId: '', + BserviceId: '', } }, - onLoad() { + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + var list = [] + var numList = [] + var j = 0 + for (var i = 20; i < 200; i += 10) { + list[j] = i; + j++ + } + for (var i = 1; i < 10; i++) { + numList[i - 1] = i + } + let that = this + that.buffSize = list + that.oneTimeData = list[0] + that.printNum = numList + that.printerNum = numList[0] + }, + async onLoad() { var t = this.$storage.getItem('cache_delivery_order_print') || '' - if (t) + if (t) { this.item = JSON.parse(t) + //获取详情接口 + this.$message.showLoading() + const { + code, + data + } = await this.$http.request('get', '/api/supplier/delivery/list/items/view', { + params: { + id: this.item.id + } + }) + this.$message.hideLoading() + if (code == 0 && data) { + this.item = { + ...this.item, + ...data + } + } + } else { + this.$message.showToast('获取详情失败') + } + }, + onUnload() { + try { + wx.closeBLEConnection({ + deviceId: that.deviceId, + success: function(res) { + console.log("关闭蓝牙成功") + }, + }) + } catch (e) { + + } }, methods: { /** @@ -145,17 +214,20 @@ */ checkPemission: function() { //android 6.0以上需授权地理位置权限 var that = this - var platform = app.BLEInformation.platform + var platform = uni.getDeviceInfo().platform if (platform == "ios") { - app.globalData.platform = "ios" + // uni.getDeviceInfo().platform = "ios" that.getBluetoothDevices() } else if (platform == "android") { - app.globalData.platform = "android" - console.log(app.getSystem()) //这里是拿到安卓的系统版本名 如:Android 9 - console.log('输出系统版本号', app.getSystem().substring(app.getSystem().length - (app.getSystem().length - - 8), app.getSystem().length - (app.getSystem().length - 8) + 1)) //这里为了获取到系统的版本号,如 9 - var systemVersion = app.getSystem().substring(app.getSystem().length - (app.getSystem().length - - 8), app.getSystem().length - (app.getSystem().length - 8) + 1) + // uni.getDeviceInfo().platform = "android" + console.log(uni.getDeviceInfo()) //这里是拿到安卓的系统版本名 如:Android 9 + console.log('输出系统版本号', uni.getDeviceInfo().system.substring(uni.getDeviceInfo().system.length - ( + uni.getDeviceInfo().system.length - + 8), uni.getDeviceInfo().system.length - (uni.getDeviceInfo().system.length - 8) + + 1)) //这里为了获取到系统的版本号,如 9 + var systemVersion = uni.getDeviceInfo().system.substring(uni.getDeviceInfo().system.length - (uni + .getDeviceInfo().system.length - + 8), uni.getDeviceInfo().system.length - (uni.getDeviceInfo().system.length - 8) + 1) if (systemVersion > 5) { wx.getSetting({ success: function(res) { @@ -185,9 +257,7 @@ wx.showLoading({ title: '获取蓝牙设备中', }) - that.setData({ - isScanning: true - }) + that.isScanning = true wx.startBluetoothDevicesDiscovery({ success: function(res) { console.log(res) //输出蓝牙设备列表查找的结果,是否成功 @@ -204,10 +274,10 @@ num++ } } - that.setData({ - list: devices, - isScanning: false - }) // 数据赋值 关闭刷新 + // 数据赋值 关闭刷新 + that.list = devices + that.isScanning = false + wx.hideLoading() wx.stopPullDownRefresh() }, @@ -227,23 +297,23 @@ console.log(res) }, }) - that.setData({ - serviceId: 0, - writeCharacter: false, - readCharacter: false, - notifyCharacter: false - }) - console.log("e", e) + + that.serviceId = 0 + that.writeCharacter = false + that.readCharacter = false + that.notifyCharacter = false + + console.log("e", device) // console.log(e.currentTarget.dataset.title) wx.showLoading({ title: '正在建立连接', }) // 与蓝牙设备建立链接 wx.createBLEConnection({ - deviceId: e.deviceId, + deviceId: device.deviceId, success: function(res) { console.log('连接蓝牙设备成功', res) - app.BLEInformation.deviceId = e.deviceId + that.deviceId = device.deviceId that.getSeviceId() //获取服务ID }, fail: function(e) { @@ -262,10 +332,11 @@ getSeviceId: function() { var that = this - var platform = app.BLEInformation.platform //获取平台信息 - console.log(app.BLEInformation.deviceId) // 获取设备ID + var platform = uni.getDeviceInfo().platform //获取平台信息 + console.log(that.deviceId) // 获取设备ID + console.log('info getSeviceId', uni.getDeviceInfo()) wx.getBLEDeviceServices({ - deviceId: app.BLEInformation.deviceId, + deviceId: that.deviceId, success: function(res) { console.log(res) // 注释内容为方便调试特意直接赋值的一些信息,可以跳过 @@ -287,10 +358,9 @@ // } // } } - app.BLEInformation.serviceId = realId - that.setData({ - services: res.services - }) //将服务信息赋值到公共数据缓存 + that.BserviceId = realId + that.services = res.services + that.getCharacteristics() //获取特征 }, fail: function(e) { @@ -307,13 +377,13 @@ */ getCharacteristics: function() { var that = this - var list = that.data.services - var num = that.data.serviceId - var write = that.data.writeCharacter - var read = that.data.readCharacter - var notify = that.data.notifyCharacter + var list = that.services + var num = that.serviceId + var write = that.writeCharacter + var read = that.readCharacter + var notify = that.notifyCharacter wx.getBLEDeviceCharacteristics({ //获取蓝牙设备的特征信息 - deviceId: app.BLEInformation.deviceId, + deviceId: that.deviceId, serviceId: list[num].uuid, success: function(res) { console.log('获取特征成功的结果', res) @@ -322,34 +392,35 @@ var item = res.characteristics[i].uuid if (!notify) { if (properties.notify) { - app.BLEInformation.notifyCharaterId = item - app.BLEInformation.notifyServiceId = list[num].uuid + that.notifyCharaterId = item + that.notifyServiceId = list[num].uuid notify = true } } if (!write) { if (properties.write) { - app.BLEInformation.writeCharaterId = item - app.BLEInformation.writeServiceId = list[num].uuid + that.writeCharaterId = item + that.writeServiceId = list[num].uuid write = true } } if (!read) { if (properties.read) { - app.BLEInformation.readCharaterId = item - app.BLEInformation.readServiceId = list[num].uuid + that.readCharaterId = item + that.readServiceId = list[num].uuid read = true } } } if (!write || !notify || !read) { num++ - that.setData({ - writeCharacter: write, - readCharacter: read, - notifyCharacter: notify, - serviceId: num - }) + + that.writeCharacter = write + that.readCharacter = read + that.notifyCharacter = notify + that.serviceId = num + + if (num == list.length) { wx.showModal({ title: '提示', @@ -366,34 +437,69 @@ console.log(e) }, complete: function(e) { - console.log("write:" + app.BLEInformation.writeCharaterId) - console.log("read:" + app.BLEInformation.readCharaterId) - console.log("notify:" + app.BLEInformation.notifyCharaterId) + console.log("write:" + that.writeCharaterId) + console.log("read:" + that.readCharaterId) + console.log("notify:" + that.notifyCharaterId) } }) }, openControl() { //打印 var that = this; - // var canvasWidth = that.data.canvasWidth - // var canvasHeight = that.data.canvasHeight + var command = tsc.jpPrinter.createNew() - command.setSize(48, 40) + command.setSize(48, 96) command.setGap(0) command.setCls() - command.setText(0, 30, "TSS24.BF2", 1, 1, "图片") - command.setQR(40, 120, "L", 5, "A", "www.smarnet.cc佳博智汇") - command.setText(60, 90, "TSS24.BF2", 1, 1, "佳博智汇") - command.setText(170, 50, "TSS24.BF2", 1, 1, "小程序测试") - command.setText(170, 90, "TSS24.BF2", 1, 1, "测试数字12345678") - command.setText(170, 120, "TSS24.BF2", 1, 1, "测试英文abcdefg") - command.setText(170, 150, "TSS24.BF2", 1, 1, "测试符号/*-+!@#$") - command.setBar(170, 180, "EAN8", 64, 1, 3, 3, "1234567") + // command.setText(0, 30, "TSS24.BF2", 1, 1, "图片") + // command.setQR(40, 120, "L", 5, "A", "www.smarnet.cc佳博智汇") + command.setText(60, 20, "TSS24.BF2", 1, 1, "单号:" + (that.item.orderNo || '-')) + if (that.item.warehouseName) + command.setText(20, 60, "TSS24.BF2", 1, 1, "仓库: " + that.item.warehouseName) + if (that.item.warehouseLocationCode) + command.setText(200, 60, "TSS24.BF2", 1, 1, "库位: " + that.item.warehouseLocationCode) + + // command.setText(170, 50, "TSS24.BF2", 1, 1, "小程序测试") + // command.setText(170, 90, "TSS24.BF2", 1, 1, "测试数字12345678") + // command.setText(170, 120, "TSS24.BF2", 1, 1, "测试英文abcdefg") + // command.setText(170, 150, "TSS24.BF2", 1, 1, "测试符号/*-+!@#$") + command.setText(20, 100, "TSS24.BF2", 1, 1, "供应商: " + (that.item.supplierName || '-')) + command.setText(20, 140, "TSS24.BF2", 1, 1, "商品名称: " + (that.item.flowerName || '-')) + command.setText(20, 180, "TSS24.BF2", 1, 1, "等级: " + (that.item.flowerLevelStr || '-')) + command.setText(200, 180, "TSS24.BF2", 1, 1, "颜色: " + (that.item.flowerColor || '-')) + command.setText(20, 220, "TSS24.BF2", 1, 1, "价格: ¥ " + (that.item.price || '-')) + command.setText(200, 220, "TSS24.BF2", 1, 1, "数目: x " + (that.item.num || '0')) + command.setText(20, 260, "TSS24.BF2", 1, 1, "规格: " + (that.item.flowerUnit || '-')) + command.setText(20, 300, "TSS24.BF2", 1, 1, "花满芫") + command.setText(170, 300, "TSS24.BF2", 1, 1, that.$util.toDateMin(new Date())) + if (that.item.params) { + var addnum = 0 + var hlen = 300 + for (var p of that.item.params) { + if (p.value) { + var lef = 20 + if (addnum % 2 == 1) { + lef = 200 + } else { + lef = 20 + hlen += 40 + } + command.setText(lef, hlen, "TSS24.BF2", 1, 1, "" + (p.name || '') + p.value) + addnum += 1 + } + } + } + // <view class="delivery-form" v-if="item.params"> + // <view class="form-item" v-for="(p,k) of item.params" :key="k"> + // <view class="label">{{p.name||'-'}}:</view> + // <view class="value red">{{p.value}}</view> + // </view> + // </view> + // command.setBar(170, 180, "EAN8", 64, 1, 3, 3, "1234567") command.setPagePrint() - that.setData({ - isLabelSend: true - }) + + that.isLabelSend = true that.prepareSend(command.getData()) // wx.canvasGetImageData({ @@ -413,25 +519,24 @@ prepareSend: function(buff) { //准备发送,根据每次发送字节数来处理分包数量 console.log(buff) var that = this - var time = that.data.oneTimeData + var time = that.oneTimeData var looptime = parseInt(buff.length / time); var lastData = parseInt(buff.length % time); console.log(looptime + "---" + lastData) - that.setData({ - looptime: looptime + 1, - lastData: lastData, - currentTime: 1, - }) + + that.looptime = looptime + 1 + that.lastData = lastData + that.currentTime = 1 that.Send(buff) }, Send: function(buff) { //分包发送 var that = this - var currentTime = that.data.currentTime - var loopTime = that.data.looptime - var lastData = that.data.lastData - var onTimeData = that.data.oneTimeData - var printNum = that.data.printerNum - var currentPrint = that.data.currentPrint + var currentTime = that.currentTime + var loopTime = that.looptime + var lastData = that.lastData + var onTimeData = that.oneTimeData + var printNum = that.printerNum + var currentPrint = that.currentPrint var buf var dataView if (currentTime < loopTime) { @@ -449,9 +554,9 @@ } console.log("第" + currentTime + "次发送数据大小为:" + buf.byteLength) wx.writeBLECharacteristicValue({ - deviceId: app.BLEInformation.deviceId, - serviceId: app.BLEInformation.writeServiceId, - characteristicId: app.BLEInformation.writeCharaterId, + deviceId: that.deviceId, + serviceId: that.writeServiceId, + characteristicId: that.writeCharaterId, value: buf, success: function(res) { console.log(res) @@ -462,29 +567,27 @@ complete: function() { currentTime++ if (currentTime <= loopTime) { - that.setData({ - currentTime: currentTime - }) + that.currentTime = currentTime + that.Send(buff) } else { wx.showToast({ title: '已打印第' + currentPrint + '张', }) if (currentPrint == printNum) { - that.setData({ - looptime: 0, - lastData: 0, - currentTime: 1, - isReceiptSend: false, - isLabelSend: false, - currentPrint: 1 - }) + that.looptime = 0 + that.lastData = 0 + that.currentTime = 1 + that.isReceiptSend = false + that.isLabelSend = false + that.currentPrint = 1 + } else { currentPrint++ - that.setData({ - currentPrint: currentPrint, - currentTime: 1, - }) + + that.currentPrint = currentPrint + that.currentTime = 1 + that.Send(buff) } } @@ -538,6 +641,18 @@ margin-bottom: 20rpx; padding: 22rpx; + .each-item { + .label { + min-width: 120rpx; + + } + + .label:after { + content: ":"; + margin-right: 10rpx; + } + } + .buttons { display: flex; margin-left: auto; -- Gitblit v1.9.3