物流+下单+地址修改

This commit is contained in:
@fawn-nine
2023-10-18 17:03:48 +08:00
parent bd998074a3
commit 39ec8fdb34
14 changed files with 142 additions and 76 deletions

View File

@@ -86,7 +86,7 @@
this.deliverList = []
uni.showLoading()
this.$http
.post(`/book/buyorder/queryFMS?orderId=${this.orderId}`)
.post(`/book/buyOrder/queryFMS?orderId=${this.orderId}`)
.then(res => {
console.log(res, '物流信息')
if (res && res.code === 0) {

View File

@@ -500,7 +500,7 @@
if (res.confirm) {
uni.showLoading()
$http.request({
url: "book/buyorder/update",
url: "book/buyOrder/update",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
@@ -529,16 +529,16 @@
getOrderList() {
console.log('this.orderType',this.orderType)
this.$http
.post(`book/buyorder/appGetOrderInfo/${this.orderType}?orderId=${this.orderID}`)
.get(`book/buyOrder/getOrderInfo?orderId=${this.orderID}`)
.then(res => {
console.log('res+++',res)
var seconds = res.buyOrder.timestamp + 30 * 60 + 2 // 过期时间
console.log('订单详情',res)
var seconds = res.result.timestamp + 30 * 60 + 2 // 过期时间
var nowSeconds = Math.floor(new Date().getTime() / 1000);
res.buyOrder.overTime = seconds - nowSeconds
res.result.overTime = seconds - nowSeconds
this.orderContet = res.buyOrder
this.orderContet = res.result
this.userRecordid = res.userRecordid
this.productIDs = res.buyOrder.products.map(item => {
this.productIDs = res.result.products.map(item => {
return item.productId
})
// console.log(this.orderContet,'this.orderContet')
@@ -558,7 +558,7 @@
// 获取物流
getdeliverDetails() {
this.$http
.post(`/book/buyorder/queryFMS?orderId=${this.orderID}`)
.post(`/book/buyOrder/queryFMS?orderId=${this.orderID}`)
.then(res => {
if (res && res.code === 0) {
console.log(res, '物流信息')
@@ -587,7 +587,7 @@
success: res => {
if (res.confirm) {
this.$http
.post('book/buyorder/appDelete?orderId=' + this.orderContet.orderId)
.post('book/buyOrder/appDelete?orderId=' + this.orderContet.orderId)
.then(res => {
uni.showToast({
icon: 'none',

View File

@@ -189,7 +189,7 @@ import {
// 获取订单列表
getOrderList() {
this.$http
.post(`book/buyorder/appUserGetlist?userId=${this.userInfo.id}&orderStatus=${this.orderListTab}`)
.post(`book/buyOrder/getMyOrderList?userId=${this.userInfo.id}&orderStatus=${this.orderListTab}`)
.then(res => {
res.page.list.forEach((item,index) => {
var seconds = item.timestamp + 30 * 60 + 2 // 过期时间 30分钟+2
@@ -231,7 +231,7 @@ import {
success: res => {
if (res.confirm) {
this.$http
.post(`book/buyorder/appDelete?orderId=${e.orderId}`)
.post(`book/buyOrder/appDelete?orderId=${e.orderId}`)
.then(res => {
uni.showToast({
icon: 'none',

View File

@@ -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: { //默认 无 说明:请求头

View File

@@ -473,7 +473,7 @@
})
console.log(this.adressMoRen.areaidpath,dataToString,'this.adressMoRen.areaidpath')
$http.request({
url: "book/buyorder/getTransPrice/" + this.adressMoRen.areaidpath + "?" + dataToString,
url: "book/buyOrder/getTransPrice/" + this.adressMoRen.areaidpath + "?" + dataToString,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data:{
loadAnimate:'none', // 请求加载动画
@@ -627,7 +627,7 @@
}
$http.request({
// url: "book/buyorder/save",
url: "book/buyorder/buysave",
url: "book/buyOrder/buysave",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头