物流+下单+地址修改
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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: { //默认 无 说明:请求头
|
||||
|
||||
@@ -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: { //默认 无 说明:请求头
|
||||
|
||||
@@ -727,11 +727,20 @@
|
||||
// 说点什么
|
||||
goToSign() {
|
||||
// images数据处理
|
||||
var imgs = []
|
||||
imgs = this.formData.images.map(item => {
|
||||
return item.url
|
||||
if(this.formData.images.length > 0){
|
||||
var imgs = []
|
||||
imgs = this.formData.images.map(item => {
|
||||
return item.url
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
if(this.formData.content == ''){
|
||||
uni.showToast({
|
||||
title: '请输入内容',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
let data = {
|
||||
// 'bookId': this.bookid,
|
||||
"userId": this.userInfo.id,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<view>
|
||||
<text class="name" v-if="userMes.nickname!=null">{{userMes.nickname}}</text>
|
||||
<text class="name" v-if="userMes.nickname==null">未设置</text>
|
||||
<image v-if="userMes.vip==1" src="../../static/icon/mine_v.png" alt="" class="per_user_img"></image>
|
||||
<!-- <image v-if="userMes.vip==1" src="../../static/icon/mine_v.png" alt="" class="per_user_img"></image> -->
|
||||
<text style="margin-left: 20rpx;font-size: 22rpx;color: #888;">({{userMes.tel}})</text>
|
||||
|
||||
<!-- <text class="tong">累计读书5本
|
||||
@@ -89,7 +89,7 @@
|
||||
<!-- <view class="nav_list" @click="onGoing()">
|
||||
<text>帮助与反馈11111</text>
|
||||
</view> -->
|
||||
<view class="nav_list" @click="newOnShare">
|
||||
<view class="nav_list" @click="newOnShare" v-if="isAndorid">
|
||||
<text>分享App</text>
|
||||
</view>
|
||||
<view class="nav_list" @click="onPageJump('../peanut/aboutUs')">
|
||||
@@ -131,13 +131,15 @@
|
||||
userMes: {},
|
||||
signShow: false,
|
||||
signContent: '是否要退出登录?',
|
||||
playData:{}
|
||||
playData:{},
|
||||
isAndorid:true,
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
onLoad(e) {
|
||||
// 隐藏原生的tabbar
|
||||
uni.hideTabBar();
|
||||
this.getOS()
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo'])
|
||||
@@ -153,6 +155,17 @@
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
// 获得操作系统
|
||||
getOS(){
|
||||
let oprateOs = ''
|
||||
oprateOs = uni.getSystemInfoSync().platform
|
||||
// console.log(oprateOs)
|
||||
if(oprateOs == 'android'){
|
||||
this.isAndorid = true
|
||||
}else{
|
||||
this.isAndorid = false
|
||||
}
|
||||
},
|
||||
haveSelected(data){
|
||||
console.log(data,' 选择的是')
|
||||
if(data.index == 0){
|
||||
|
||||
@@ -288,7 +288,7 @@
|
||||
orderType: "vip", //订单类型
|
||||
}
|
||||
$http.request({
|
||||
url: "book/buyorder/rechargeSave",
|
||||
url: "book/buyOrder/rechargeSave",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
|
||||
@@ -401,7 +401,7 @@
|
||||
productId: that.stepsCj.priceTypeId // 充值的类型id
|
||||
}
|
||||
$http.request({
|
||||
url: "book/buyorder/rechargeSave",
|
||||
url: "book/buyOrder/rechargeSave",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头1
|
||||
|
||||
@@ -359,7 +359,7 @@
|
||||
orderType: "point", //订单类型
|
||||
}
|
||||
$http.request({
|
||||
url: "book/buyorder/rechargeSave",
|
||||
url: "book/buyOrder/rechargeSave",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头1
|
||||
|
||||
@@ -270,7 +270,7 @@
|
||||
this.addressForm.areaidpathtext = e.value[0].UName + ' ' + e.value[1].UName + ' ' + e.value[2].UName
|
||||
this.provId = e.value[0].provId
|
||||
this.cityId = e.value[1].cityId
|
||||
this.countyId = e.value[2].countyId
|
||||
this.countyId = e.value[2].regionCode
|
||||
},
|
||||
|
||||
addcancel() { //点击取消按钮
|
||||
@@ -284,9 +284,9 @@
|
||||
.then(res => {
|
||||
let link_add = ''
|
||||
if (!this.isShowDel) {
|
||||
link_add = 'book/useraddress/save'
|
||||
link_add = 'book/userAddress/save'
|
||||
} else {
|
||||
link_add = 'book/useraddress/update'
|
||||
link_add = 'book/userAddress/update'
|
||||
// this.addconfirm(e)
|
||||
}
|
||||
if (this.addressForm.areaidpath == '') {
|
||||
@@ -296,15 +296,30 @@
|
||||
});
|
||||
return
|
||||
}
|
||||
this.addressForm.userid = this.userInfo.id
|
||||
if(this.addressChanged){ // 如果修改过地址区域,就重新赋值,否则保持不变
|
||||
this.addressForm.areaidpath = `${this.provId}_${this.cityId}_${this.countyId}`
|
||||
this.addressChanged = false
|
||||
}
|
||||
this.addressForm.areaid = this.countyId
|
||||
this.addressForm.isdefault = this.addressForm.isDafault ? 1 : 0
|
||||
// this.addressForm.userId = this.userInfo.id
|
||||
// this.addressForm.consigneePhone = this.addressForm.userphone
|
||||
// this.addressForm.consigneeName = this.addressForm.username
|
||||
// this.addressForm.regionCode = ''
|
||||
|
||||
// // this.addressForm.userid = this.userInfo.id
|
||||
// if(this.addressChanged){ // 如果修改过地址区域,就重新赋值,否则保持不变
|
||||
// this.addressForm.areaidpath = `${this.provId}_${this.cityId}_${this.countyId}`
|
||||
// this.addressChanged = false
|
||||
// }
|
||||
// this.addressForm.areaid = this.countyId
|
||||
// this.addressForm.isDefault = this.addressForm.isDafault ? 1 : 0
|
||||
|
||||
let data = this.addressForm
|
||||
// let data = this.addressForm
|
||||
let data = {
|
||||
'id':this.addressForm.addressid,
|
||||
'detailAddress' : this.addressForm.useraddress,
|
||||
'regionCode':this.countyId,
|
||||
'userId':this.userInfo.id,
|
||||
'consigneePhone':this.addressForm.userphone,
|
||||
'consigneeName': this.addressForm.username,
|
||||
'isDefault':this.addressForm.isDafault ? 1 : 0
|
||||
}
|
||||
console.log(data,'保存参数')
|
||||
$http.request({
|
||||
url: link_add,
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
@@ -315,7 +330,7 @@
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: '地址添加成功',
|
||||
title: '操作成功',
|
||||
duration: 1000,
|
||||
});
|
||||
setTimeout(function() {
|
||||
@@ -334,17 +349,28 @@
|
||||
},
|
||||
|
||||
changeSwitch(e) {
|
||||
e ? this.addressForm.isdefault = 1 : this.addressForm.isdefault = 0
|
||||
this.addressForm.isDafault = e
|
||||
console.log(this.addressForm)
|
||||
console.log(this.addressForm, e)
|
||||
},
|
||||
|
||||
// 编辑地址获取信息
|
||||
getAddress() {
|
||||
this.$http
|
||||
.post(`book/useraddress/getUserAddress?userId=${this.userInfo.id}`)
|
||||
.post(`book/userAddress/getUserAddress?userId=${this.userInfo.id}`)
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
this.addressForm = res.list[this.editIndex]
|
||||
this.addressForm = {
|
||||
'useraddress':res.list[this.editIndex].detailAddress,
|
||||
'userphone':res.list[this.editIndex].consigneePhone,
|
||||
'username':res.list[this.editIndex].consigneeName,
|
||||
'isdefault':res.list[this.editIndex].isDefault,
|
||||
'isDafault':res.list[this.editIndex].isDefault == 1 ? true : false,
|
||||
'areaidpathtext':res.list[this.editIndex].province + res.list[this.editIndex].city + res.list[this.editIndex].county
|
||||
,'addressid':res.list[this.editIndex].id
|
||||
}
|
||||
this.countyId = res.list[this.editIndex].regionCode
|
||||
// this.addressForm = res.list[this.editIndex]
|
||||
if (this.addressForm.isdefault == 1) {
|
||||
this.addressForm.isDafault = true
|
||||
}
|
||||
|
||||
@@ -10,18 +10,19 @@
|
||||
<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>
|
||||
</view>
|
||||
<view class="addrContentBottom">
|
||||
<view class="userAddress">
|
||||
{{item.areaidpathtext}} {{item.useraddress}}
|
||||
{{item.province}} {{item.city}} {{item.county}}
|
||||
{{item.detailAddress}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -63,7 +64,8 @@
|
||||
methods: {
|
||||
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) {
|
||||
this.addressList = res.list
|
||||
|
||||
Reference in New Issue
Block a user