Commit 8cb518a1 by 赵雅纹

Merge branch 'dev_7.1.0' into feature-zyw-sc

parents 53f18953 243e7bda
...@@ -49,7 +49,6 @@ wxService.page({ ...@@ -49,7 +49,6 @@ wxService.page({
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
......
// pages/confirmOrder/confirmOrder.js // pages/confirmOrder/confirmOrder.js
const wxService = require('../../utils/wxService') const wxService = require('../../utils/wxService')
const { memberId } = wx.getStorageSync('_baseUserInfo')
wxService.page({ wxService.page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
addressInfo: '', addressInfo: [],
showSelectCoupon: false, showSelectCoupon: false,
skuIds: [], skuIds: [],
trolleySku2Buy: Array, trolleySku2Buy: Array,
currentOrderList: Array, currentOrderList: Array,
isSelect: false isSelect: false,
goodsAddress: false,
citys: null,
cityView: '',
multiIndex: [0, 0, 0],
selectCityName: ['', '']
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
...@@ -30,12 +37,145 @@ wxService.page({ ...@@ -30,12 +37,145 @@ wxService.page({
this.calPreferentialPrice(trolleySku2Buy) // 计算优惠价 this.calPreferentialPrice(trolleySku2Buy) // 计算优惠价
}) })
} }
this.initCitys()
// 地址列表
this.getAddressList()
}, },
formSubmit(e) {
const { goodsAddress } = this.data
// 保存地址 && 支付
if (goodsAddress) {
if (!e.detail.value.name) {
wx.showToast({
title: `请输入姓名`,
icon: 'none'
})
return false;
}
if (!e.detail.value.phone) {
wx.showToast({
title: `请输入电话`,
icon: 'none'
})
return false;
}
if (!this.data.cityView) {
wx.showToast({
title: `请选择地区`,
icon: 'none'
})
return false;
}
if (!e.detail.value.address) {
wx.showToast({
title: `请输入详细地址`,
icon: 'none'
})
return false;
}
this.setData({
params: {
userId: memberId,
name: e.detail.value.name,
phone: e.detail.value.phone,
fullArea: this.data.cityView,
address: e.detail.value.address,
type: this.data.isSelect ? 1 : 0
}
})
wx.showLoading({
title: '加载中'
})
wxService.post(`/member/addressManage/save`, this.data.params).then(res => {
const { result } = res.data
if (result == 0) {
wx.hideLoading()
wx.showToast({
title: `保存成功`,
icon: 'none'
})
// 调起支付
this.handelGobuy()
}
})
} else {
// 调起支付
this.handelGobuy()
}
},
initCitys() {
wxService.getC1().then((c1) => {
return wxService.Promise.all([wxService.Promise.resolve(c1), wxService.getC2ByC1('北京'), wxService.getC3ByC2('北京北京市')])
}).then(res => {
const citys = res.map(item => {
return [...item]
})
this.setData({
citys
})
})
},
bindMultiPickerChange(e) {
const citys = this.data.citys
const multiIndex = e.detail.value
if (citys) {
const cityView = [citys[0][multiIndex[0]], citys[1][multiIndex[1]], citys[2][multiIndex[2]]].join(' ')
this.setData({
multiIndex,
cityView
}, () => {
console.log('================0', this.data.cityView, this.data.multiIndex)
})
}
},
bindMultiPickerColumnChange(e) {
const detail = e.detail
const index = detail.value
let cityName = ''
switch (detail.column) {
case 0:
cityName = this.data.citys[0][index]
this.data.selectCityName[0] = cityName
wxService.getC2ByC1(cityName)
.then(item => {
let c2 = [...item]
this.data.selectCityName[1] = c2[0]
return wxService.Promise.all([wxService.Promise.resolve(item), wxService.getC3ByC2(this.data.selectCityName.join(''))])
}).then((res) => {
this.setData({
'citys[1]': [...res[0]],
'citys[2]': [...res[1]]
})
})
break
case 1:
cityName = this.data.citys[1][index]
this.data.selectCityName[1] = cityName
wxService.getC3ByC2(this.data.selectCityName.join(''))
.then(item => {
this.setData({
'citys[2]': [...item]
})
})
break
default:
break
}
},
handelChangeSelectVip() { handelChangeSelectVip() {
this.setData({ this.setData({
isSelect: !this.data.isSelect isSelect: !this.data.isSelect
}) })
}, },
// 默认地址
selectAddress() {
wxService.router('/pages/myAddress/myAddress')
},
// 计算优惠价 // 计算优惠价
calPreferentialPrice(trolleySku2Buy) { calPreferentialPrice(trolleySku2Buy) {
wx.showLoading({ wx.showLoading({
...@@ -67,7 +207,7 @@ wxService.page({ ...@@ -67,7 +207,7 @@ wxService.page({
delete data.appId delete data.appId
wx.requestPayment(Object.assign({ wx.requestPayment(Object.assign({
success(res) { success(res) {
console.log('000000',res) console.log('000000', res)
wx.hideLoading() wx.hideLoading()
// 支付成功页面 // 支付成功页面
wxService.router('/subPackage/page/pages/paymentStatus/paymentStatus') wxService.router('/subPackage/page/pages/paymentStatus/paymentStatus')
...@@ -85,13 +225,49 @@ wxService.page({ ...@@ -85,13 +225,49 @@ wxService.page({
} }
}) })
}, },
// 获取地址列表
getAddressList() {
wxService.post(`/member/addressManage/getall`, {
userId: memberId
}).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
if (!data.length) {
this.setData({
goodsAddress: true
})
} else {
// 缓存有没有地址
let hasDefalut = wx.getStorageSync('_defalutAddress')
let _defalutAddress = null
if(hasDefalut) {
_defalutAddress = hasDefalut
} else {
data.forEach(item=>{
if(item.type == 1){
_defalutAddress = item
}
})
}
this.setData({
addressInfo: _defalutAddress
})
}
}
}).finally(() => {
})
},
//获取微信地址 //获取微信地址
chooseWxAddress() { chooseWxAddress() {
wx.chooseAddress({ wx.chooseAddress({
success: (res) => { success: (res) => {
console.log(res) console.log('微信地址', res)
this.setData({ this.setData({
addressInfo: res goodsAddress: false,
addressInfo: res,
}) })
}, },
fail: function (err) { fail: function (err) {
......
<!--pages/confirmOrder/confirmOrder.wxml--> <!--pages/confirmOrder/confirmOrder.wxml-->
<view class="page-confirm-order"> <view class="page-confirm-order">
<view class="address-wrap"> <form bindsubmit="formSubmit">
<block wx:if="{{false}}"> <view class="address-wrap">
<view class="address-section"> <block wx:if="{{goodsAddress}}">
<input class="address-input" placeholder="请输入收货人姓名" /> <view class="address-section">
<input class="address-input" placeholder="请输入手机号码" /> <input class="address-input" name="name" placeholder="请输入收货人姓名" />
</view> <input class="address-input" name="phone" placeholder="请输入手机号码" />
<view class="address-section"> </view>
<!-- <view class="">所在区域</view> --> <view class="address-section">
<picker <picker
class="address-input address-picker" class="address-input address-picker"
mode="region" mode="multiSelector"
bindchange="bindRegionChange" bindchange="bindMultiPickerChange"
value="{{region}}" bindcolumnchange="bindMultiPickerColumnChange"
custom-item="{{customItem}}" value="{{multiIndex}}"
> range="{{citys}}"
<view class="picker-choose" /> >
</picker> <view class="form-picker" style="padding-top: 8rpx;" wx:if="{{cityView}}">
</view> {{cityView}}
<view class="address-section"> </view>
<input class="address-input address-detail" placeholder="请输入路名门牌号" /> <view wx:if="{{!cityView}}">
</view> <input
</block> class='form-input'
<block> placeholder-class="placeholder-picker"
<view class="address-list"> style="padding-top: 8rpx;"
<view class="address-info"> type="text"
<view> disabled
<text class="user-name">{{addressInfo.userName}}</text> placeholder="所在区域"
<text class="phone-number">{{addressInfo.telNumber}}</text> />
</view> </view>
<view class="address-list-detail"> </picker>
{{addressInfo.provinceName}} {{addressInfo.cityName}} {{addressInfo.countyName}} {{addressInfo.detailInfo}} </view>
</view> <view class="address-section">
<view class="arrow-right-wrap"> <input class="address-input address-detail" name="address" placeholder="请输入路名门牌号" />
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" /> </view>
</block>
<block wx:if="{{!goodsAddress}}">
<view class="address-list" bindtap="selectAddress">
<view class="address-info">
<view>
<image class="defalut-add-img" src="{{addressInfo.type == 1 ? '/assets/imgs/7_1_0/08_22/defalut.png' : '/assets/imgs/7_1_0/08_22/no-defalut.png'}}" />
<text class="user-name">{{addressInfo.name}}</text>
<text class="phone-number">{{addressInfo.phone}}</text>
</view>
<view class="address-list-detail">
{{addressInfo.fullArea}} {{addressInfo.address}}
</view>
<view class="arrow-right-wrap">
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
</view>
</view> </view>
</view> </view>
</block>
<view class="wx-address" bindtap="chooseWxAddress">
+ 使用微信地址
</view> </view>
</block>
<view class="wx-address" bindtap="chooseWxAddress">
+ 使用微信地址
</view> </view>
</view> <view class="address-line">
<view class="address-line"> <image src="/assets/imgs/7_1_0/address-line.png" />
<image src="/assets/imgs/7_1_0/address-line.png" /> </view>
</view> <!-- 分割线 -->
<!-- 分割线 --> <view class="gray-line" />
<view class="gray-line" /> <!-- 商品列表 -->
<!-- 商品列表 --> <view class="pro-wrap">
<view class="pro-wrap"> <block wx:for="{{currentOrderList}}" wx:key="{{item}}">
<block wx:for="{{currentOrderList}}" wx:key="{{item}}"> <view class="pro-list">
<view class="pro-list"> <image class="pro-img" src="{{item.productImgUrl}}" />
<image class="pro-img" src="{{item.productImgUrl}}" /> <view class="pro-info">
<view class="pro-info"> <view class="pro-name">{{item.productName}}</view>
<view class="pro-name">{{item.productName}}</view> <view class="pro-desc">
<view class="pro-desc"> 规格 {{item.skuSpec}}
规格 {{item.skuSpec}} </view>
</view> <view class="pro-price">
<view class="pro-price"> <text class="price">¥{{item.price}}</text>
<text class="price">¥{{item.price}}</text> <text class="number">x {{item.count}}</text>
<text class="number">x {{item.count}}</text> </view>
</view> </view>
</view> </view>
</view> </block>
</block> </view>
</view> <!-- 分割线 -->
<!-- 分割线 --> <view class="gray-line" />
<view class="gray-line" />
<!-- 商品合计 --> <!-- 商品合计 -->
<view class="pro-sum"> <view class="pro-sum">
<view class="vip-info"> <view class="vip-info">
<view class="vip-left"> <view class="vip-left">
<view class="left-top"> <view class="left-top">
<image class="top-image" src="/assets/imgs/7_1_0/plus-icon.png" /> <image class="top-image" src="/assets/imgs/7_1_0/plus-icon.png" />
<text>现在勾选成为vip,立领200元礼包,文案文案 </text> <text>现在勾选成为vip,立领200元礼包,文案文案 </text>
</view> </view>
<view class="left-bottom"> <view class="left-bottom">
<text>vip可尊享N大权益</text> <text>vip可尊享N大权益</text>
<image class="bottom-image" src="/assets/imgs/7_1_0/explain.png" /> <image class="bottom-image" src="/assets/imgs/7_1_0/explain.png" />
</view> </view>
</view>
<view class="vip-right">
<view class="right-check-status" bindtap="handelChangeSelectVip">
<image class="check-status-img" src="{{isSelect ? '/assets/imgs/7_1_0/08_22/trade-success.png' : '/assets/imgs/7_1_0/08_22/trade-unsel.png'}}" />
</view> </view>
<view class="right-check-tips {{isSelect? 'tip-check' : 'tip-un-check'}}"> <view class="vip-right">
<image class="select-check-open {{isSelect? 'tip-check' : 'tip-un-check'}}" src="{{isSelect ? '/assets/imgs/7_1_0/08_22/sel.png' : '/assets/imgs/7_1_0/08_22/un-sel.png'}}" /> <view class="right-check-status" bindtap="handelChangeSelectVip">
<image class="check-status-img" src="{{isSelect ? '/assets/imgs/7_1_0/08_22/trade-success.png' : '/assets/imgs/7_1_0/08_22/trade-unsel.png'}}" />
</view>
<view class="right-check-tips {{isSelect? 'tip-check' : 'tip-un-check'}}">
<image class="select-check-open {{isSelect? 'tip-check' : 'tip-un-check'}}" src="{{isSelect ? '/assets/imgs/7_1_0/08_22/sel.png' : '/assets/imgs/7_1_0/08_22/un-sel.png'}}" />
</view>
</view> </view>
</view> </view>
</view> <view class="order-sum">
<view class="order-sum"> <view class="order-price">
<view class="order-price"> <view class="pro-total-price">
<view class="pro-total-price"> <text class="price-label">商品合计</text>
<text class="price-label">商品合计</text> <text class="total-price">¥306</text>
<text class="total-price">¥306</text> </view>
</view> <view class="plus-price" wx:if="{{isSelect}}">
<view class="plus-price" wx:if="{{isSelect}}"> <view class="plus-info">
<view class="plus-info"> <text class="price-label">plus会员价</text>
<text class="price-label">plus会员价</text> <text class="member-price">-¥20</text>
<text class="member-price">-¥20</text> </view>
<text class="plus-member-price">¥289</text>
</view> </view>
<text class="plus-member-price">¥289</text>
</view> </view>
</view> <view class="coupon">
<view class="coupon"> <view>
<view> <text class="price-label">优惠券</text>
<text class="price-label">优惠券</text> <view class="select-coupon" bindtap="selectCoupon">
<view class="select-coupon" bindtap="selectCoupon"> <text class="{{haveCoupon ? 'coupon-price' : 'no-coupon'}}">{{haveCoupon ? '-¥100' : '无可用优惠券'}}</text>
<text class="{{haveCoupon ? 'coupon-price' : 'no-coupon'}}">{{haveCoupon ? '-¥100' : '无可用优惠券'}}</text> <image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" /> </view>
</view> </view>
</view> </view>
</view> <view class="coupon" wx:if="{{isSelect}}">
<view class="coupon" wx:if="{{isSelect}}"> <view>
<view> <text class="price-label">VIP会员年费</text>
<text class="price-label">VIP会员年费</text> <text class="vip-desc"> (不可使用任何优惠或积分)</text>
<text class="vip-desc"> (不可使用任何优惠或积分)</text> <view class="select-coupon">
<view class="select-coupon"> <text class="coupon-price">+¥100</text>
<text class="coupon-price">+¥100</text> <image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" /> </view>
</view> </view>
</view> </view>
</view> <!-- <view class="total">
<!-- <view class="total">
<text class="total-label">小计:</text> <text class="total-label">小计:</text>
<text class="total-numer">¥186</text> <text class="total-numer">¥186</text>
</view> --> </view> -->
</view>
</view> </view>
</view>
<view class="pro-footer"> <view class="pro-footer">
<view class="cost"> <view class="cost">
<text class="cost-label">实付款:</text> <text class="cost-label">实付款:</text>
<text class="cost-price">¥306</text> <text class="cost-price">¥306</text>
</view>
<!-- <button form-type="submit" class="theme-color buy-btn">立即购买</button>-->
<!-- <view class="theme-color buy-btn" bindtap="handelGobuy">立即购买</view> -->
<view class="theme-color buy-btn">
<button form-type="submit" style="display: inline;" class="theme-color buy-btn">立即购买</button>
</view>
</view> </view>
<view class="theme-color buy-btn" bindtap="handelGobuy">立即购买</view> </form>
</view>
</view> </view>
<!--goHome--> <!--goHome-->
<go-home/> <go-home/>
......
/* pages/confirmOrder/confirmOrder.wxss */ /* pages/confirmOrder/confirmOrder.wxss */
@import './../../base/base.wxss';
.defalut-add-img {
width: 84rpx;
height: 33rpx;
border-radius: 16rpx;
/* background-color: rgba(203, 60, 60, 1); */
}
.address-wrap{ .address-wrap{
padding: 0 30rpx; padding: 0 30rpx;
} }
...@@ -13,7 +20,7 @@ ...@@ -13,7 +20,7 @@
background-color: rgba(238, 238, 238, 1); background-color: rgba(238, 238, 238, 1);
opacity: 0.5; opacity: 0.5;
padding: 0 20rpx; padding: 0 20rpx;
color: rgba(0, 0, 0, 0.25); color: #000;
font-size: 28rpx; font-size: 28rpx;
margin-bottom: 18rpx; margin-bottom: 18rpx;
} }
...@@ -23,6 +30,7 @@ ...@@ -23,6 +30,7 @@
.address-picker{ .address-picker{
flex: 1; flex: 1;
} }
.picker-choose{ .picker-choose{
color: rgba(0, 0, 0, 0.25); color: rgba(0, 0, 0, 0.25);
font-size: 28rpx; font-size: 28rpx;
......
...@@ -24,7 +24,15 @@ wxService.page({ ...@@ -24,7 +24,15 @@ wxService.page({
onLoad: function (options) { onLoad: function (options) {
}, },
handelCheckShopAddress(e) {
const index = e.currentTarget.dataset.index
const item = this.data.addressList[index]
wx.setStorageSync('_defalutAddress', item)
setTimeout(() => {
wxService.router().back()
}, 300)
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
......
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
bindtouchstart="drawStart" bindtouchstart="drawStart"
bindtouchmove="drawMove" bindtouchmove="drawMove"
bindtouchend="drawEnd" bindtouchend="drawEnd"
bindtap='handelCheckShopAddress'
style="right:{{item.right}}rpx" style="right:{{item.right}}rpx"
data-id="{{item.id}}"
data-index="{{index}}" data-index="{{index}}"
> >
<view class="name"> <view class="name">
...@@ -27,7 +29,7 @@ ...@@ -27,7 +29,7 @@
data-type="{{item.type}}" data-type="{{item.type}}"
data-id="{{item.id}}" data-id="{{item.id}}"
> >
<view class="{{item.type == 1 ? 'theme-color' : ''}} circle-radio"> <view class="{{item.type == 1 ? 'theme-color' : ''}} circle-radio check-default-address">
<image <image
wx:if="{{item.type == 1}}" wx:if="{{item.type == 1}}"
class="tick-success" class="tick-success"
......
...@@ -80,9 +80,11 @@ page{ ...@@ -80,9 +80,11 @@ page{
.tick-success{ .tick-success{
width: 18rpx; width: 18rpx;
} }
.default-address{ .default-address{
display: flex; display: flex;
margin-top: 25rpx; margin-top: 25rpx;
width: 250rpx;
} }
.setting-default{ .setting-default{
margin-left: 19rpx; margin-left: 19rpx;
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 16, "current": 17,
"list": [ "list": [
{ {
"id": -1, "id": -1,
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
"id": 17, "id": 17,
"name": "确认订单", "name": "确认订单",
"pathName": "pages/confirmOrder/confirmOrder", "pathName": "pages/confirmOrder/confirmOrder",
"query": "trolleySku2Buy=[{\"count\":3,\"skuId\":1556108807316001},{\"count\":1,\"skuId\":1556108807316000}]", "query": "trolleySku2Buy=[{\"count\":1,\"skuId\":2000704}]",
"scene": null "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