Authored by huangyCode

修改订单业务

@@ -34,13 +34,20 @@ Component({ @@ -34,13 +34,20 @@ Component({
34 this.dialog = this.selectComponent("#dialog"); 34 this.dialog = this.selectComponent("#dialog");
35 wx.getLocation({ 35 wx.getLocation({
36 success: (res) => { 36 success: (res) => {
37 - param.user_latitude = res.latitude;  
38 - param.user_longitude = res.longitude;  
39 - param.storeId = this.properties.storeId; 37 + param.user_latitude = '32.049999';
  38 + param.user_longitude = '118.790001';
  39 + param.store_id = this.properties.storeId;
40 storeApi.checkStore(param, () => { 40 storeApi.checkStore(param, () => {
41 wx.hideLoading(); 41 wx.hideLoading();
42 }).then(r => { 42 }).then(r => {
43 if (!r.isInRange) { 43 if (!r.isInRange) {
  44 + this.setData({
  45 + // 弹窗显示控制
  46 + content: "Sorry,您的位置不在门店范围内,不能选择门店自提方式购买该商品",
  47 + cancelText: "线上购买",
  48 + confirmText: "知道了",
  49 + type: 0
  50 + });
44 this.dialog.showDialog(); 51 this.dialog.showDialog();
45 resolve({result: false}) 52 resolve({result: false})
46 } else { 53 } else {
@@ -12,6 +12,10 @@ Component({ @@ -12,6 +12,10 @@ Component({
12 value: { 12 value: {
13 13
14 } 14 }
  15 + },
  16 + isStore: {
  17 + type:Boolean,
  18 + value: false
15 } 19 }
16 }, 20 },
17 data: {//组件内部数据 21 data: {//组件内部数据
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 <view class="productRightContainer"> 5 <view class="productRightContainer">
6 <text class="productPrice">¥{{productInfo.goodPrice}}</text> 6 <text class="productPrice">¥{{productInfo.goodPrice}}</text>
7 <text class="productName">{{productInfo.productName}}</text> 7 <text class="productName">{{productInfo.productName}}</text>
8 - <text class="productColor">{{productInfo.colorName + ',' + productInfo.sizeName}}</text> 8 + <text class="productColor" wx:if="{{isStore}}">{{productInfo.colorName + ',' + productInfo.sizeName + ',' +productInfo.skup}}</text>
  9 + <text class="productColor" wx:else>{{productInfo.colorName + ',' + productInfo.sizeName}}</text>
9 </view> 10 </view>
10 </view> 11 </view>
@@ -24,18 +24,18 @@ Page({ @@ -24,18 +24,18 @@ Page({
24 isStore: 0, 24 isStore: 0,
25 storeId: 0 25 storeId: 0
26 }, 26 },
27 - onLoad: function (option) { 27 + onLoad: async function (option) {
28 console.log(option) 28 console.log(option)
29 this.setData({ 29 this.setData({
30 - isStore: option.is_store || 0, 30 + isStore: Number(option.is_store) || 0,
31 storeId: option.store_id || 0, 31 storeId: option.store_id || 0,
32 skup: option.skup || '', 32 skup: option.skup || '',
33 product_id: option.product_id || '', 33 product_id: option.product_id || '',
34 hasAddress: false 34 hasAddress: false
35 }) 35 })
36 - this.fetchData(option.is_store); 36 + await this.fetchData(option.is_store);
37 if (!option.is_store) { 37 if (!option.is_store) {
38 - this.fetchAddress() 38 + await this.fetchAddress()
39 } 39 }
40 }, 40 },
41 41
@@ -50,6 +50,14 @@ Page({ @@ -50,6 +50,14 @@ Page({
50 let data; 50 let data;
51 if (isStore) { 51 if (isStore) {
52 data = await api.createOfflinePayment(params, () => wx.hideLoading()) 52 data = await api.createOfflinePayment(params, () => wx.hideLoading())
  53 + // let index;
  54 + // data.promotionFormulaList.forEach((value, i) => {
  55 + // if (value.promotion === '运费') {
  56 + // index = i;
  57 + // break;
  58 + // }
  59 + // })
  60 + // data.promotionFormulaList.splice(index,1)
53 } else { 61 } else {
54 data = await api.createPaymentInfo(params, () => wx.hideLoading()) 62 data = await api.createPaymentInfo(params, () => wx.hideLoading())
55 } 63 }
@@ -59,14 +67,14 @@ Page({ @@ -59,14 +67,14 @@ Page({
59 this.setData(data) 67 this.setData(data)
60 }, 68 },
61 69
62 - fetchAddress() { 70 + async fetchAddress() {
63 wx.showLoading({ 71 wx.showLoading({
64 title: '', 72 title: '',
65 }) 73 })
66 74
67 let params = {} 75 let params = {}
68 76
69 - api.yohoApi().buyerGetAddress(params, () => wx.hideLoading()) 77 + await api.yohoApi().buyerGetAddress(params, () => wx.hideLoading())
70 .then(data => { 78 .then(data => {
71 if (Array.isArray(data)) { 79 if (Array.isArray(data)) {
72 for (let item of data) { 80 for (let item of data) {
@@ -91,6 +99,7 @@ Page({ @@ -91,6 +99,7 @@ Page({
91 .catch(error => { 99 .catch(error => {
92 console.log(error) 100 console.log(error)
93 }) 101 })
  102 + api.defaultApi();
94 }, 103 },
95 104
96 async submit() { 105 async submit() {
@@ -121,12 +130,12 @@ Page({ @@ -121,12 +130,12 @@ Page({
121 130
122 let addressId = this.data.hasAddress && this.data.address && this.data.address.address_id 131 let addressId = this.data.hasAddress && this.data.address && this.data.address.address_id
123 let skup = this.data.skup 132 let skup = this.data.skup
124 - let channelNo = '' 133 + let channelNo = '';
125 134
126 wx.showLoading({ 135 wx.showLoading({
127 title: '', 136 title: '',
128 }) 137 })
129 - 138 + debugger;
130 data = await api.buyerSubmit(skup, channelNo, addressId, () => wx.hideLoading()); 139 data = await api.buyerSubmit(skup, channelNo, addressId, () => wx.hideLoading());
131 } 140 }
132 if (data && data.orderCode) { 141 if (data && data.orderCode) {
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <storeAddress storeName="{{storeName}}" storeAddress="{{storeAddress}}" bindaddressevent="chooseAddress" 7 <storeAddress storeName="{{storeName}}" storeAddress="{{storeAddress}}" bindaddressevent="chooseAddress"
8 wx:else></storeAddress> 8 wx:else></storeAddress>
9 9
10 - <productCell productInfo="{{good}}"></productCell> 10 + <productCell productInfo="{{good}}" isStore="{{isStore === 1}}"></productCell>
11 <priceCell promotionFormulaList="{{promotionFormulaList}}" damagesDesc="{{damagesDesc}}"></priceCell> 11 <priceCell promotionFormulaList="{{promotionFormulaList}}" damagesDesc="{{damagesDesc}}"></priceCell>
12 <payDeliveryCell paymentWay="{{paymentWay}}" deliveryWay="{{deliveryWay}}"></payDeliveryCell> 12 <payDeliveryCell paymentWay="{{paymentWay}}" deliveryWay="{{deliveryWay}}"></payDeliveryCell>
13 </scroll-view> 13 </scroll-view>
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 </view> 18 </view>
19 </view> 19 </view>
20 <image class='order-detail-right-arrow-image' src='../../assets/images/right-arrow@3x.png'></image> 20 <image class='order-detail-right-arrow-image' src='../../assets/images/right-arrow@3x.png'></image>
21 - 21 +
22 </view> 22 </view>
23 <view class='order-detail-split-line' wx:if="{{data.lastExpressInfo}}"></view> 23 <view class='order-detail-split-line' wx:if="{{data.lastExpressInfo}}"></view>
24 24