物流+下单+地址修改
This commit is contained in:
@@ -3,25 +3,25 @@
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<z-nav-bar title="商品结算"></z-nav-bar>
|
||||
<view v-if="adressMoRen.username==undefined" class="addShouhuo" @click="toAddress()">
|
||||
<view v-if="adressMoRen.consigneeName==undefined" class="addShouhuo" @click="toAddress()">
|
||||
<u-icon name="plus" size="20" style="display: inline-block;margin-right: 10rpx;"></u-icon>
|
||||
请添加收货地址
|
||||
</view>
|
||||
<view class="adDefault" @click="dizhiShow = true" v-if="adressMoRen.username!=undefined">
|
||||
<view class="adDefault" @click="dizhiShow = true" v-if="adressMoRen.consigneeName!=undefined">
|
||||
<view class="defalTop">
|
||||
<text class="userName">
|
||||
{{adressMoRen.username}}
|
||||
{{adressMoRen.consigneeName}}
|
||||
</text>
|
||||
<text class="userTel">
|
||||
{{adressMoRen.userphone}}
|
||||
{{adressMoRen.consigneePhone}}
|
||||
</text>
|
||||
<text class="userMoren" v-if="adressMoRen.isdefault==1">
|
||||
<text class="userMoren" v-if="adressMoRen.isDefault==1">
|
||||
默认
|
||||
</text>
|
||||
</view>
|
||||
<view class="defalBottom">
|
||||
<text class="userAddress">
|
||||
{{adressMoRen.areaidpathtext}} {{adressMoRen.useraddress}}
|
||||
{{adressMoRen.province}} {{adressMoRen.city}} {{adressMoRen.county}} {{adressMoRen.useraddress}}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
@@ -137,12 +137,12 @@
|
||||
<view class="addrContent">
|
||||
<view class="addrContentTop">
|
||||
<view class="userName">
|
||||
{{item.username}}
|
||||
{{item.consigneeName}}
|
||||
</view>
|
||||
<view class="userTel">
|
||||
{{item.userphone}}
|
||||
{{item.consigneePhone}}
|
||||
</view>
|
||||
<view class="userMoren" v-if="item.isdefault==1">
|
||||
<view class="userMoren" v-if="item.isDefault==1">
|
||||
默认
|
||||
</view>
|
||||
<u-icon name="checkmark-circle-fill" class="chooseCheck" size="20" color="#fd6004"
|
||||
@@ -150,7 +150,8 @@
|
||||
</view>
|
||||
<view class="addrContentBottom">
|
||||
<view class="userAddress">
|
||||
{{item.areaidpathtext}} {{item.useraddress}}
|
||||
{{item.province}} {{item.city}} {{item.county}}
|
||||
{{item.useraddress}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -303,6 +304,7 @@
|
||||
// }
|
||||
this.getData()
|
||||
this.getOS()
|
||||
this.getUserAddress()
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
@@ -347,7 +349,8 @@
|
||||
// 获取地址列表
|
||||
getUserAddress() {
|
||||
this.$http
|
||||
.post(`book/useraddress/getUserAddress?userId=${this.userInfo.id}`)
|
||||
// .post(`book/useraddress/getUserAddress?userId=${this.userInfo.id}`)
|
||||
.post(`book/userAddress/getUserAddress?userId=${this.userInfo.id}`)
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.list.length != 0) {
|
||||
@@ -450,14 +453,18 @@
|
||||
let dataToString = ''
|
||||
// console.log(this.adressMoRen, '默认地址')
|
||||
this.cartList.forEach((item, index) => {
|
||||
key.push({productsid: item.productId, productAmount:item.productAmount})
|
||||
dataToString = dataToString.concat(item.productId+"="+item.productAmount+"&")
|
||||
key.push({productId: item.productId, quantity:item.productAmount})
|
||||
// dataToString = dataToString.concat(item.productId+"="+item.productAmount+"&")
|
||||
})
|
||||
console.log(this.adressMoRen.areaidpath,dataToString,'this.adressMoRen.areaidpath')
|
||||
console.log(key,'this.adressMoRen.areaidpath')
|
||||
|
||||
$http.request({
|
||||
url: "book/buyorder/getTransPrice/" + this.adressMoRen.areaidpath + "?" + dataToString,
|
||||
url: "book/buyOrder/calculateTransportPrice/",
|
||||
// url: "book/buyorder/getTransPrice/" + this.adressMoRen.areaidpath + "?" + dataToString,
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data:{
|
||||
'regionCode':this.adressMoRen.regionCode,
|
||||
'products':key,
|
||||
loadAnimate:'none', // 请求加载动画
|
||||
} ,
|
||||
header: { //默认 无 说明:请求头
|
||||
@@ -465,11 +472,11 @@
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.farePrice = res.price
|
||||
this.farePrice = res.result
|
||||
}else{
|
||||
this.farePrice = 0
|
||||
}
|
||||
console.log('需要的运费',res.price)
|
||||
console.log('需要的运费',res.result)
|
||||
this.allPrice()
|
||||
})
|
||||
},
|
||||
@@ -589,12 +596,14 @@
|
||||
let data = {
|
||||
buyType: this.typeId, //0- 商品页直接下单 1- 购物车结算
|
||||
userId: this.userInfo.id, //下单人ID
|
||||
shippingUser: this.adressMoRen.username, //收货人姓名
|
||||
userPhone: this.adressMoRen.userphone, //收货人手机号
|
||||
province: this.adressMoRen.areaidpathtext.split(' ')[0], //省
|
||||
city: this.adressMoRen.areaidpathtext.split(' ')[1], //市
|
||||
district: this.adressMoRen.areaidpathtext.split(' ')[2], //区
|
||||
address: this.adressMoRen.useraddress, //地址
|
||||
shippingUser: this.adressMoRen.consigneeName, //收货人姓名
|
||||
userPhone: this.adressMoRen.consigneePhone, //收货人手机号
|
||||
|
||||
// province: this.adressMoRen.areaidpathtext.split(' ')[0], //省
|
||||
// city: this.adressMoRen.areaidpathtext.split(' ')[1], //市
|
||||
// district: this.adressMoRen.areaidpathtext.split(' ')[2], //区
|
||||
//address: this.adressMoRen.useraddress, //地址
|
||||
|
||||
paymentMethod: this.payType, //支付方式 2支付宝,1微信,3ios内购 4,天医币购买
|
||||
orderMoney: this.totalPrice, //订单金额
|
||||
realMoney: this.realPrice, //实收金额
|
||||
@@ -606,11 +615,11 @@
|
||||
orderStatus: 0, //订单状态
|
||||
products: xiaBiao, //订单列表
|
||||
orderType: "order", //订单类型
|
||||
addressId:this.adressMoRen.addressid // 地址ID
|
||||
addressId:this.adressMoRen.id // 地址ID
|
||||
}
|
||||
$http.request({
|
||||
// url: "book/buyorder/save",
|
||||
url: "book/buyorder/buySave",
|
||||
url: "book/buyOrder/buySave",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
|
||||
Reference in New Issue
Block a user