Authored by 陈峰

Merge branch 'feature/group-miniapp' into 'release/6.9.5'

Feature/group miniapp



See merge request !15
  1 +registry=http://npm.yohops.com
@@ -9,10 +9,22 @@ @@ -9,10 +9,22 @@
9 "postcss": false, 9 "postcss": false,
10 "minified": false, 10 "minified": false,
11 "newFeature": true, 11 "newFeature": true,
12 - "autoAudits": false 12 + "coverView": true,
  13 + "nodeModules": false,
  14 + "autoAudits": false,
  15 + "checkInvalidKey": true,
  16 + "checkSiteMap": true,
  17 + "uploadWithSourceMap": true,
  18 + "babelSetting": {
  19 + "ignore": [],
  20 + "disablePlugins": [],
  21 + "outputPath": ""
  22 + }
13 }, 23 },
14 "compileType": "miniprogram", 24 "compileType": "miniprogram",
15 "libVersion": "2.2.4", 25 "libVersion": "2.2.4",
  26 + "simulatorType": "wechat",
  27 + "simulatorPluginLibVersion": {},
16 "condition": { 28 "condition": {
17 "search": { 29 "search": {
18 "current": -1, 30 "current": -1,
@@ -30,7 +42,7 @@ @@ -30,7 +42,7 @@
30 "list": [] 42 "list": []
31 }, 43 },
32 "miniprogram": { 44 "miniprogram": {
33 - "current": 14, 45 + "current": 15,
34 "list": [ 46 "list": [
35 { 47 {
36 "id": -1, 48 "id": -1,
@@ -124,6 +136,13 @@ @@ -124,6 +136,13 @@
124 "pathName": "pages/productDetail/index", 136 "pathName": "pages/productDetail/index",
125 "query": "q=https%3A%2F%2Fo.yohobuy.com%2Fufo%3Fp%3D517449%2C1%26skup%3D517449%26skn%3D10003791&scancode_time=1553151155", 137 "query": "q=https%3A%2F%2Fo.yohobuy.com%2Fufo%3Fp%3D517449%2C1%26skup%3D517449%26skn%3D10003791&scancode_time=1553151155",
126 "scene": 1011 138 "scene": 1011
  139 + },
  140 + {
  141 + "id": 15,
  142 + "name": "定单确认",
  143 + "pathName": "pages/order/orderConfirm/orderConfirm",
  144 + "query": "product_id=10014834&skup=14044&user_activity_id=1204",
  145 + "scene": 1011
127 } 146 }
128 ] 147 ]
129 } 148 }
@@ -7,7 +7,7 @@ export default { @@ -7,7 +7,7 @@ export default {
7 // production 7 // production
8 api: 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway', 8 api: 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway',
9 yohoApi: 'http://api-test3.dev.yohocorp.com', 9 yohoApi: 'http://api-test3.dev.yohocorp.com',
10 - yohoLogin: 'http://java-yoho-wechat.test3.ingress.dev.yohocorp.com', 10 + yohoLogin: 'http://api-test3.dev.yohocorp.com',
11 activityHost: 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com', 11 activityHost: 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com',
12 reportHost: 'https://app.yoho.cn/collect/v3', 12 reportHost: 'https://app.yoho.cn/collect/v3',
13 yasHost: 'https://analysis.yohobuy.com/yas_mobile' 13 yasHost: 'https://analysis.yohobuy.com/yas_mobile'
@@ -6,6 +6,6 @@ @@ -6,6 +6,6 @@
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" wx:if="{{isStore}}">{{productInfo.colorName + ',' + productInfo.sizeName + ',' +productInfo.skup}}</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 + <text class="productColor" wx:else>{{(productInfo.colorName || '') + ',' + (productInfo.sizeName || '')}}</text>
10 </view> 10 </view>
11 </view> 11 </view>
@@ -9,10 +9,12 @@ import orderService from '../orderService' @@ -9,10 +9,12 @@ import orderService from '../orderService'
9 import {getImgUrl} from '../../../utils'; 9 import {getImgUrl} from '../../../utils';
10 import router from '../../../router/index.js' 10 import router from '../../../router/index.js'
11 import { prePay } from '../../order/wxpay.js' 11 import { prePay } from '../../order/wxpay.js'
12 -import Yas from '../../../utils/yas'; 12 +import Yas from '../../../utils/yas'
13 13
14 let yas; 14 let yas;
15 15
  16 +const ACTIVITY_TYPE = 18; // 砍价
  17 +
16 const api = new orderService(); 18 const api = new orderService();
17 Page({ 19 Page({
18 20
@@ -26,23 +28,36 @@ Page({ @@ -26,23 +28,36 @@ Page({
26 unCheckImage: '../../../assets/images/unselect@2x.png', 28 unCheckImage: '../../../assets/images/unselect@2x.png',
27 isStore: 0, 29 isStore: 0,
28 storeId: 0, 30 storeId: 0,
  31 + skup: '',
29 coupons: [], 32 coupons: [],
30 selectCouponCode: '', 33 selectCouponCode: '',
31 selectCouponAmount: '', 34 selectCouponAmount: '',
32 - selectingCoupon: false 35 + selectingCoupon: false,
  36 + user_activity_id: '' // 有值代表砍价
33 }, 37 },
34 onLoad: async function (option) { 38 onLoad: async function (option) {
35 yas = new Yas(this); 39 yas = new Yas(this);
36 yas.pageOpenReport(); 40 yas.pageOpenReport();
  41 +
37 this.setData({ 42 this.setData({
38 isStore: Number(option.is_store) || 0, 43 isStore: Number(option.is_store) || 0,
39 storeId: option.store_id || 0, 44 storeId: option.store_id || 0,
40 skup: option.skup || '', 45 skup: option.skup || '',
41 product_id: option.product_id || '', 46 product_id: option.product_id || '',
42 - hasAddress: false 47 + hasAddress: false,
  48 + user_activity_id: option.user_activity_id || ''
43 }) 49 })
44 - await this.fetchData(option.is_store);  
45 - if (!option.is_store) { 50 + },
  51 +
  52 + async onShow() {
  53 + let userInfo = wx.getStorageSync('userInfo');
  54 + if (!(userInfo && userInfo.uid && userInfo.session_key)) {
  55 + router.go('nativeLogin');
  56 + return;
  57 + }
  58 +
  59 + await this.fetchData(this.data.isStore);
  60 + if (!this.data.isStore) {
46 await this.fetchAddress() 61 await this.fetchAddress()
47 } 62 }
48 }, 63 },
@@ -72,10 +87,19 @@ Page({ @@ -72,10 +87,19 @@ Page({
72 coupon_code: code 87 coupon_code: code
73 }, () => wx.hideLoading()); 88 }, () => wx.hideLoading());
74 } else { 89 } else {
75 - info = await api.orderCompute({ 90 + const params = {
76 skup: this.data.skup, 91 skup: this.data.skup,
77 coupon_code: code 92 coupon_code: code
78 - }, () => wx.hideLoading()); 93 + };
  94 +
  95 + if (this.data.user_activity_id) {
  96 + Object.assign(params, {
  97 + user_activity_id: this.data.user_activity_id,
  98 + activity_type: ACTIVITY_TYPE
  99 + });
  100 + }
  101 +
  102 + info = await api.orderCompute(params, () => wx.hideLoading());
79 } 103 }
80 } catch(e) {} 104 } catch(e) {}
81 105
@@ -99,6 +123,14 @@ Page({ @@ -99,6 +123,14 @@ Page({
99 skup: this.data.skup, 123 skup: this.data.skup,
100 store_id: this.data.storeId 124 store_id: this.data.storeId
101 } 125 }
  126 +
  127 + if (this.data.user_activity_id) {
  128 + Object.assign(params, {
  129 + user_activity_id: this.data.user_activity_id,
  130 + activity_type: ACTIVITY_TYPE
  131 + })
  132 + }
  133 +
102 let data; 134 let data;
103 if (isStore) { 135 if (isStore) {
104 data = await api.createOfflinePayment(params, () => wx.hideLoading()) 136 data = await api.createOfflinePayment(params, () => wx.hideLoading())
@@ -110,7 +142,17 @@ Page({ @@ -110,7 +142,17 @@ Page({
110 }) 142 })
111 data.promotionFormulaList.splice(index,1) 143 data.promotionFormulaList.splice(index,1)
112 } else { 144 } else {
113 - data = await api.createPaymentInfo(params, () => wx.hideLoading()) 145 + try {
  146 + data = await api.createPaymentInfo(params, () => wx.hideLoading())
  147 + } catch (e) {
  148 + console.log(e)
  149 + wx.showModal({
  150 + title: '失败',
  151 + content: e.message,
  152 + showCancel: false,
  153 + })
  154 + return;
  155 + }
114 } 156 }
115 157
116 api.orderSelectCoupon(this.data.skup, () => wx.hideLoading()).then(data => { 158 api.orderSelectCoupon(this.data.skup, () => wx.hideLoading()).then(data => {
@@ -191,11 +233,19 @@ Page({ @@ -191,11 +233,19 @@ Page({
191 let skup = this.data.skup 233 let skup = this.data.skup
192 let channelNo = ''; 234 let channelNo = '';
193 let couponCode = this.data.selectCouponCode || ''; 235 let couponCode = this.data.selectCouponCode || '';
  236 + let extra = null;
  237 +
  238 + if (this.data.user_activity_id) {
  239 + extra = {
  240 + user_activity_id: this.data.user_activity_id,
  241 + activity_type: ACTIVITY_TYPE
  242 + };
  243 + }
194 244
195 // wx.showLoading({ 245 // wx.showLoading({
196 // title: '', 246 // title: '',
197 // }) 247 // })
198 - data = await api.buyerSubmit(skup, channelNo, addressId, couponCode, () => wx.hideLoading()); 248 + data = await api.buyerSubmit({skup, channelNo, addressId, couponCode, extra}, () => wx.hideLoading());
199 } 249 }
200 if (data && data.orderCode) { 250 if (data && data.orderCode) {
201 let skup = this.data.skup 251 let skup = this.data.skup
@@ -6,7 +6,8 @@ @@ -6,7 +6,8 @@
6 wx:else></storeAddress> 6 wx:else></storeAddress>
7 7
8 <productCell productInfo="{{good}}" isStore="{{isStore === 1}}"></productCell> 8 <productCell productInfo="{{good}}" isStore="{{isStore === 1}}"></productCell>
9 - <couponCell bindselect="showSelectCoupon" amount="{{selectCouponAmount}}"></couponCell> 9 + <!-- // 砍价没有优惠券 -->
  10 + <couponCell wx:if="{{!user_activity_id}}" bindselect="showSelectCoupon" amount="{{selectCouponAmount}}"></couponCell>
10 <priceCell promotionFormulaList="{{promotionFormulaList}}" damagesDesc="{{damagesDesc}}" isStore="{{isStore === 1}}"></priceCell> 11 <priceCell promotionFormulaList="{{promotionFormulaList}}" damagesDesc="{{damagesDesc}}" isStore="{{isStore === 1}}"></priceCell>
11 <payDeliveryCell paymentWay="{{paymentWay}}" deliveryWay="{{deliveryWay}}"></payDeliveryCell> 12 <payDeliveryCell paymentWay="{{paymentWay}}" deliveryWay="{{deliveryWay}}"></payDeliveryCell>
12 </scroll-view> 13 </scroll-view>
@@ -56,15 +56,15 @@ export default class orderService extends BaseService { @@ -56,15 +56,15 @@ export default class orderService extends BaseService {
56 }) 56 })
57 } 57 }
58 58
59 - async buyerSubmit(skup, channelNo = '2919', addressId, couponCode, complete) { 59 + async buyerSubmit({skup, channelNo = '2919', addressId, couponCode, complete, extra = {}} ) {
60 60
61 - return await this.GET({ 61 + return await this.GET(Object.assign({
62 method: BUYER_SUBMIT, 62 method: BUYER_SUBMIT,
63 skup, 63 skup,
64 channelNo, 64 channelNo,
65 addressId, 65 addressId,
66 coupon_code: couponCode || '' 66 coupon_code: couponCode || ''
67 - }, { 67 + }, extra), {
68 path: '/shopping', 68 path: '/shopping',
69 complete 69 complete
70 }) 70 })