|
@@ -1,7 +1,8 @@
|
|
|
// pages/confirmOrder/confirmOrder.js
|
|
|
const getReq = require('./../../config.js').getReq
|
|
|
+import recordSource from '../../utils/recordSource';
|
|
|
import Bundle from '../../utils/Bundle'
|
|
|
-let appInstance = getApp()
|
|
|
+let app = getApp()
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -18,7 +19,12 @@ Page({
|
|
|
cart_id: '',
|
|
|
n_goods_list: [],
|
|
|
freight: 0,
|
|
|
- freight_hash: ''
|
|
|
+ freight_hash: '',
|
|
|
+ fromSource: '',
|
|
|
+ available_pred: 0,
|
|
|
+ room_bonus: 0,
|
|
|
+ full_discount: 0,
|
|
|
+ opgoods_discount: 0
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -36,14 +42,6 @@ Page({
|
|
|
cart_id
|
|
|
})
|
|
|
this.getDatas(goods_id, iscart, num, cart_id)
|
|
|
-
|
|
|
- // 测试套装数据
|
|
|
- // this.getDatas(goods_id, 1, num, '16403,16406')
|
|
|
- // act:member_buy
|
|
|
- // cart_id:16403,16406
|
|
|
- // op:step_first
|
|
|
- // from:YWN0PWNhcnQmb3A9ZXhnb29kcyZjdXJwYWdlPTE%3D
|
|
|
- // ifcart:1
|
|
|
},
|
|
|
getDatas(goods_id, ifcart, num, cart_id) {
|
|
|
wx.showLoading({
|
|
@@ -57,28 +55,34 @@ Page({
|
|
|
else {
|
|
|
goods_datas = cart_id;
|
|
|
}
|
|
|
+ let fromSource = recordSource(app, `act=member_buy&op=step_first&curpage=1&cart_id=${goods_datas}&ifcart=${ifcart}&client_type=mini`)
|
|
|
let params = {
|
|
|
act: 'member_buy',
|
|
|
op: 'step_first',
|
|
|
curpage: 1,
|
|
|
cart_id: goods_datas,
|
|
|
ifcart,
|
|
|
+ from: fromSource
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ fromSource: app.globalData.fromSource
|
|
|
+ })
|
|
|
|
|
|
getReq(params, function (res) {
|
|
|
wx.hideLoading()
|
|
|
if (res.code == 200) {
|
|
|
+ console.log('confirmOrder:', res);
|
|
|
let datas = res.datas
|
|
|
let { goods_list, summary, bundling, payinfo } = res.datas
|
|
|
let { freight_hash, goods_amount, freight, available_pred = 0, user_bonus = 0, room_bonus = 0, full_discount = 0, opgoods_discount = 0 } = payinfo
|
|
|
- let totalPrice = goods_amount + freight - available_pred - user_bonus - room_bonus - full_discount - opgoods_discount
|
|
|
+ let totalPrice = (goods_amount + freight - available_pred - user_bonus - room_bonus - full_discount - opgoods_discount).toFixed(2)
|
|
|
|
|
|
let n_goods_list = self.getNewGoodsList(goods_list, summary, bundling)
|
|
|
|
|
|
if (datas.address) {
|
|
|
let { true_name, mob_phone, area_info, address, address_id, area_id, city_id } = datas.address;
|
|
|
- appInstance.checkDefaultAddress({
|
|
|
+ app.checkDefaultAddress({
|
|
|
true_name,
|
|
|
mob_phone,
|
|
|
area_info,
|
|
@@ -95,7 +99,12 @@ Page({
|
|
|
freight,
|
|
|
totalPrice,
|
|
|
firstLoad: false,
|
|
|
- defaultAddress: datas.address
|
|
|
+ defaultAddress: datas.address,
|
|
|
+
|
|
|
+ available_pred,
|
|
|
+ room_bonus,
|
|
|
+ full_discount,
|
|
|
+ opgoods_discount
|
|
|
})
|
|
|
}
|
|
|
else {
|
|
@@ -104,7 +113,7 @@ Page({
|
|
|
title: res.message,
|
|
|
duration: 2000
|
|
|
})
|
|
|
- appInstance.globalData.fcodeErr = res.message
|
|
|
+ app.globalData.fcodeErr = res.message
|
|
|
wx.navigateBack()
|
|
|
}
|
|
|
})
|
|
@@ -172,7 +181,7 @@ Page({
|
|
|
title: res.message,
|
|
|
duration: 2000
|
|
|
})
|
|
|
- appInstance.globalData.fcodeErr = res.message
|
|
|
+ app.globalData.fcodeErr = res.message
|
|
|
wx.navigateBack()
|
|
|
}
|
|
|
})
|
|
@@ -204,8 +213,9 @@ Page({
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
if (!this.data.firstLoad) {
|
|
|
+ app.setFromSource(this.data.fromSource)
|
|
|
let self = this
|
|
|
- let defaultAddress = appInstance.globalData.defaultAddress
|
|
|
+ let defaultAddress = app.globalData.defaultAddress
|
|
|
|
|
|
let { city_id, area_id } = defaultAddress
|
|
|
let { freight_hash } = self.data
|
|
@@ -220,7 +230,7 @@ Page({
|
|
|
if (res.code == 200) {
|
|
|
let { freight } = res.datas
|
|
|
let prev_freight = self.data.freight
|
|
|
- let totalPrice = self.data.totalPrice - prev_freight + freight
|
|
|
+ let totalPrice = (self.data.totalPrice - prev_freight + freight).toFixed(2)
|
|
|
self.setData({
|
|
|
totalPrice,
|
|
|
freight,
|