|
|
@@ -53,22 +53,44 @@
|
|
|
|
|
|
<view class="module-com input-line-wrap">
|
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false" :arrow="true">
|
|
|
- <view class="tui-title ">配送时间</view>
|
|
|
- <picker mode="date" :value="sendTimeWant" @change="bindDateChange" style="width:400upx;">
|
|
|
- <view class="uni-input">{{sendTimeWant || '今天'}}</view>
|
|
|
- </picker>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="false" >
|
|
|
+ <button class="admin-button-com big" :class="[form.sendType == 1 ? 'blue' : 'default']" style="width:230upx;" @click="form.sendType = 1">自取</button>
|
|
|
+ <button class="admin-button-com big" :class="[form.sendType == 3 ? 'blue' : 'default']" style="width:230upx;" @click="form.sendType = 3">跑腿</button>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
+ <view v-if="form.sendType == 1">
|
|
|
+ <text style="color: #3385FF;width:100%;">出车有经过或到店拿货的花店,免运费,请选【自取】</text>
|
|
|
+ </view>
|
|
|
+ <view v-else>
|
|
|
+ <text style="width:100%;color:#CCCCCC;">使用跑腿,需要配送费</text>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="true" v-if="form.sendType == 3" @click="modifyAddress">
|
|
|
+ <view class="tui-title">地址</view>
|
|
|
+ <view v-if="!$util.isEmpty(shopInfo.lat) && !$util.isEmpty(shopInfo.long)">
|
|
|
+ <view><text>{{shopInfo.fullAddress}}</text></view>
|
|
|
+ <view><text>{{shopInfo.showAddress}}</text></view>
|
|
|
+ </view>
|
|
|
+ <input v-else v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" @focus="form.name=''" placeholder="请完善门店地址" maxlength="50" type="text" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell v-if="hasHb == 1" class="line-cell" :hover="false" :arrow="true" @click="goSelectCoupon">
|
|
|
- <view class="tui-title ">红包</view>
|
|
|
- <view class="coupon_box"><text class="selected" v-if="selectedHb.hbId && selectedHb.hbId>0">-{{selectedHb.couponAmount}}</text><text class="has-hb" v-else>有红包</text></view>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" v-if="form.sendType == 3 && Number(form.sendCost)>0">
|
|
|
+ <view class="tui-title">运费</view>
|
|
|
+ <text style="color: #3385FF">¥{{ form.sendCost }}</text>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
|
|
|
<view class="tui-title">总金额</view>
|
|
|
- <text style="color: #3385FF">{{ modifyPrice }}</text>
|
|
|
+ <text style="color: #3385FF">¥{{ modifyPrice }}</text>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="true">
|
|
|
+ <view class="tui-title ">配送时间</view>
|
|
|
+ <picker mode="date" :value="sendTimeWant" @change="bindDateChange" style="width:400upx;">
|
|
|
+ <view class="uni-input">{{sendTimeWant || '今天'}}</view>
|
|
|
+ </picker>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
@@ -118,9 +140,10 @@ import appSendTime from "@/components/app-send-time";
|
|
|
const formUtil = require("@/utils/formValidation.js");
|
|
|
import AppDatePicker from "@/components/app-date-picker";
|
|
|
import { getGhsDataApi } from "@/api/ghs/index";
|
|
|
-import { freight,createOrder } from "@/api/purchase/index";
|
|
|
+import { freight,createOrder } from "@/api/purchase";
|
|
|
import { mapActions, mapGetters } from "vuex";
|
|
|
import { shopHouponHas } from '@/api/coupon'
|
|
|
+import {currentShop} from "@/api/shop"
|
|
|
import ModalModule from "@/components/plugin/modal";
|
|
|
export default {
|
|
|
name: "BillingAffirm", // 开单确认
|
|
|
@@ -158,11 +181,11 @@ export default {
|
|
|
receiveAddress: "",
|
|
|
receiveLong: "",
|
|
|
receiveLat: "",
|
|
|
- sendType: 2,
|
|
|
+ sendType: 1,
|
|
|
sendSide: "2",
|
|
|
sendDate: "",
|
|
|
sendTimeWant: "",
|
|
|
- sendCost: "",
|
|
|
+ sendCost: 0,
|
|
|
customId: "",
|
|
|
product: "",
|
|
|
hbId: '0'
|
|
|
@@ -175,6 +198,13 @@ export default {
|
|
|
customData: {
|
|
|
bigCount: 0,
|
|
|
smallCount: 0
|
|
|
+ },
|
|
|
+ sendData:{},
|
|
|
+ shopInfo:{
|
|
|
+ lat:'',
|
|
|
+ long:'',
|
|
|
+ fullAddress:'',
|
|
|
+ showAddress:''
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
@@ -188,18 +218,30 @@ export default {
|
|
|
this.form.hbId = 0
|
|
|
this.hasCoupon()
|
|
|
}
|
|
|
+
|
|
|
+ //计算运费
|
|
|
+ this.calcFreight()
|
|
|
+
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(["getMerchantInfo", "getLoginInfo"]),
|
|
|
modifyPrice(){
|
|
|
let allPrice = this.allPrice.toFixed(2)
|
|
|
let price = Number(allPrice)
|
|
|
+
|
|
|
+ if(this.form.sendType == 3){
|
|
|
+ price = price + this.form.sendCost
|
|
|
+ }
|
|
|
+
|
|
|
price = parseFloat(price)
|
|
|
return price
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(["initMerchantInfo"]),
|
|
|
+ modifyAddress(){
|
|
|
+ this.$util.pageTo({ url: '/admin/shop/add?id='+this.getLoginInfo.admin.currentShopId})
|
|
|
+ },
|
|
|
customUpdate(item) {
|
|
|
if(item.variety == 0){
|
|
|
if(item.stock<=0){
|
|
|
@@ -285,7 +327,42 @@ export default {
|
|
|
|
|
|
},
|
|
|
init() {
|
|
|
- this._getDet()
|
|
|
+ this.getDetailData()
|
|
|
+
|
|
|
+ currentShop().then(res=>{
|
|
|
+ let that = this
|
|
|
+ if(res.code == 1){
|
|
|
+ that.shopInfo = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //计算运费
|
|
|
+ this.calcFreight()
|
|
|
+ },
|
|
|
+ calcFreight() {
|
|
|
+ let weight = 0
|
|
|
+ if(!this.$util.isEmpty(this.selectList)){
|
|
|
+ this.selectList.forEach((item,idx,arr) => {
|
|
|
+ if(Number(item.bigCount)>0){
|
|
|
+ let add = Number(item.weight)*Number(item.bigCount)
|
|
|
+ weight = Number(weight) + Number(add)
|
|
|
+ }else{
|
|
|
+ let unitWeight = item.weight/item.ratio
|
|
|
+ let add = Number(unitWeight)*Number(item.smallCount)
|
|
|
+ weight = Number(weight) + Number(add)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ weight = Number(weight).toFixed(2)
|
|
|
+
|
|
|
+ let params = {
|
|
|
+ ghsId: this.options.id,
|
|
|
+ weight:weight
|
|
|
+ };
|
|
|
+ freight(params).then(res => {
|
|
|
+ if(res.code == 1){
|
|
|
+ this.form.sendCost = res.data.fee?parseFloat(res.data.fee):0
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
addEvents(item) {
|
|
|
if(item.variety == 0){
|
|
|
@@ -321,12 +398,6 @@ export default {
|
|
|
phoneNumber: phone
|
|
|
});
|
|
|
},
|
|
|
- goSelectCoupon() {
|
|
|
- let amount = this.form.sendType == 1 ? this.numberAdd(this.allPrice, Number(this.form.sendCost)) : this.allPrice
|
|
|
- let query = {amount:amount,ghsId:this.option.id,...this.selectedHb}
|
|
|
- this.pageTo({url: '/admin/coupon/selectCouponList',query:query})
|
|
|
- },
|
|
|
- // 是否有可用红包
|
|
|
hasCoupon() {
|
|
|
let amount = this.allPrice
|
|
|
shopHouponHas({amount:amount,ghsId:this.option.id}).then(res => {
|
|
|
@@ -341,7 +412,7 @@ export default {
|
|
|
countAllPrices(e){
|
|
|
this.allPrices = this.allPrices+Number(this.form.sendCost)
|
|
|
},
|
|
|
- _getDet() {
|
|
|
+ getDetailData() {
|
|
|
let data = uni.getStorageSync("modifyShopB")
|
|
|
if (this.$util.isEmpty(data)){
|
|
|
return
|
|
|
@@ -350,25 +421,6 @@ export default {
|
|
|
this.form[i] = data[i];
|
|
|
});
|
|
|
},
|
|
|
- purchaseFreight(info) {
|
|
|
- const product = this.selectList.map(ele => {
|
|
|
- return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId };
|
|
|
- });
|
|
|
- let params = {
|
|
|
- ghsId: this.options.id,
|
|
|
- product: JSON.stringify(product),
|
|
|
- province: info.province,
|
|
|
- city:info.city,
|
|
|
- address:info.address,
|
|
|
- floor:info.floor,
|
|
|
- long: info.long,
|
|
|
- lat: info.lat,
|
|
|
- sendTimeWant: this.sendTimeWant,
|
|
|
- };
|
|
|
- freight(params).then(res => {
|
|
|
- this.form.sendCost = res.data.sedCost;
|
|
|
- });
|
|
|
- },
|
|
|
confirmFn(options) {
|
|
|
createOrder(options).then(res => {
|
|
|
this.resetSelectInfoByType(this.pageType);
|
|
|
@@ -386,7 +438,7 @@ export default {
|
|
|
},
|
|
|
affirmFormSubmit(){
|
|
|
const product = this.selectList.map(ele => {
|
|
|
- return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId };
|
|
|
+ return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId,weight:ele.weight };
|
|
|
})
|
|
|
|
|
|
let xj = []
|
|
|
@@ -398,9 +450,10 @@ export default {
|
|
|
})
|
|
|
|
|
|
let params = {
|
|
|
- getType:this.form.sendType,
|
|
|
+ getType:this.form.sendType == 1 ? 2 : 1,
|
|
|
sendTimeWant:this.sendTimeWant,
|
|
|
- sendCost:this.form.sendType==2?'':this.form.sendCost,
|
|
|
+ sendCost:this.form.sendCost,
|
|
|
+ sendType:this.form.sendType,
|
|
|
remark:this.remark,
|
|
|
product:JSON.stringify(product),
|
|
|
ghsId:this.ghsInfo.id,
|
|
|
@@ -486,7 +539,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
gobackEvent() {
|
|
|
- this.$util.pageTo({url: "/pagesPurchase/ghsProduct",query: {id:this.options.id},type: 2})
|
|
|
+ this.$util.pageTo({url: "/pagesPurchase/ghsProduct?id="+this.options.id,type: 2})
|
|
|
}
|
|
|
}
|
|
|
};
|