Commit e92e93f736dc5fa6b70e21912657ba890c6955ef
Exists in
master
合并冲突
Showing
12 changed files
Show diff stats
src/components/BottomSheet/BottomSheet.vue
... | ... | @@ -181,22 +181,22 @@ |
181 | 181 | <view class="ipts"> |
182 | 182 | <view class="inputItem"> |
183 | 183 | <text class="text">镜片宽度</text> |
184 | - <input class="input" @input="glassInfoInput($event,0)" type="text" :value="glassInfo.glassWidth" placeholder="请输入镜片宽度"/> | |
184 | + <input class="input" @input="glassInfoInput($event,0)" type="text" :value="glassInfo.glassWidth!=='0'?glassInfo.glassWidth:''" placeholder="请输入镜片宽度"/> | |
185 | 185 | </view> |
186 | 186 | <view class="inputItem"> |
187 | 187 | <text class="text">鼻梁宽度</text> |
188 | - <input class="input" @input="glassInfoInput($event,1)" type="text" :value="glassInfo.norseWidth" placeholder="请输入鼻梁宽度"/> | |
188 | + <input class="input" @input="glassInfoInput($event,1)" type="text" :value="glassInfo.norseWidth!=='0'?glassInfo.norseWidth:''" placeholder="请输入鼻梁宽度"/> | |
189 | 189 | </view> |
190 | 190 | <view class="inputItem"> |
191 | 191 | <text class="text">镜腿长度</text> |
192 | - <input class="input" @input="glassInfoInput($event,2)" type="text" :value="glassInfo.legWidth" placeholder="请输入镜腿长度"/> | |
192 | + <input class="input" @input="glassInfoInput($event,2)" type="text" :value="glassInfo.legWidth!=='0'?glassInfo.legWidth:''" placeholder="请输入镜腿长度"/> | |
193 | 193 | </view> |
194 | 194 | |
195 | 195 | </view> |
196 | - <view class="confirm"> | |
196 | + <!-- <view class="confirm"> | |
197 | 197 | <image class="image1" :src="confirm ? tabicon[0] : tabicon[1]" @tap="changeConfirm"></image> |
198 | 198 | <text>确认以上输入信息来源于我的验光数据!</text> |
199 | - </view> | |
199 | + </view> --> | |
200 | 200 | </view> |
201 | 201 | </template> |
202 | 202 | <template v-else> |
... | ... | @@ -332,8 +332,8 @@ import store from '@/store' |
332 | 332 | { nameC: '散光轴位', nameE: '(AXI)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 2 }, |
333 | 333 | { nameC: '验光日期', nameE: '', nameArray1: [''], nameIndex1: 0, nameArray2: ['', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], nameIndex2: 0, nameArray3: [''], nameIndex3: 0 }, |
334 | 334 | ], |
335 | - confirm: false, // 用户是否确认 | |
336 | - tabicon: ['/static/detail-button.png', '/static/detail-button-unselected.png'], | |
335 | + // confirm: false, // 用户是否确认 | |
336 | + // tabicon: ['/static/detail-button.png', '/static/detail-button-unselected.png'], | |
337 | 337 | name: '', |
338 | 338 | oldname: '', // 用于判读用户是否改变名字 |
339 | 339 | pickerInfoChioce: { |
... | ... | @@ -350,8 +350,8 @@ import store from '@/store' |
350 | 350 | }, |
351 | 351 | }, |
352 | 352 | glassInfo:{ |
353 | - norseWidth:Number,//鼻宽 | |
354 | 353 | glassWidth:Number,//镜片宽度 |
354 | + norseWidth:Number,//鼻宽 | |
355 | 355 | legWidth:Number//镜腿长度 |
356 | 356 | }, |
357 | 357 | pd: '', // 瞳距 |
... | ... | @@ -420,6 +420,11 @@ import store from '@/store' |
420 | 420 | |
421 | 421 | return this.$store.state.myLoveList.loveList |
422 | 422 | }, |
423 | + glassInfoRight(){ | |
424 | + const glassInfoArr = Object.values(this.glassInfo) | |
425 | + // console.log('glassInfoArr',glassInfoArr.find(item => item == '0')) | |
426 | + return glassInfoArr.find(item => item == '0') ==undefined | |
427 | + } | |
423 | 428 | }, |
424 | 429 | created() { |
425 | 430 | this.skuValueArray = this.skuList[0].sku_value.split("_") |
... | ... | @@ -439,13 +444,10 @@ import store from '@/store' |
439 | 444 | }else{ |
440 | 445 | this.skId = this.sk_id |
441 | 446 | } |
442 | - | |
443 | 447 | //获取关心的人列表 |
444 | 448 | store.dispatch('myLoveList/getLoveList', { |
445 | 449 | uid: this.$store.state.user.userInfo.uid, |
446 | 450 | }); |
447 | - | |
448 | - | |
449 | 451 | // 初始化SPL、CYL、AXI的值 |
450 | 452 | for (let j = 0; j < 3; j++) { |
451 | 453 | for (let i = -12; i < 6; i++) { |
... | ... | @@ -478,11 +480,14 @@ import store from '@/store' |
478 | 480 | }, |
479 | 481 | name : "bottomSheet", |
480 | 482 | methods: { |
483 | + //判断眼镜数据是否为0 | |
481 | 484 | checkGlassInfo(){ |
482 | - const glassInfoArr = Object.values(this.glassInfo) | |
483 | - if(glassInfoArr.find(item => item == '0') !=='undefind'){ | |
484 | - uni.showModal({ | |
485 | - title:'请完善镜框数据~' | |
485 | + // const glassInfoArr = Object.values(this.glassInfo) | |
486 | + // console.log(this.glassInfoRight) | |
487 | + if(!this.glassInfoRight){ | |
488 | + uni.showToast({ | |
489 | + title:'请完善镜框数据~', | |
490 | + icon:'none' | |
486 | 491 | }) |
487 | 492 | } |
488 | 493 | }, |
... | ... | @@ -491,8 +496,6 @@ import store from '@/store' |
491 | 496 | const glassWidth = this.glassInfo.glassWidth |
492 | 497 | const norseWidth = this.glassInfo.norseWidth |
493 | 498 | const legWidth = this.glassInfo.legWidth |
494 | - console.log(loveItem.glassWidth) | |
495 | - console.log(glassWidth) | |
496 | 499 | if(loveItem.glassWidth !== glassWidth){ |
497 | 500 | store.dispatch('myLoveList/updateMylove', { |
498 | 501 | uid: this.$store.state.user.userInfo.uid, |
... | ... | @@ -552,34 +555,38 @@ import store from '@/store' |
552 | 555 | }, |
553 | 556 | comfirmChoose(){ |
554 | 557 | this.checkGlassInfo() |
555 | - this.updateMylove() | |
556 | - const price = this.skuList.filter(item=>item.sk_id == this.skId)[0].real_price | |
557 | - this.$emit("chooseCartModi",this.mp_id,this.skId,price,this.pid,this.count,this.cart_id,this.index)//添加购物车 | |
558 | - this.$emit("closeBottom") | |
558 | + if(this.glassInfoRight){ | |
559 | + this.updateMylove() | |
560 | + const price = this.skuList.filter(item=>item.sk_id == this.skId)[0].real_price | |
561 | + this.$emit("chooseCartModi",this.mp_id,this.skId,price,this.pid,this.count,this.cart_id,this.index)//添加购物车 | |
562 | + this.$emit("closeBottom") | |
563 | + } | |
559 | 564 | }, |
560 | 565 | addCart(){ |
561 | 566 | this.checkGlassInfo() |
562 | - this.updateMylove() | |
563 | - const that = this | |
564 | - const checkedSKUName = [that.goodInfo.attrList[0].meta_name,that.goodInfo.attrList[1].meta_name] | |
565 | - const checkedSKU = [] | |
566 | - let j; | |
567 | - for (let i = 0;i<that.current.length;i++) { | |
568 | - checkedSKU.push(that.goodInfo.attrList[i].attr[that.current[i]]) | |
569 | - // console.log('i', i, j, i !== this.current.length - 1) | |
570 | - if (i !== this.current.length - 1) { | |
571 | - // 后续需修改算法:目前暂定只有两个参数选择,后续若有多个参数需要修改实现自适应 | |
572 | - j = this.current[i] * this.attrList[1].attr.length | |
573 | - } else { | |
574 | - j += this.current[i] | |
575 | - } | |
567 | + if(this.glassInfoRight){ | |
568 | + this.updateMylove() | |
569 | + const that = this | |
570 | + const checkedSKUName = [that.goodInfo.attrList[0].meta_name,that.goodInfo.attrList[1].meta_name] | |
571 | + const checkedSKU = [] | |
572 | + let j; | |
573 | + for (let i = 0;i<that.current.length;i++) { | |
574 | + checkedSKU.push(that.goodInfo.attrList[i].attr[that.current[i]]) | |
575 | + // console.log('i', i, j, i !== this.current.length - 1) | |
576 | + if (i !== this.current.length - 1) { | |
577 | + // 后续需修改算法:目前暂定只有两个参数选择,后续若有多个参数需要修改实现自适应 | |
578 | + j = this.current[i] * this.attrList[1].attr.length | |
579 | + } else { | |
580 | + j += this.current[i] | |
581 | + } | |
582 | + } | |
583 | + const price = this.skuList.filter(item=>item.sk_id == this.skuList[j].sk_id)[0].real_price | |
584 | + let sk_id = this.skuList[j].sk_id | |
585 | + // console.log('选择的商品sk_id',sk_id,'选择的商品参数',checkedSKU) | |
586 | + // console.log('mp_id',this.mp_id,'数量',this.count) | |
587 | + this.$emit("addCart",this.mp_id,this.count,checkedSKU,sk_id,price)//添加购物车 | |
588 | + this.$emit("closeBottom")//关闭弹窗 | |
576 | 589 | } |
577 | - const price = this.skuList.filter(item=>item.sk_id == this.skuList[j].sk_id)[0].real_price | |
578 | - let sk_id = this.skuList[j].sk_id | |
579 | - // console.log('选择的商品sk_id',sk_id,'选择的商品参数',checkedSKU) | |
580 | - // console.log('mp_id',this.mp_id,'数量',this.count) | |
581 | - this.$emit("addCart",this.mp_id,this.count,checkedSKU,sk_id,price)//添加购物车 | |
582 | - this.$emit("closeBottom")//关闭弹窗 | |
583 | 590 | }, |
584 | 591 | onClickLoveItem(index,name){ |
585 | 592 | const loveList = this.loveList |
... | ... | @@ -689,9 +696,9 @@ import store from '@/store' |
689 | 696 | this.pd = '' |
690 | 697 | } |
691 | 698 | }, |
692 | - changeConfirm() { | |
693 | - this.confirm = !this.confirm | |
694 | - }, | |
699 | + // changeConfirm() { | |
700 | + // this.confirm = !this.confirm | |
701 | + // }, | |
695 | 702 | bindPickerChange01: function(e) { |
696 | 703 | this.pickerInfoList[0].nameIndex1 = e.target.value |
697 | 704 | this.pickerInfoChioce.leftSph = this.pickerInfoList[0].nameArray1[e.target.value] |
... | ... | @@ -763,9 +770,6 @@ import store from '@/store' |
763 | 770 | } else { |
764 | 771 | if (this.kinds === 1) { |
765 | 772 | // 添加用户验光单 |
766 | - console.log('kinds====>', this.pickerInfoChioce.leftSph) | |
767 | - console.log('kinds====>', this.pickerInfoChioce.leftSph === Number) | |
768 | - console.log('kinds====>', this.pickerInfoChioce.rightSph === Number) | |
769 | 773 | if (this.pickerInfoChioce.rightSph === '' || this.pickerInfoChioce.leftSph === '' || |
770 | 774 | this.pickerInfoChioce.leftCyl === '' || this.pickerInfoChioce.rightCyl === '' || |
771 | 775 | this.pickerInfoChioce.leftAxi === '' || this.pickerInfoChioce.rightAxi === '' |
... | ... | @@ -776,7 +780,7 @@ import store from '@/store' |
776 | 780 | duration: 2000, |
777 | 781 | }) |
778 | 782 | } else { |
779 | - if (this.confirm) { | |
783 | + // if (this.confirm) { | |
780 | 784 | store.dispatch('myLoveList/addMylove', { |
781 | 785 | uid: this.$store.state.user.userInfo.uid, |
782 | 786 | openid: this.$store.state.user.userInfo.openid, |
... | ... | @@ -795,17 +799,10 @@ import store from '@/store' |
795 | 799 | this.mp_id = mpId |
796 | 800 | }) |
797 | 801 | flag = 1 |
798 | - } else { | |
799 | - uni.showToast({ | |
800 | - title: '请确认您的验光数据', | |
801 | - icon: 'none', | |
802 | - duration: 3000, | |
803 | - }) | |
804 | - } | |
805 | 802 | } |
806 | 803 | } |
807 | 804 | if (this.kinds === 2) { |
808 | - if (this.confirm) { | |
805 | + // if (this.confirm) { | |
809 | 806 | const leftList = ['leftSph', 'leftCyl', 'leftAxi'] |
810 | 807 | const rightList = ['rightSph', 'rightCyl', 'rightAxi'] |
811 | 808 | // let flag=0; |
... | ... | @@ -865,18 +862,14 @@ import store from '@/store' |
865 | 862 | duration: 2000, |
866 | 863 | }) |
867 | 864 | } |
868 | - if (flag !== 0) { | |
869 | - store.dispatch('myLoveList/getLoveList', { | |
870 | - uid: this.$store.state.user.userInfo.uid, | |
871 | - }) | |
872 | - } | |
873 | - } else { | |
874 | - uni.showToast({ | |
875 | - title: '请确认您的验光数据', | |
876 | - icon: 'none', | |
877 | - duration: 3000, | |
878 | - }) | |
879 | - } | |
865 | + | |
866 | + // } else { | |
867 | + // uni.showToast({ | |
868 | + // title: '请确认您的验光数据', | |
869 | + // icon: 'none', | |
870 | + // duration: 3000, | |
871 | + // }) | |
872 | + // } | |
880 | 873 | } |
881 | 874 | } |
882 | 875 | } | ... | ... |
src/pages/addOpticsData/addOpticsData.vue
... | ... | @@ -42,13 +42,13 @@ |
42 | 42 | <text>瞳距(PD):</text><text>{{loveItem.pd}}</text> |
43 | 43 | </view> |
44 | 44 | <view class="dataInfoItem"> |
45 | - <text>镜片宽度:</text><text>{{loveItem.glassWidth!=='0'?loveItem.glassWidth:'暂无数据'}}</text> | |
45 | + <text>镜片宽度:</text><text>{{loveItem.glassWidth!=''?loveItem.glassWidth:'暂无数据'}}</text> | |
46 | 46 | </view> |
47 | 47 | <view class="dataInfoItem"> |
48 | - <text>鼻梁宽度:</text><text>{{loveItem.norseWidth!=='0'?loveItem.norseWidth:'暂无数据'}}</text> | |
48 | + <text>鼻梁宽度:</text><text>{{loveItem.norseWidth!=''?loveItem.norseWidth:'暂无数据'}}</text> | |
49 | 49 | </view> |
50 | 50 | <view class="dataInfoItem"> |
51 | - <text>镜腿长度:</text><text>{{loveItem.legWidth!=='0'?loveItem.legWidth:'暂无数据'}}</text> | |
51 | + <text>镜腿长度:</text><text>{{loveItem.legWidth!=''?loveItem.legWidth:'暂无数据'}}</text> | |
52 | 52 | </view> |
53 | 53 | </view> |
54 | 54 | </uni-collapse-item> |
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | }, |
88 | 88 | computed:{ |
89 | 89 | loveList() { |
90 | - console.log(this.$store.state.myLoveList.loveList) | |
90 | + // console.log(this.$store.state.myLoveList.loveList) | |
91 | 91 | return this.$store.state.myLoveList.loveList || [] |
92 | 92 | }, |
93 | 93 | }, |
... | ... | @@ -96,7 +96,7 @@ |
96 | 96 | this.whichTap = item |
97 | 97 | this.$refs.popup.open() |
98 | 98 | }, |
99 | - //给时间搞一个nice的格式 | |
99 | + //给时间搞一个的格式 | |
100 | 100 | getRightTime(time){ |
101 | 101 | //如果小于10 则返回'0'+m |
102 | 102 | // function add(m){return m<10?'0'+m:m} | ... | ... |
src/pages/cart/cart.vue
src/pages/confirmOrder/confirmOrder.vue
... | ... | @@ -280,9 +280,9 @@ export default { |
280 | 280 | onLoad({ pid, addressId, isCart, count, name }) { |
281 | 281 | if (isCart == 'false') { |
282 | 282 | this.pid = pid |
283 | - store.dispatch('read/fetch', { | |
284 | - pid, | |
285 | - }) | |
283 | + // store.dispatch('read/fetch', { | |
284 | + // pid, | |
285 | + // }) | |
286 | 286 | } |
287 | 287 | this.count = count |
288 | 288 | this.name = name |
... | ... | @@ -334,7 +334,7 @@ export default { |
334 | 334 | // return this.$store.state.cart.checkedCartLst |
335 | 335 | // }, |
336 | 336 | goodInfo() { |
337 | - console.log('state', this.$store.state.read.goodInfo) | |
337 | + // console.log('state', this.$store.state.read.goodInfo) | |
338 | 338 | return this.$store.state.read.goodInfo |
339 | 339 | }, |
340 | 340 | skuInfo() { |
... | ... | @@ -586,6 +586,9 @@ export default { |
586 | 586 | .price { |
587 | 587 | color: #ff6b4a; |
588 | 588 | font-size: 28rpx; |
589 | + text{ | |
590 | + margin-left: 10rpx; | |
591 | + } | |
589 | 592 | } |
590 | 593 | .originCost { |
591 | 594 | text-decoration: line-through; | ... | ... |
src/pages/details/details.vue
... | ... | @@ -424,7 +424,7 @@ export default { |
424 | 424 | addCartList.mp_id = mpId |
425 | 425 | addCartList.sk_id = skId |
426 | 426 | addCartList.num = num |
427 | - addCartList.checkedSKU = checkedSKU | |
427 | + // addCartList.checkedSKU = checkedSKU | |
428 | 428 | addCartList.pid = this.pid |
429 | 429 | addCartList.price = price |
430 | 430 | console.log('添加购物车的参数', addCartList) |
... | ... | @@ -711,5 +711,7 @@ export default { |
711 | 711 | border-radius: 0 20px 20px 0; |
712 | 712 | } |
713 | 713 | } |
714 | + /* #endif */ | |
715 | + | |
714 | 716 | } |
715 | 717 | </style> | ... | ... |
src/pages/myOrder/components/OrderCard.vue
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <view |
4 | 4 | class="card" |
5 | 5 | v-if="current == status" |
6 | - @click="toOrderInfo(status,order.pay_id)" | |
6 | + | |
7 | 7 | > |
8 | 8 | <view class="cardHeader"> |
9 | 9 | <text |
... | ... | @@ -30,6 +30,7 @@ |
30 | 30 | </view> |
31 | 31 | <view |
32 | 32 | class="orderCardInfo" |
33 | + @click="toOrderInfo(status,order.pay_id)" | |
33 | 34 | v-for="(orderInfo, index) in orderInfoList" |
34 | 35 | :key="index" |
35 | 36 | > |
... | ... | @@ -52,8 +53,8 @@ |
52 | 53 | class="btns" |
53 | 54 | v-if="status == '0'" |
54 | 55 | > |
55 | - <view class="btn-type1">取消订单</view> | |
56 | - <view class="btn-type2">去支付</view> | |
56 | + <view class="btn-type1" @click="cancleOrder">取消订单</view> | |
57 | + <view class="btn-type2" @click="paylog">去支付</view> | |
57 | 58 | </view> |
58 | 59 | <view |
59 | 60 | class="btns" |
... | ... | @@ -65,13 +66,13 @@ |
65 | 66 | class="btns" |
66 | 67 | v-if="status == '2'" |
67 | 68 | > |
68 | - <view class="btn-type2" @click="toDetail">再次购买</view> | |
69 | + <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view> | |
69 | 70 | </view> |
70 | 71 | <!-- <view class="btns" v-if="status == '3'"> |
71 | 72 | <view class="btn-type2">再次购买</view> |
72 | 73 | </view> --> |
73 | 74 | </view> |
74 | - <view class="card" v-if="current == '10'" @click="toOrderInfo(status,order.pay_id)"> | |
75 | + <view class="card" v-if="current == '10'" > | |
75 | 76 | <view class="cardHeader"> |
76 | 77 | <text class="orderId" v-if="status == '0'||status == '1'">订单号:{{order.pay_id}}</text> |
77 | 78 | <text class="orderId" v-if="status == '2'||status == '3'">下单时间:{{order.pay_time}}</text> |
... | ... | @@ -80,7 +81,7 @@ |
80 | 81 | <text class="orderType" v-if="status == '2'||status == '3'">已完成</text> |
81 | 82 | <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> |
82 | 83 | </view> |
83 | - <view class="orderCardInfo" v-for="(orderInfo) in orderInfoList" :key="orderInfo"> | |
84 | + <view class="orderCardInfo" @click="toOrderInfo(status,order.pay_id)" v-for="(orderInfo) in orderInfoList" :key="orderInfo"> | |
84 | 85 | <image :src="orderInfo.imgUrl" mode="aspectFill"></image> |
85 | 86 | <view class="infoText"> |
86 | 87 | <view class="orderName">{{orderInfo.p_name}}</view> |
... | ... | @@ -93,8 +94,8 @@ |
93 | 94 | </view> |
94 | 95 | <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> |
95 | 96 | <view class="btns" v-if="status == '0'"> |
96 | - <view class="btn-type1" >取消订单</view> | |
97 | - <view class="btn-type2">去支付</view> | |
97 | + <view class="btn-type1" @click="cancleOrder">取消订单</view> | |
98 | + <view class="btn-type2" @click="paylog">去支付</view> | |
98 | 99 | </view> |
99 | 100 | <view class="btns" v-if="status == '1'"> |
100 | 101 | <view class="btn-type2">确认收货</view> |
... | ... | @@ -102,16 +103,19 @@ |
102 | 103 | <view class="btns" v-if="status == '2'||status == '3'"> |
103 | 104 | <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view> |
104 | 105 | </view> |
105 | - <!-- <view class="btns" v-if="status == '3'"> | |
106 | - | |
107 | - <view class="btn-type2">再次购买</view> | |
108 | - </view> --> | |
109 | 106 | </view> |
110 | 107 | </view> |
111 | 108 | </template> |
112 | 109 | |
113 | 110 | <script> |
111 | + import MD5Util from '../../../utils/md5' | |
112 | + import store from "@/store"; | |
114 | 113 | export default { |
114 | + data() { | |
115 | + return { | |
116 | + | |
117 | + }; | |
118 | + }, | |
115 | 119 | props: { |
116 | 120 | /** |
117 | 121 | * 订单数据 |
... | ... | @@ -136,11 +140,143 @@ |
136 | 140 | return this.order.order_info |
137 | 141 | } |
138 | 142 | }, |
139 | - data() { | |
140 | - return { | |
141 | - }; | |
142 | - }, | |
143 | 143 | methods:{ |
144 | + async paylog() { | |
145 | + const openid = uni.getStorageSync('openid') | |
146 | + const uid = this.order.uid; | |
147 | + //先拿订单详情 | |
148 | + await store.dispatch('orderRead/getOrderInfo', { | |
149 | + pay_id: this.order.pay_id, | |
150 | + uid: uid, | |
151 | + openid: openid | |
152 | + }).then((res)=>{ | |
153 | + // console.log(res) | |
154 | + const { data, exKeyName: keyName } = res.order_info | |
155 | + const timeStamp = new Date().getTime().toString() | |
156 | + const total_fee = res.total_fee | |
157 | + const payId = res.pay_id | |
158 | + const nonceStr = 'asfafasfasfasfasf' | |
159 | + // 支付参数 | |
160 | + const fieldSet = { | |
161 | + openid: openid, | |
162 | + uid: uid, | |
163 | + shopid: 0, | |
164 | + payCate: 2020, | |
165 | + payMoney: total_fee, | |
166 | + payWoodId: `fcdj-${uid}-${keyName}`, | |
167 | + payWoodDesc: '在【非常戴镜】的微信付款凭证', | |
168 | + nonceStr, | |
169 | + signType: 'MD5', | |
170 | + app_uid: 2020, | |
171 | + timeStamp, | |
172 | + keyname: keyName, | |
173 | + billInfo: JSON.stringify(data), | |
174 | + } | |
175 | + // 请求后台支付接口 | |
176 | + store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => { | |
177 | + if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') { | |
178 | + const stringA = `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}` | |
179 | + const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789' | |
180 | + | |
181 | + // 微信支付接口 | |
182 | + uni.requestPayment({ | |
183 | + appId: data.appid, | |
184 | + timeStamp, | |
185 | + nonceStr, | |
186 | + total_fee: total_fee, | |
187 | + package: `prepay_id=${data.prepay_id}`, | |
188 | + signType: 'MD5', | |
189 | + paySign: MD5Util.MD5(stringSignTemp).toUpperCase(), | |
190 | + success: (res) => { | |
191 | + // 支付成功 | |
192 | + uni.showModal({ | |
193 | + content: '支付成功', | |
194 | + showCancel: false, | |
195 | + }) | |
196 | + // //修改订单状态 待付款==>待收货 | |
197 | + // store.dispatch("statusConfirm/confirm", { | |
198 | + // uid: this.uid, | |
199 | + // openid: this.openid, | |
200 | + // oldway: "0", | |
201 | + // way: "1", | |
202 | + // pay_id: payId, | |
203 | + // judgeContent: "", | |
204 | + // orderInfo: this.orderInfo.order_info | |
205 | + // }) | |
206 | + }, | |
207 | + fail: (res) => { | |
208 | + // 支付失败 | |
209 | + uni.showModal({ | |
210 | + content: '支付失败', | |
211 | + showCancel: false, | |
212 | + }) | |
213 | + }, | |
214 | + complete: () => { | |
215 | + uni.hideLoading() | |
216 | + }, | |
217 | + }) | |
218 | + } else { | |
219 | + uni.showModal({ | |
220 | + content: '支付失败', | |
221 | + showCancel: false, | |
222 | + }) | |
223 | + console.log('支付失败') | |
224 | + uni.hideLoading() | |
225 | + } | |
226 | + }) | |
227 | + //修改订单状态 待付款==>待收货 | |
228 | + // store.dispatch("statusConfirm/confirm", { | |
229 | + // uid: this.uid, | |
230 | + // openid: this.openid, | |
231 | + // oldway: "0", | |
232 | + // way: "1", | |
233 | + // pay_id: this.payId, | |
234 | + // judgeContent: "", | |
235 | + // orderInfo: this.orderInfo.order_info | |
236 | + // }) | |
237 | + }) | |
238 | + }, | |
239 | + | |
240 | + async cancleOrder(e) { | |
241 | + const openid = uni.getStorageSync('openid') | |
242 | + const uid = this.order.uid; | |
243 | + //先从订单详情中拿到keyname | |
244 | + await store.dispatch('orderRead/getOrderInfo', { | |
245 | + pay_id: this.order.pay_id, | |
246 | + uid: uid, | |
247 | + openid: openid | |
248 | + }).then((res)=>{ | |
249 | + const keyname = res.order_info.keyname | |
250 | + uni.showModal({ | |
251 | + title: "提示", | |
252 | + content: "现在取消,订单不可恢复哦,确认取消吗?", | |
253 | + success: function(res) { | |
254 | + if (res.confirm) { | |
255 | + store.dispatch("cancelOrder/cancel", { | |
256 | + keyname: keyname, | |
257 | + uid: uid, | |
258 | + openid: openid | |
259 | + }).then((res)=>{ | |
260 | + console.log(res) | |
261 | + if(res.code == 1){ | |
262 | + store.dispatch("myOrder/getList", { | |
263 | + way: "" | |
264 | + }); | |
265 | + }else{ | |
266 | + uni.showToast({ | |
267 | + title:'取消失败,服务器错误!', | |
268 | + icon:'none' | |
269 | + }) | |
270 | + } | |
271 | + }); | |
272 | + } else if (res.cancel) { | |
273 | + console.log("用户点击取消"); | |
274 | + } | |
275 | + } | |
276 | + }); | |
277 | + }); | |
278 | + | |
279 | + }, | |
144 | 280 | toDetail(pid){ |
145 | 281 | console.log('pid',pid) |
146 | 282 | uni.navigateTo({ |
... | ... | @@ -177,7 +313,7 @@ |
177 | 313 | }) |
178 | 314 | |
179 | 315 | break; |
180 | - case '2 || 3': | |
316 | + case '2' || '3': | |
181 | 317 | uni.navigateTo({ |
182 | 318 | url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, |
183 | 319 | fail(errMsg) { |
... | ... | @@ -198,7 +334,7 @@ |
198 | 334 | <style lang="scss"> |
199 | 335 | .card { |
200 | 336 | width: 670rpx; |
201 | - height: 478rpx; | |
337 | + // height: 478rpx; | |
202 | 338 | background: #ffffff; |
203 | 339 | box-shadow: 0 0 10px 0 rgba(177, 128, 128, 0.06); |
204 | 340 | border-radius: 8px; | ... | ... |
src/pages/myOrder/myOrder.vue
src/pages/myOrderPaying/myOrderPaying.vue
1 | 1 | <!-- 订单待付款 待收货 --> |
2 | 2 | <template> |
3 | - <view class="content"> | |
4 | - <!-- 待付款 --> | |
5 | - <view | |
6 | - class="order-time" | |
7 | - v-if="status == '0'" | |
8 | - > | |
9 | - <text>请在</text> | |
10 | - <uni-countdown | |
11 | - color="#EC5D3B" | |
12 | - splitor-color="#EC5D3B" | |
13 | - :show-day="false" | |
14 | - :hour="0" | |
15 | - :second="getTime" | |
16 | - @timeup=timeup | |
17 | - ></uni-countdown> | |
18 | - <text>内完成付款</text> | |
19 | - </view> | |
20 | - <!-- 待收货 --> | |
21 | - <view | |
22 | - class="headerBanner" | |
23 | - v-if="status == '1'" | |
24 | - > | |
3 | + <view class="content"> | |
4 | + <view | |
5 | + class="headerBanner" | |
6 | + v-if="status == '2'||'3'" | |
7 | + > | |
8 | + <view class="bannerLeft"> | |
9 | + <view class="T1">订单已完成</view> | |
10 | + </view> | |
11 | + <image | |
12 | + src="../../static/car.png" | |
13 | + mode="aspectFill" | |
14 | + ></image> | |
15 | + </view> | |
16 | + <!-- 待付款 --> | |
17 | + <view class="order-time" v-if="status == '0'" > | |
18 | + <text>请在</text> | |
19 | + <uni-countdown | |
20 | + color="#EC5D3B" | |
21 | + splitor-color="#EC5D3B" | |
22 | + :show-day="false" | |
23 | + :hour="0" | |
24 | + :second="getLeftTime" | |
25 | + @timeup="timeup" > | |
26 | + </uni-countdown> | |
27 | + | |
28 | + <text>内完成付款</text> | |
29 | + </view> | |
30 | + | |
31 | + <view class="headerBanner" v-if="status == '1'"> | |
25 | 32 | <view class="bannerLeft"> |
26 | 33 | <view class="T1">卖家已发货</view> |
27 | - <view class="T2">还剩 确认收货</view> | |
34 | + <!-- <view class="T2">还剩 确认收货</view> --> | |
28 | 35 | </view> |
29 | 36 | <image |
30 | 37 | src="../../static/car.png" |
31 | 38 | mode="aspectFill" |
32 | 39 | ></image> |
33 | - </view> | |
40 | + </view> | |
41 | + | |
42 | + | |
34 | 43 | <view class="order"> |
35 | 44 | <view class="order-user"> |
36 | 45 | <view class="order-user-head"> |
... | ... | @@ -87,8 +96,7 @@ |
87 | 96 | <text>订单号:{{payId}}</text> |
88 | 97 | </text> |
89 | 98 | <text class="order-info-time"> |
90 | - <text>下单时间:{{orderInfo.order_info.pay_time | timerChange}}</text> | |
91 | - | |
99 | + <text>下单时间:{{orderInfo.order_info?orderInfo.order_info.pay_time:'' | timerChange}}</text> | |
92 | 100 | </text> |
93 | 101 | <view class="order-info-hr"></view> |
94 | 102 | <view class="order-info-contact"> |
... | ... | @@ -120,7 +128,17 @@ |
120 | 128 | class="b2" |
121 | 129 | @click="confirmOrder" |
122 | 130 | >确认收货</button> |
123 | - </view> | |
131 | + </view> | |
132 | + <view | |
133 | + class="order-confim" | |
134 | + v-if="status == '2'" | |
135 | + > | |
136 | + <button | |
137 | + class="b2" | |
138 | + @click="toDetail" | |
139 | + >再次购买</button> | |
140 | + </view> | |
141 | + | |
124 | 142 | </view> |
125 | 143 | </template> |
126 | 144 | |
... | ... | @@ -141,15 +159,15 @@ export default { |
141 | 159 | openid: "", |
142 | 160 | lefttime: 0, |
143 | 161 | isPay: 0, |
144 | - orderInfo:Object, | |
162 | + orderInfo:{}, | |
145 | 163 | totalPrice:0, |
146 | 164 | }; |
147 | 165 | }, |
148 | 166 | onLoad:async function ({payId,status,isPay}) { |
149 | - // console.log('++++++++++++++++++',payId,status,isPay) | |
150 | 167 | this.payId = payId |
151 | 168 | this.status = status |
152 | 169 | this.isPay = isPay |
170 | + // console.log('++++++++++++++++++',this.status) | |
153 | 171 | const openid = uni.getStorageSync('openid') |
154 | 172 | const uid = this.$store.state.user.userInfo.uid |
155 | 173 | this.uid = uid |
... | ... | @@ -173,17 +191,16 @@ export default { |
173 | 191 | } |
174 | 192 | }, |
175 | 193 | computed: { |
176 | - orderInfoList () { | |
177 | - return this.orderInfo.order_info.list | |
194 | + orderInfoList () { | |
195 | + return this.orderInfo.order_info?this.orderInfo.order_info.list:null | |
178 | 196 | }, |
179 | 197 | // 获取订单地址信息 |
180 | - orderAddressInfo () { | |
181 | - return this.orderInfo.order_info.address | |
198 | + orderAddressInfo () { | |
199 | + return this.orderInfo.order_info?this.orderInfo.order_info.address:null | |
182 | 200 | }, |
183 | 201 | // 订单付款时间 |
184 | - getTime () { | |
185 | - return this.orderInfo.order_info.lefttime | |
186 | - | |
202 | + getLeftTime () { | |
203 | + return this.orderInfo.order_info?this.orderInfo.order_info.lefttime:1800 | |
187 | 204 | }, |
188 | 205 | // 计算总优惠额 |
189 | 206 | totalDiscount() { |
... | ... | @@ -197,8 +214,17 @@ export default { |
197 | 214 | // console.log(totalDiscount) |
198 | 215 | return totalDiscount; |
199 | 216 | } |
200 | - }, | |
201 | - methods: { | |
217 | + }, | |
218 | + | |
219 | + methods: { | |
220 | + //再次购买 暂时只支持跳转第一个商品 | |
221 | + toDetail(){ | |
222 | + const pid = this.orderInfo.order_info.list[0].pid | |
223 | + uni.navigateTo({ | |
224 | + url: '../details/details?pid='+pid, | |
225 | + fail: (res) => {console.log(res)}, | |
226 | + }); | |
227 | + }, | |
202 | 228 | // 取消订单 |
203 | 229 | timeup() { |
204 | 230 | this.cancleOrder(); |
... | ... | @@ -272,7 +298,7 @@ export default { |
272 | 298 | }) |
273 | 299 | // 跳转订单详情页->状态 待收货 |
274 | 300 | uni.reLaunch({ |
275 | - url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=2&isPay=1`, | |
301 | + url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=1&isPay=1`, | |
276 | 302 | }) |
277 | 303 | }, |
278 | 304 | fail: (res) => { |
... | ... | @@ -282,9 +308,9 @@ export default { |
282 | 308 | showCancel: false, |
283 | 309 | }) |
284 | 310 | // 跳转订单详情页->刷新本页面 |
285 | - uni.redirectTo({ | |
286 | - url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=1&isPay=1`, | |
287 | - }) | |
311 | + // uni.redirectTo({ | |
312 | + // url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=0&isPay=1`, | |
313 | + // }) | |
288 | 314 | }, |
289 | 315 | complete: () => { |
290 | 316 | uni.hideLoading() |
... | ... | @@ -297,9 +323,9 @@ export default { |
297 | 323 | }) |
298 | 324 | console.log('支付失败') |
299 | 325 | uni.hideLoading() |
300 | - uni.redirectTo({ | |
301 | - url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=1&isPay=1`, | |
302 | - }) | |
326 | + // uni.redirectTo({ | |
327 | + // url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=0&isPay=1`, | |
328 | + // }) | |
303 | 329 | } |
304 | 330 | }) |
305 | 331 | ... | ... |
src/pages/newOpticsData/newOpticsData.vue
... | ... | @@ -133,15 +133,15 @@ |
133 | 133 | <view class="ipts"> |
134 | 134 | <view class="inputItem"> |
135 | 135 | <text class="text">镜片宽度</text> |
136 | - <input class="input" @input="glassInfoInput($event,0)" type="text" :value="glassInfo.glassWidth" placeholder="请输入镜片宽度"/> | |
136 | + <input class="input" @input="glassInfoInput($event,0)" type="text" :value="glassInfo.glassWidth!='0'?glassInfo.glassWidth:''" placeholder="请输入镜片宽度"/> | |
137 | 137 | </view> |
138 | 138 | <view class="inputItem"> |
139 | 139 | <text class="text">鼻梁宽度</text> |
140 | - <input class="input" @input="glassInfoInput($event,1)" type="text" :value="glassInfo.norseWidth" placeholder="请输入鼻梁宽度"/> | |
140 | + <input class="input" @input="glassInfoInput($event,1)" type="text" :value="glassInfo.norseWidth!='0'?glassInfo.norseWidth:''" placeholder="请输入鼻梁宽度"/> | |
141 | 141 | </view> |
142 | 142 | <view class="inputItem"> |
143 | 143 | <text class="text">镜腿长度</text> |
144 | - <input class="input" @input="glassInfoInput($event,2)" type="text" :value="glassInfo.legWidth" placeholder="请输入镜腿长度"/> | |
144 | + <input class="input" @input="glassInfoInput($event,2)" type="text" :value="glassInfo.legWidth!='0'?glassInfo.legWidth:''" placeholder="请输入镜腿长度"/> | |
145 | 145 | </view> |
146 | 146 | |
147 | 147 | </view> |
... | ... | @@ -198,7 +198,8 @@ |
198 | 198 | pd: '',// 瞳距 |
199 | 199 | oldpd: '',// 用于判断用户是否改变瞳距 |
200 | 200 | kinds:Number, // kinds=1,提交为新增验光,2为修改 |
201 | - mp_id: Number | |
201 | + mp_id: Number, | |
202 | + loveItem:Object | |
202 | 203 | }; |
203 | 204 | }, |
204 | 205 | onLoad: function (option) { |
... | ... | @@ -240,10 +241,10 @@ |
240 | 241 | } else{ |
241 | 242 | console.log('args===>',option.index) |
242 | 243 | const loveList=Object.assign({},this.$store.state.myLoveList.loveList) |
243 | - console.log('args===>',loveList[option.index].in_time) | |
244 | - console.log('args===>',loveList[option.index].in_time.toString().slice(0,4)) | |
245 | - console.log('args===>',loveList[option.index].in_time.toString().slice(5,6)==0) | |
246 | - console.log('args===>',loveList[option.index].in_time.toString().slice(8,10)) | |
244 | + // console.log('args===>',loveList[option.index].in_time) | |
245 | + // console.log('args===>',loveList[option.index].in_time.toString().slice(0,4)) | |
246 | + // console.log('args===>',loveList[option.index].in_time.toString().slice(5,6)==0) | |
247 | + // console.log('args===>',loveList[option.index].in_time.toString().slice(8,10)) | |
247 | 248 | this.name=loveList[option.index].name |
248 | 249 | this.pd=loveList[option.index].pd |
249 | 250 | this.mp_id=loveList[option.index].mp_id |
... | ... | @@ -268,6 +269,17 @@ |
268 | 269 | } else{ |
269 | 270 | this.pickerInfoList[3].nameArray3.unshift(loveList[option.index].in_time.toString().slice(8,10)) |
270 | 271 | } |
272 | + this.glassInfo.glassWidth = loveList[option.index].glassWidth | |
273 | + this.glassInfo.norseWidth = loveList[option.index].norseWidth | |
274 | + this.glassInfo.legWidth = loveList[option.index].legWidth | |
275 | + this.loveItem = loveList[option.index] | |
276 | + } | |
277 | + }, | |
278 | + computed:{ | |
279 | + //判断当前眼镜信息是否有0 | |
280 | + glassInfoRight(){ | |
281 | + const glassInfoArr = Object.values(this.glassInfo) | |
282 | + return glassInfoArr.find(item => item == '0') ==undefined | |
271 | 283 | } |
272 | 284 | }, |
273 | 285 | methods:{ |
... | ... | @@ -303,6 +315,41 @@ |
303 | 315 | } |
304 | 316 | |
305 | 317 | }, |
318 | + updateMylove(){ | |
319 | + const loveItem = this.loveItem | |
320 | + const glassWidth = this.glassInfo.glassWidth | |
321 | + const norseWidth = this.glassInfo.norseWidth | |
322 | + const legWidth = this.glassInfo.legWidth | |
323 | + // console.log(loveItem.glassWidth) | |
324 | + // console.log(glassWidth) | |
325 | + if(loveItem.glassWidth !== glassWidth){ | |
326 | + store.dispatch('myLoveList/updateMylove', { | |
327 | + uid: this.$store.state.user.userInfo.uid, | |
328 | + openid: this.$store.state.user.userInfo.openid, | |
329 | + mp_id: this.mp_id, | |
330 | + keyname: 'glassWidth', | |
331 | + keyvalue: glassWidth | |
332 | + }); | |
333 | + } | |
334 | + if(loveItem.norseWidth !== norseWidth){ | |
335 | + store.dispatch('myLoveList/updateMylove', { | |
336 | + uid: this.$store.state.user.userInfo.uid, | |
337 | + openid: this.$store.state.user.userInfo.openid, | |
338 | + mp_id: this.mp_id, | |
339 | + keyname: 'norseWidth', | |
340 | + keyvalue: norseWidth | |
341 | + }); | |
342 | + } | |
343 | + if(loveItem.legWidth !== legWidth){ | |
344 | + store.dispatch('myLoveList/updateMylove', { | |
345 | + uid: this.$store.state.user.userInfo.uid, | |
346 | + openid: this.$store.state.user.userInfo.openid, | |
347 | + mp_id: this.mp_id, | |
348 | + keyname: 'legWidth', | |
349 | + keyvalue: legWidth | |
350 | + }); | |
351 | + } | |
352 | + }, | |
306 | 353 | // 用户提交 |
307 | 354 | handleSubmit(){ |
308 | 355 | if(this.name==''){ |
... | ... | @@ -323,15 +370,12 @@ |
323 | 370 | |
324 | 371 | if(this.kinds==1){ |
325 | 372 | // 添加用户验光单 |
326 | - console.log('kinds====>',this.pickerInfoChioce.leftSph) | |
327 | - console.log('kinds====>',this.pickerInfoChioce.leftSph==Number) | |
328 | - console.log('kinds====>',this.pickerInfoChioce.rightSph==Number) | |
329 | 373 | if(this.pickerInfoChioce.rightSph==''||this.pickerInfoChioce.leftSph==''|| |
330 | 374 | this.pickerInfoChioce.leftCyl==''||this.pickerInfoChioce.rightCyl==''|| |
331 | - this.pickerInfoChioce.leftAxi==''||this.pickerInfoChioce.rightAxi=='' | |
375 | + this.pickerInfoChioce.leftAxi==''||this.pickerInfoChioce.rightAxi=='' ||!this.glassInfoRight | |
332 | 376 | ){ |
333 | 377 | uni.showToast({ |
334 | - title:"请输入您的验光数据", | |
378 | + title:"请完善您的数据~", | |
335 | 379 | icon: "none", |
336 | 380 | duration: 2000, |
337 | 381 | }) |
... | ... | @@ -355,14 +399,10 @@ |
355 | 399 | // time: this.pickerInfoChioce.time, |
356 | 400 | // img_url2: "http://localhost:8087/images/shop_1/1/", |
357 | 401 | }); |
358 | - // store.dispatch('myLoveList/getLoveList', { | |
359 | - // uid: this.$store.state.user.userInfo.uid, | |
360 | - // }); | |
361 | 402 | uni.navigateBack({ |
362 | 403 | delta:1, |
363 | 404 | animationDuration:2000 |
364 | 405 | }) |
365 | - | |
366 | 406 | } else{ |
367 | 407 | uni.showToast({ |
368 | 408 | title:"请确认您的验光数据", |
... | ... | @@ -370,20 +410,13 @@ |
370 | 410 | duration: 3000, |
371 | 411 | }) |
372 | 412 | } |
373 | - | |
374 | 413 | } |
375 | - | |
376 | 414 | } |
377 | 415 | if(this.kinds==2){ |
378 | - // console.log('kinds====>',this.kinds) | |
379 | - // console.log('pickerindex=====>',this.pickerInfoList[0].nameIndex1) | |
380 | - // console.log('this.pickerInfoChioce====>',type(this.pickerInfoChioce)) | |
381 | 416 | if(this.confirm){ |
382 | 417 | const leftList = ["leftSph","leftCyl","leftAxi"]; |
383 | 418 | const rightList = ["rightSph", "rightCyl", "rightAxi"]; |
384 | 419 | let flag=0; |
385 | - | |
386 | - | |
387 | 420 | if(this.name!=this.oldname){ |
388 | 421 | store.dispatch('myLoveList/updateMylove', { |
389 | 422 | uid: this.$store.state.user.userInfo.uid, |
... | ... | @@ -440,16 +473,14 @@ |
440 | 473 | } |
441 | 474 | |
442 | 475 | } |
476 | + this.updateMylove() | |
477 | + flag=1 | |
443 | 478 | if(flag!=0){ |
444 | - store.dispatch('myLoveList/getLoveList', { | |
445 | - uid: this.$store.state.user.userInfo.uid, | |
446 | - }); | |
447 | 479 | uni.navigateBack({ |
448 | 480 | delta:1, |
449 | 481 | animationDuration:2000 |
450 | 482 | }) |
451 | 483 | } |
452 | - | |
453 | 484 | } else{ |
454 | 485 | uni.showToast({ |
455 | 486 | title:"请确认您的验光数据", |
... | ... | @@ -457,14 +488,9 @@ |
457 | 488 | duration: 3000, |
458 | 489 | }) |
459 | 490 | } |
460 | - | |
461 | 491 | } |
462 | - | |
463 | - | |
464 | 492 | } |
465 | - | |
466 | 493 | } |
467 | - | |
468 | 494 | }, |
469 | 495 | changeConfirm() { |
470 | 496 | this.confirm = !this.confirm | ... | ... |
src/pages/user/user.vue
... | ... | @@ -77,12 +77,9 @@ |
77 | 77 | ></image> |
78 | 78 | </view> |
79 | 79 | <view class="myOrder"> |
80 | - <view class="orderHeader"> | |
80 | + <view class="orderHeader" @click="toMyOrder('10')" > | |
81 | 81 | <text>我的订单</text> |
82 | - <view | |
83 | - class="btn" | |
84 | - @click="toMyOrder('10')" | |
85 | - > | |
82 | + <view class="btn"> | |
86 | 83 | 全部 |
87 | 84 | <image |
88 | 85 | src="../../static/right.png" | ... | ... |
src/store/modules/cancelOrder.js
... | ... | @@ -5,32 +5,21 @@ const { |
5 | 5 | cancelOrder |
6 | 6 | } = urlAlias; |
7 | 7 | |
8 | -const state = { | |
9 | - orderList: [], | |
10 | -}; | |
11 | - | |
12 | -const mutations = { | |
13 | - INIT: (state, data) => { | |
14 | - state.orderList = data; | |
15 | - }, | |
16 | -}; | |
17 | - | |
18 | 8 | const actions = { |
19 | 9 | cancel({ commit }, param) { |
20 | - request({ | |
21 | - url: cancelOrder, | |
22 | - data: param, | |
23 | - success: (res) => { | |
24 | - console.log(res.data); | |
25 | - // commit("INIT", res.data.data); | |
26 | - }, | |
27 | - }) | |
10 | + return new Promise((resolve)=> | |
11 | + request({ | |
12 | + url: cancelOrder, | |
13 | + data: param, | |
14 | + success: (res) => { | |
15 | + // console.log(res.data); | |
16 | + resolve(res.data) | |
17 | + }, | |
18 | + }) ) | |
28 | 19 | } |
29 | 20 | } |
30 | 21 | |
31 | 22 | export default { |
32 | 23 | namespaced: true, |
33 | - state, | |
34 | - mutations, | |
35 | 24 | actions, |
36 | 25 | } |
37 | 26 | \ No newline at end of file | ... | ... |
src/store/modules/orderRead.js