Commit c0baa9e0 by 高淑倩

下单

parent 2d4c87bb
......@@ -233,11 +233,17 @@ wxService.page({
})
return false
}
console.log('trolleySku2Buy', trolleySku2Buy)
// 去下单页 && 参数
let parmas = {
trolleySku2Buy: JSON.stringify(trolleySku2Buy)
// let parmas = {
// trolleySku2Buy: JSON.stringify(trolleySku2Buy)
// }
let tradeDto = {
couponId: '',
trolleySku2Buy:JSON.stringify(trolleySku2Buy)
}
const parmas = tradeDto
wxService
.router('/pages/confirmOrder/confirmOrder')
.search(parmas)
......
......@@ -24,33 +24,27 @@ wxService.page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
const { couponId, trolleySku2Buy } = this.options
// {
// "couponId": 0,
// "trolleySku2Buy": [
// {
// "count": 0,
// "skuId": 0
// }
// ]
// }
let tradeDto = {
couponId: couponId,
trolleySku2Buy: JSON.parse(trolleySku2Buy)
}
let trolleySku2Buy = this.options.trolleySku2Buy
console.log('tradeDto', tradeDto)
console.log('trolleySku2Buy',trolleySku2Buy)
// 下单 && 计算优惠价
// if (trolleySku2Buy.length) {
// this.setData({ trolleySku2Buy }, () => {
// this.calPreferentialPrice(trolleySku2Buy) // 计算优惠价
// })
// }
this.setData({ trolleySku2Buy: tradeDto }, () => {
this.calPreferentialPrice(tradeDto) // 计算优惠价
})
this.initCitys()
// 地址列表
this.getAddressList()
......@@ -191,11 +185,11 @@ wxService.page({
wxService.router('/pages/myAddress/myAddress')
},
// 计算优惠价
calPreferentialPrice(trolleySku2Buy) {
calPreferentialPrice(tradeDto) {
wx.showLoading({
title: '加载中'
})
wxService.post(`/sale/trade/buyer/preview`, trolleySku2Buy).then(res => {
wxService.post(`/sale/trade/buyer/preview`, tradeDto).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
......@@ -256,16 +250,16 @@ wxService.page({
let hasDefalut = wx.getStorageSync('_defalutAddress')
let _defalutAddress = null
if(hasDefalut) {
if (hasDefalut) {
_defalutAddress = hasDefalut
} else {
data.forEach(item=>{
if(item.type == 1){
data.forEach(item => {
if (item.type == 1) {
_defalutAddress = item
}
})
}
this.setData({
addressInfo: _defalutAddress
})
......
......@@ -63,7 +63,7 @@
<view class="gray-line" />
<!-- 商品列表 -->
<view class="pro-wrap">
<block wx:for="{{currentOrderList}}" wx:key="{{item}}">
<block wx:for="{{currentOrderList.tradePreviewSkus}}" wx:key="{{item}}">
<view class="pro-list">
<image class="pro-img" src="{{item.productImgUrl}}" />
<view class="pro-info">
......@@ -108,7 +108,7 @@
<view class="order-price">
<view class="pro-total-price">
<text class="price-label">商品合计</text>
<text class="total-price">¥306</text>
<text class="total-price">¥{{currentOrderList.amount}}</text>
</view>
<view class="plus-price" wx:if="{{isSelect}}">
<view class="plus-info">
......@@ -147,7 +147,7 @@
<view class="pro-footer">
<view class="cost">
<text class="cost-label">实付款:</text>
<text class="cost-price">¥306</text>
<text class="cost-price">¥{{currentOrderList.amount}}</text>
</view>
<!-- <button form-type="submit" class="theme-color buy-btn">立即购买</button>-->
<!-- <view class="theme-color buy-btn" bindtap="handelGobuy">立即购买</view> -->
......
......@@ -39,7 +39,7 @@
"list": []
},
"miniprogram": {
"current": 16,
"current": 17,
"list": [
{
"id": -1,
......@@ -151,7 +151,7 @@
"id": 17,
"name": "确认订单",
"pathName": "pages/confirmOrder/confirmOrder",
"query": "trolleySku2Buy=[{\"count\":1,\"skuId\":2000704}]",
"query": "couponId=&trolleySku2Buy=[{\"count\":1,\"skuId\":613473098901098500}]",
"scene": null
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment