|
|
@@ -7,12 +7,10 @@
|
|
|
height: 100%;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
-
|
|
|
.affirm-view {
|
|
|
flex: 1;
|
|
|
padding: 20px;
|
|
|
background-color: #f0f2f6;
|
|
|
-
|
|
|
.commodity-view {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
@@ -99,16 +97,15 @@
|
|
|
margin-bottom: 20px;
|
|
|
border-radius: 10px;
|
|
|
overflow: hidden;
|
|
|
- padding-top: 20rpx;
|
|
|
+ padding-top: 20rpx;
|
|
|
.ghs-msg{
|
|
|
padding: 0 20rpx 20rpx;
|
|
|
- // height: 60rpx;
|
|
|
- font-size: 28rpx;
|
|
|
+ font-size: 32rpx;
|
|
|
&.active{
|
|
|
color: #868686;
|
|
|
font-size: 24rpx;
|
|
|
}
|
|
|
- i{color: #62ed73;font-size: 32rpx}
|
|
|
+ i{color: #62ed73;font-size: 48rpx}
|
|
|
}
|
|
|
|
|
|
.member-wrap {
|
|
|
@@ -221,24 +218,39 @@
|
|
|
<!-- 登录信息 -->
|
|
|
<view class="module-com input-line-wrap">
|
|
|
|
|
|
+ <!--
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
<view class="tui-title ">送货</view>
|
|
|
<button @click="form.sendType=1" class="admin-button-com mini-btn" :class="form.sendType==1?'blue':'default'">配送</button>
|
|
|
<button @tap="form.sendType=2" class="admin-button-com mini-btn" :class="form.sendType==2?'blue':'default'">自取</button>
|
|
|
+ </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:400rpx;">
|
|
|
+ <view class="uni-input">{{sendTimeWant || '默认今天'}}</view>
|
|
|
+ </picker>
|
|
|
+
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <appTimer :placeholder="'默认30分钟后配送'" @confirm="onConfirm" :sendTime="sendTime"></appTimer>
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false" v-show="form.sendType == 1">
|
|
|
<view class="tui-title ">运费</view>
|
|
|
<input type="number" placeholder="" @input="countAllPrices" v-model="form.sendCost" placeholder-class="tui-placeholder" disabled>
|
|
|
</tui-list-cell>
|
|
|
- <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="toCoupon">
|
|
|
+
|
|
|
+ <!--
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="toCoupon">
|
|
|
<view class="tui-title ">红包/抵用券</view>
|
|
|
<view class="coupon_box">{{couponText}}</view>
|
|
|
</tui-list-cell>
|
|
|
+ -->
|
|
|
+
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
- <textarea style="height: 100rpx" v-model="remark" placeholder="备注"/>
|
|
|
+ <textarea style="height: 100rpx" v-model="remark" placeholder="这里写备注"/>
|
|
|
</tui-list-cell>
|
|
|
+
|
|
|
</view>
|
|
|
</form>
|
|
|
</view>
|
|
|
@@ -272,7 +284,7 @@ import appAddressGroup from "@/components/app-address-group";
|
|
|
import appFormSend from "@/components/app-form-send";
|
|
|
import appSendTime from "@/components/app-send-time";
|
|
|
const formUtil = require("@/utils/formValidation.js");
|
|
|
-// import { createOrder } from "@/api/order/index";
|
|
|
+import AppDatePicker from "@/components/app-date-picker";
|
|
|
import { getGhsDataApi } from "@/api/ghs/index";
|
|
|
import { freight,createOrder } from "@/api/purchase/index";
|
|
|
import { mapActions, mapGetters } from "vuex";
|
|
|
@@ -285,12 +297,13 @@ export default {
|
|
|
AppAvatarModule,
|
|
|
SimpleAddress,
|
|
|
AppAreaSel,
|
|
|
- appSendTime,
|
|
|
+ appSendTime,
|
|
|
AppCustomerSel,
|
|
|
appFormRadioBtn,
|
|
|
appAddressGroup,
|
|
|
appFormSend,
|
|
|
- appTimer
|
|
|
+ appTimer,
|
|
|
+ AppDatePicker
|
|
|
},
|
|
|
mixins: [productMins],
|
|
|
data() {
|
|
|
@@ -298,7 +311,7 @@ export default {
|
|
|
list:[],
|
|
|
autoLoad: false,
|
|
|
ghsMsg:'',
|
|
|
- sendTime:'',
|
|
|
+ sendTimeWant:'',
|
|
|
remark:'',
|
|
|
form: {
|
|
|
debt:1,//结算方式 1欠款订单 0正常订单
|
|
|
@@ -310,20 +323,20 @@ export default {
|
|
|
receiveAddress: "",
|
|
|
receiveLong: "",
|
|
|
receiveLat: "",
|
|
|
- sendType: 1,
|
|
|
+ sendType: 2,
|
|
|
sendSide: "2",
|
|
|
sendDate: "",
|
|
|
- sendTime: "",
|
|
|
+ sendTimeWant: "",
|
|
|
sendCost: "",
|
|
|
customId: "",
|
|
|
product: "",
|
|
|
- couponId: '0'
|
|
|
+ couponId: '0'
|
|
|
},
|
|
|
- // 详细地址
|
|
|
- // showRegion: false,
|
|
|
showCustomer: false,
|
|
|
- couponSumText: '',
|
|
|
- couponText: ''
|
|
|
+ couponSumText: '',
|
|
|
+ couponText: '',
|
|
|
+ today:'',
|
|
|
+ monthLater:''
|
|
|
};
|
|
|
},
|
|
|
onLoad(e) {
|
|
|
@@ -338,8 +351,8 @@ export default {
|
|
|
title: this.getMerchantInfo.name
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
this.getGhsData(e.id);
|
|
|
+
|
|
|
},
|
|
|
onShow() {
|
|
|
console.log(this.selectList,'selectList')
|
|
|
@@ -382,147 +395,147 @@ export default {
|
|
|
init() {
|
|
|
this._getDet();
|
|
|
},
|
|
|
- onConfirm(val) {
|
|
|
- this.sendTime = val
|
|
|
- },
|
|
|
- toPhone(phone){
|
|
|
- let amount = this.form.sendType == 1 ? this.allPrice+Number(this.form.sendCost) : this.allPrice
|
|
|
- uni.makePhoneCall({
|
|
|
- phoneNumber: phone
|
|
|
- });
|
|
|
- },
|
|
|
- toCoupon() {
|
|
|
- let amount = this.form.sendType == 1 ? this.numberAdd(this.allPrice, Number(this.form.sendCost)) : this.allPrice
|
|
|
- console.log(amount)
|
|
|
- this.pageTo({url: '/admin/coupon/selectCouponList?price=' + amount})
|
|
|
- },
|
|
|
- // 是否有可用优惠券、红包
|
|
|
- hasCoupon() {
|
|
|
- let amount = this.form.sendType == 1 ? this.numberAdd(this.allPrice, Number(this.form.sendCost)) : this.allPrice
|
|
|
- shopHouponHas({amount}).then(res => {
|
|
|
- console.log(377, res)
|
|
|
- this.couponText = res.data.has ? '有红包可用' : ''
|
|
|
- console.log(this.couponText)
|
|
|
- }).catch(err => {})
|
|
|
- },
|
|
|
- getGhsData(id) {
|
|
|
- getGhsDataApi({id:id}).then(res => {
|
|
|
- this.ghsMsg = res.data;
|
|
|
- console.log('res.data',this.ghsMsg)
|
|
|
- this.purchaseFreight(this.ghsMsg);
|
|
|
- });
|
|
|
- },
|
|
|
- countAllPrices(e){
|
|
|
- this.allPrices = this.allPrices+Number(this.form.sendCost)
|
|
|
- },
|
|
|
- _getDet() {
|
|
|
- let data = uni.getStorageSync("modifyShopB");
|
|
|
- if (this.$util.isEmpty(data)) return;
|
|
|
- Object.keys(this.form).forEach((i, index) => {
|
|
|
- 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,
|
|
|
- sendTime: this.sendTime,
|
|
|
- };
|
|
|
- freight(params).then(res => {
|
|
|
- this.form.sendCost = res.data.sedCost;
|
|
|
- });
|
|
|
- },
|
|
|
- confirmFn(options) {
|
|
|
- createOrder(options).then(res => {
|
|
|
- this.resetSelectInfoByType(this.pageType);
|
|
|
- const {
|
|
|
- data: { id, orderSn }
|
|
|
- } = res;
|
|
|
- let url = `/admin/billing/result?orderId=${id}&orderSn=${orderSn}`;
|
|
|
- uni.redirectTo({
|
|
|
- url: url,
|
|
|
- success: result => {},
|
|
|
- fail: () => {},
|
|
|
- complete: () => {}
|
|
|
+ bindDateChange(e){
|
|
|
+ let date = e.detail.value;
|
|
|
+ this.sendTimeWant = date
|
|
|
+ },
|
|
|
+ toPhone(phone){
|
|
|
+ let amount = this.form.sendType == 1 ? this.allPrice+Number(this.form.sendCost) : this.allPrice
|
|
|
+ uni.makePhoneCall({
|
|
|
+ phoneNumber: phone
|
|
|
});
|
|
|
- });
|
|
|
- },
|
|
|
- affirmFormSubmit(){
|
|
|
- const product = this.list.map(ele => {
|
|
|
- return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId };
|
|
|
- });
|
|
|
- let xj = uni.getStorageSync("ghsXj"+this.ghsMsg.id)
|
|
|
- let params = {
|
|
|
- getType:this.form.sendType,
|
|
|
- sendTime:this.sendTime,
|
|
|
- sendCost:this.form.sendType==2?'':this.form.sendCost,
|
|
|
- remark:this.remark,
|
|
|
- product:JSON.stringify(product),
|
|
|
- ghsId:this.ghsMsg.id,
|
|
|
- couponId: this.form.couponId,
|
|
|
- xj:JSON.stringify(xj)
|
|
|
- }
|
|
|
- let self = this;
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '确认提交?',
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- createOrder(params).then(res => {
|
|
|
- const {data: { orderSn,realPrice,count,hasDebtPay }} = res;
|
|
|
- self.pageTo({url: `/pagesPurchase/wechatPay?type=2&orderSn=${orderSn}&realPrice=${realPrice}&count=${count}&hasDebtPay=${hasDebtPay}`, type: 2})
|
|
|
- setTimeout(() => {
|
|
|
- uni.removeStorageSync('selectCouponInfo')
|
|
|
- self.resetSelectInfoByType(self.pageType);
|
|
|
- //删除小菊的记忆
|
|
|
- uni.removeStorageSync("ghsXj"+params.ghsId)
|
|
|
- }, 600)
|
|
|
- });
|
|
|
+ },
|
|
|
+ toCoupon() {
|
|
|
+ let amount = this.form.sendType == 1 ? this.numberAdd(this.allPrice, Number(this.form.sendCost)) : this.allPrice
|
|
|
+ console.log(amount)
|
|
|
+ this.pageTo({url: '/admin/coupon/selectCouponList?price=' + amount})
|
|
|
+ },
|
|
|
+ // 是否有可用优惠券、红包
|
|
|
+ hasCoupon() {
|
|
|
+ let amount = this.form.sendType == 1 ? this.numberAdd(this.allPrice, Number(this.form.sendCost)) : this.allPrice
|
|
|
+ shopHouponHas({amount}).then(res => {
|
|
|
+ this.couponText = res.data.has ? '有红包可用' : ''
|
|
|
+ console.log(this.couponText)
|
|
|
+ }).catch(err => {})
|
|
|
+ },
|
|
|
+ getGhsData(id) {
|
|
|
+ getGhsDataApi({id:id}).then(res => {
|
|
|
+ this.ghsMsg = res.data;
|
|
|
+ console.log('res.data',this.ghsMsg)
|
|
|
+ this.purchaseFreight(this.ghsMsg);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ countAllPrices(e){
|
|
|
+ this.allPrices = this.allPrices+Number(this.form.sendCost)
|
|
|
+ },
|
|
|
+ _getDet() {
|
|
|
+ let data = uni.getStorageSync("modifyShopB");
|
|
|
+ if (this.$util.isEmpty(data)) return;
|
|
|
+ Object.keys(this.form).forEach((i, index) => {
|
|
|
+ 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);
|
|
|
+ const {
|
|
|
+ data: { id, orderSn }
|
|
|
+ } = res;
|
|
|
+ let url = `/admin/billing/result?orderId=${id}&orderSn=${orderSn}`;
|
|
|
+ uni.redirectTo({
|
|
|
+ url: url,
|
|
|
+ success: result => {},
|
|
|
+ fail: () => {},
|
|
|
+ complete: () => {}
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ affirmFormSubmit(){
|
|
|
+ const product = this.list.map(ele => {
|
|
|
+ return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId };
|
|
|
+ });
|
|
|
+ let xj = uni.getStorageSync("ghsXj"+this.ghsMsg.id)
|
|
|
+ let params = {
|
|
|
+ getType:this.form.sendType,
|
|
|
+ sendTimeWant:this.sendTimeWant,
|
|
|
+ sendCost:this.form.sendType==2?'':this.form.sendCost,
|
|
|
+ remark:this.remark,
|
|
|
+ product:JSON.stringify(product),
|
|
|
+ ghsId:this.ghsMsg.id,
|
|
|
+ couponId: this.form.couponId,
|
|
|
+ xj:JSON.stringify(xj)
|
|
|
+ }
|
|
|
+ let self = this;
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认提交?',
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ createOrder(params).then(res => {
|
|
|
+ const {data: { orderSn,realPrice,count,hasDebtPay }} = res;
|
|
|
+ self.pageTo({url: `/pagesPurchase/wechatPay?type=2&orderSn=${orderSn}&realPrice=${realPrice}&count=${count}&hasDebtPay=${hasDebtPay}`, type: 2})
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.removeStorageSync('selectCouponInfo')
|
|
|
+ self.resetSelectInfoByType(self.pageType);
|
|
|
+ //删除小菊的记忆
|
|
|
+ uni.removeStorageSync("ghsXj"+params.ghsId)
|
|
|
+ }, 600)
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
+ });
|
|
|
+ },
|
|
|
+ numberAdd(arg1, arg2) {
|
|
|
+ var r1, r2, m, n;
|
|
|
+ try {
|
|
|
+ r1 = arg1.toString().split(".")[1].length
|
|
|
+ } catch (e) {
|
|
|
+ r1 = 0
|
|
|
}
|
|
|
- });
|
|
|
- },
|
|
|
- numberAdd(arg1, arg2) {
|
|
|
- var r1, r2, m, n;
|
|
|
- try {
|
|
|
- r1 = arg1.toString().split(".")[1].length
|
|
|
- } catch (e) {
|
|
|
- r1 = 0
|
|
|
- }
|
|
|
- try {
|
|
|
- r2 = arg2.toString().split(".")[1].length
|
|
|
- } catch (e) {
|
|
|
- r2 = 0
|
|
|
- }
|
|
|
- m = Math.pow(10, Math.max(r1, r2))
|
|
|
- n = (r1 >= r2) ? r1 : r2;
|
|
|
- return ((arg1 * m + arg2 * m) / m).toFixed(n);
|
|
|
- },
|
|
|
- NumberSub(arg1, arg2) {
|
|
|
- var re1, re2, m, n;
|
|
|
- try {
|
|
|
- re1 = arg1.toString().split(".")[1].length;
|
|
|
- } catch (e) {
|
|
|
- re1 = 0;
|
|
|
- }
|
|
|
- try {
|
|
|
- re2 = arg2.toString().split(".")[1].length;
|
|
|
- } catch (e) {
|
|
|
- re2 = 0;
|
|
|
- }
|
|
|
- m = Math.pow(10, Math.max(re1, re2));
|
|
|
- n = (re1 >= re2) ? re1 : re2;
|
|
|
- return ((arg1 * m - arg2 * m) / m).toFixed(n);
|
|
|
- },
|
|
|
+ try {
|
|
|
+ r2 = arg2.toString().split(".")[1].length
|
|
|
+ } catch (e) {
|
|
|
+ r2 = 0
|
|
|
+ }
|
|
|
+ m = Math.pow(10, Math.max(r1, r2))
|
|
|
+ n = (r1 >= r2) ? r1 : r2;
|
|
|
+ return ((arg1 * m + arg2 * m) / m).toFixed(n);
|
|
|
+ },
|
|
|
+ NumberSub(arg1, arg2) {
|
|
|
+ var re1, re2, m, n;
|
|
|
+ try {
|
|
|
+ re1 = arg1.toString().split(".")[1].length;
|
|
|
+ } catch (e) {
|
|
|
+ re1 = 0;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ re2 = arg2.toString().split(".")[1].length;
|
|
|
+ } catch (e) {
|
|
|
+ re2 = 0;
|
|
|
+ }
|
|
|
+ m = Math.pow(10, Math.max(re1, re2));
|
|
|
+ n = (re1 >= re2) ? re1 : re2;
|
|
|
+ return ((arg1 * m - arg2 * m) / m).toFixed(n);
|
|
|
+ },
|
|
|
// 表单验证
|
|
|
async formSubmit(e) {
|
|
|
try {
|
|
|
@@ -537,10 +550,6 @@ export default {
|
|
|
await this.initMerchantInfo();
|
|
|
}
|
|
|
formData.shopId = this.getMerchantInfo.id;
|
|
|
-
|
|
|
- console.log(9999, formData);
|
|
|
- // this.confirmFn(formData);
|
|
|
- // let rules = rules.concat(temp);
|
|
|
let checkRes = formUtil.validation(formData, []);
|
|
|
// 验证通过!
|
|
|
if (!checkRes) {
|