|
|
@@ -135,7 +135,7 @@
|
|
|
<script>
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import productMins from "@/mixins/cgProduct";
|
|
|
-import { buyItem,freight } from "@/api/order"
|
|
|
+import { buyItem,freight,newFreight } from "@/api/order"
|
|
|
import { currentInfo } from "@/api/user"
|
|
|
// import { mapActions, mapGetters } from "vuex";
|
|
|
export default {
|
|
|
@@ -164,12 +164,7 @@ export default {
|
|
|
showAddress:'',
|
|
|
hasMap:0
|
|
|
},
|
|
|
- userInfo:{
|
|
|
- lat:'',
|
|
|
- long:'',
|
|
|
- fullAddress:'',
|
|
|
- showAddress:''
|
|
|
- },
|
|
|
+ userInfo:{},
|
|
|
timeOptions: [
|
|
|
['00', '01', '02','03','04','05','06','07','08','09','10','11','12','13', '14','15','16','17','18','19','20','21','22','23'],
|
|
|
['00', '05', '10','15','20','25','30','35','40','45','50','55']
|
|
|
@@ -239,8 +234,9 @@ export default {
|
|
|
that.userInfo = res.data.info
|
|
|
that.form.province = that.userInfo.province
|
|
|
that.form.city = that.userInfo.city
|
|
|
- that.form.floor = that.userInfo.floor
|
|
|
+ that.form.dist = that.userInfo.dist
|
|
|
that.form.address = that.userInfo.address
|
|
|
+ that.form.floor = that.userInfo.floor
|
|
|
that.form.long = that.userInfo.long
|
|
|
that.form.lat = that.userInfo.lat
|
|
|
that.form.showAddress = that.userInfo.showAddress
|
|
|
@@ -280,9 +276,29 @@ export default {
|
|
|
that.form.sendCost = 0
|
|
|
return
|
|
|
}
|
|
|
- freight({weight:weight,lat:that.userInfo.lat,long:that.userInfo.long}).then(res => {
|
|
|
+ // freight({weight:weight,lat:that.userInfo.lat,long:that.userInfo.long}).then(res => {
|
|
|
+ // if(res.code == 1){
|
|
|
+ // that.form.sendCost = res.data.fee?parseFloat(Number(res.data.fee)):0
|
|
|
+ // }
|
|
|
+ // }).catch(()=>{});
|
|
|
+ // newFreight
|
|
|
+ let packageNum = that.allCountFun && that.allCountFun.bigLength ? Number(that.allCountFun.bigLength) : 1
|
|
|
+ let cargoName = '花材'
|
|
|
+ let newFreightParams = {
|
|
|
+ cargo_name: cargoName,
|
|
|
+ price: that.allPriceFun,
|
|
|
+ weight: weight,
|
|
|
+ package_num: packageNum,
|
|
|
+ user_lng: that.userInfo.long,
|
|
|
+ user_lat: that.userInfo.lat,
|
|
|
+ user_name: that.userInfo.name || that.userInfo.realName || '',
|
|
|
+ user_phone: that.userInfo.mobile || that.userInfo.phone || '',
|
|
|
+ user_address: that.userInfo.province + that.userInfo.city + that.userInfo.dist + that.userInfo.address + that.userInfo.floor
|
|
|
+ }
|
|
|
+ newFreight(newFreightParams).then(res => {
|
|
|
+ console.log('newFreight',res)
|
|
|
if(res.code == 1){
|
|
|
- that.form.sendCost = res.data.fee?parseFloat(Number(res.data.fee)):0
|
|
|
+ that.form.sendCost = res.data.est_fee?parseFloat(Number(res.data.est_fee/100)):0
|
|
|
}
|
|
|
}).catch(()=>{});
|
|
|
},
|
|
|
@@ -307,12 +323,24 @@ export default {
|
|
|
uni.showLoading({mask:true})
|
|
|
buyItem(params).then(res => {
|
|
|
uni.hideLoading()
|
|
|
- this.removeMemory()
|
|
|
if(res.code && res.code == 1){
|
|
|
let account = this.option.account ? this.option.account : 0
|
|
|
- this.$util.pageTo({ url: "/pages/callback/pay", type: 2, query: { pageStatus: 1, ...res.data,hdId:hdId,account:account } })
|
|
|
+ let totalPrice = Number(res.data.totalPrice) + Number(this.form.sendCost)
|
|
|
+
|
|
|
+ if (Math.abs(totalPrice - this.modifyPrice) < 0.001) {
|
|
|
+ res.data.totalPrice = totalPrice
|
|
|
+ }else{
|
|
|
+ this.$msg('运费计算错误')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$util.pageTo({ url: "/pages/callback/pay", type: 2, query: { pageStatus: 1, ...res.data, hdId: hdId, account: account } })
|
|
|
}
|
|
|
- });
|
|
|
+ this.removeMemory()
|
|
|
+ }).catch((e)=>{
|
|
|
+ console.log('buyItem error: ', e)
|
|
|
+ uni.hideLoading()
|
|
|
+ this.removeMemory()
|
|
|
+ })
|
|
|
},
|
|
|
modifyItem() {
|
|
|
let account = this.option.account ? this.option.account : 0
|