diff --git a/src/pageB/code/index.vue b/src/pageB/code/index.vue index 3ff1573..639f219 100644 --- a/src/pageB/code/index.vue +++ b/src/pageB/code/index.vue @@ -1,6 +1,6 @@ @@ -68,12 +71,13 @@ }, data() { return { - isShow:true, + modeShow: false, + isShow: true, id: '', keyword: '', list: [], //搜索的商品 chooseList: [], //选择的商品 - goodItem:{}, + goodItem: {}, }; }, onLoad({ @@ -81,19 +85,19 @@ }) { this.id = id }, - computed:{ + computed: { //普通价格合计 - totalPrice(){ - const total=this.chooseList.reduce((pr, cu)=>{ - return pr+cu.sell_price*cu.num - },0) + totalPrice() { + const total = this.chooseList.reduce((pr, cu) => { + return pr + cu.sell_price * cu.num + }, 0) return total }, //会员价合计 - vipPrice(){ - const total=this.chooseList.reduce((pr, cu)=>{ - return pr+cu.vip_price*cu.num - },0) + vipPrice() { + const total = this.chooseList.reduce((pr, cu) => { + return pr + cu.vip_price * cu.num + }, 0) return total } }, @@ -108,32 +112,72 @@ if (this.list.length == 0) { return this.$u.toast('暂未搜索到该商品') } - this.isShow=false + this.isShow = false let goodsObj = resDate.data.length > 0 ? resDate.data[0] : {} - goodsObj.defaultNum =1 + goodsObj.defaultNum = 1 goodsObj.num = 1 this.goodItem = goodsObj }, //添加商品 addGood(e) { - const result=this.chooseList.findIndex(item=> item.id==e) - if(result==-1){ + const result = this.chooseList.findIndex(item => item.id == e) + if (result == -1) { this.chooseList.unshift(this.goodItem) - }else{ - const num= this.chooseList[result].num+1 - this.getUpdate(result,num) + } else { + const num = this.chooseList[result].num + 1 + this.getUpdate(result, num) } }, //商品数量改变 - numChange(id,value){ - const Index= this.chooseList.findIndex(item=>item.id==id) - this.getUpdate(Index,value) + numChange(id, value) { + const Index = this.chooseList.findIndex(item => item.id == id) + this.getUpdate(Index, value) }, //刷新页面 - getUpdate(Index,val){ - this.chooseList[Index].num=val - this.chooseList[Index].defaultNum=val - this.chooseList=[...this.chooseList] + getUpdate(Index, val) { + this.chooseList[Index].num = val + this.chooseList[Index].defaultNum = val + this.chooseList = [...this.chooseList] + }, + qrCode() { + if (this.chooseList.length == 0) { + return this.$u.toast('至少选选择一件商品') + } + this.modeShow = true + }, + //生成二维码 + async confirm() { + uni.showLoading({ + title: '二维码生成中', + mask: true + }); + try { + const arrList = this.chooseList.map(item => { + return { + sku_id: item.id, + quantity: item.num, + send: item.defaultNum + } + }) + const obj = { + store_id: this.id, + products: arrList, + note: '' + } + const { + image + } = await this.$api.post(`/v1/order-pre`, obj); + this.$u.route('/pageB/code/index', { + image + }) + this.keyword = '' + this.list = [] + this.chooseList = [] + this.goodItem = {} + this.isShow = true + } catch (err) {}finally{ + uni.hideLoading() + } } } } diff --git a/src/pages/confirm_payment/confirm_payment.vue b/src/pages/confirm_payment/confirm_payment.vue index 3c1bffb..43d004d 100644 --- a/src/pages/confirm_payment/confirm_payment.vue +++ b/src/pages/confirm_payment/confirm_payment.vue @@ -45,7 +45,7 @@ - -¥{{ discountCount }} + -¥{{ discountCount }} 合计: ¥{{ detail.total_amount }} @@ -103,14 +103,14 @@ export default { // name: '支付宝', // pay_way: 'alipay', // }, - { - name: '可提', - pay_way: 'wallet', - }, - { - name: '余额', - pay_way: 'balance', - }, + // { + // name: '可提', + // pay_way: 'wallet', + // }, + // { + // name: '余额', + // pay_way: 'balance', + // }, ], payWay: 'wxpay', detail: {}, diff --git a/src/pages/me/me.vue b/src/pages/me/me.vue index 4fec84d..ad819e7 100644 --- a/src/pages/me/me.vue +++ b/src/pages/me/me.vue @@ -360,8 +360,7 @@ export default { }, //是否为店员 is_company(){ - // return this.user?.is_company??false - return true + return this.user?.is_company??false } }, onShow() { diff --git a/src/pages/order_details/index.vue b/src/pages/order_details/index.vue index 4189b59..9db4c2d 100644 --- a/src/pages/order_details/index.vue +++ b/src/pages/order_details/index.vue @@ -1,6 +1,6 @@