|
|
@@ -27,7 +27,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="summary-bar">
|
|
|
- <view class="operate-view" @click="gobackEvent">
|
|
|
+ <view class="operate-view" @click="modifyItem">
|
|
|
<text class="iconfont icongouwuche"></text>修改花材
|
|
|
</view>
|
|
|
<view class="describe-view">共{{ allCountFun.bigLength }}扎,合计 ¥<text class="price">{{ allPriceFun }}</text></view>
|
|
|
@@ -45,12 +45,9 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import productMins from "@/mixins/cgProduct";
|
|
|
-const formUtil = require("@/utils/formValidation.js");
|
|
|
-//import { freight,createOrder } from "@/api/purchase/index";
|
|
|
import { mapActions, mapGetters } from "vuex";
|
|
|
-import { shopHouponHas } from '@/api/coupon'
|
|
|
export default {
|
|
|
- name: "BillingAffirm", // 开单确认
|
|
|
+ name: "BillingAffirm",
|
|
|
components: {
|
|
|
},
|
|
|
mixins: [productMins],
|
|
|
@@ -63,7 +60,7 @@ export default {
|
|
|
sendTimeWant:'',
|
|
|
remark:'',
|
|
|
form: {
|
|
|
- debt:1,//结算方式 1欠款订单 0正常订单
|
|
|
+ debt:1,
|
|
|
shopId: "",
|
|
|
shopName: "",
|
|
|
receiveProvince: "",
|
|
|
@@ -78,19 +75,13 @@ export default {
|
|
|
sendTimeWant: "",
|
|
|
sendCost: "",
|
|
|
customId: "",
|
|
|
- product: "",
|
|
|
- hbId: '0'
|
|
|
+ product: ""
|
|
|
},
|
|
|
showCustomer: false,
|
|
|
today:'',
|
|
|
monthLater:'',
|
|
|
- modifyPrice:0,
|
|
|
- hasHb:0,
|
|
|
- selectedHb:{couponAmount:0,hbId:0,couponSelInx:0}
|
|
|
+ modifyPrice:0
|
|
|
};
|
|
|
- },
|
|
|
- onLoad(e) {
|
|
|
-
|
|
|
},
|
|
|
onShow() {
|
|
|
let selectList = this.$util.copyObject(this.selectList);
|
|
|
@@ -112,197 +103,42 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- this.list = list;
|
|
|
- if(this.selectedHb.hbId && this.selectedHb.hbId > 0) {
|
|
|
- this.form.hbId = this.selectedHb.hbId
|
|
|
- this.calcPrice()
|
|
|
- }else{
|
|
|
- this.form.hbId = 0
|
|
|
- this.hasCoupon()
|
|
|
- this.calcPrice()
|
|
|
- }
|
|
|
+ this.list = list
|
|
|
+ this.calcPrice()
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(["getMerchantInfo", "getLoginInfo"])
|
|
|
+ ...mapGetters(["getLoginInfo"])
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(["initMerchantInfo"]),
|
|
|
+ init(){
|
|
|
+
|
|
|
+ },
|
|
|
calcPrice(){
|
|
|
let allPrice = this.allPrice.toFixed(2)
|
|
|
this.modifyPrice = Number(allPrice)
|
|
|
- if(this.selectedHb.hbId && this.selectedHb.hbId > 0) {
|
|
|
- this.modifyPrice = (this.modifyPrice - Number(this.selectedHb.couponAmount)).toFixed(2)
|
|
|
- }
|
|
|
this.modifyPrice = parseFloat(this.modifyPrice)
|
|
|
},
|
|
|
- init() {
|
|
|
- this._getDet()
|
|
|
- },
|
|
|
- bindDateChange(e){
|
|
|
- let date = e.detail.value
|
|
|
- this.sendTimeWant = date
|
|
|
- },
|
|
|
- toPhone(phone){
|
|
|
- uni.makePhoneCall({
|
|
|
- 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 => {
|
|
|
- this.hasHb = res.data.has
|
|
|
- }).catch(err => {})
|
|
|
- },
|
|
|
- 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) {
|
|
|
+ confirmForm() {
|
|
|
+ let that = this
|
|
|
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: () => {}
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- confirmForm(){
|
|
|
- this.$msg('开发中')
|
|
|
- return false
|
|
|
- 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.ghsInfo.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.ghsInfo.id,
|
|
|
- hbId: this.form.hbId,
|
|
|
- xj:JSON.stringify(xj)
|
|
|
- }
|
|
|
- let self = this;
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '确认提交?',
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- uni.showLoading({title: '加载中',mask:true})
|
|
|
- createOrder(params).then(res => {
|
|
|
- if(res.code == 1){
|
|
|
- uni.hideLoading()
|
|
|
- const {orderSn,realPrice,id} = res.data
|
|
|
- self.pageTo({url: '/pagesPurchase/wechatPay',query:{orderSn,realPrice,id}, type: 2})
|
|
|
- setTimeout(() => {
|
|
|
- self.removeMemory(self.ghsInfo.id)
|
|
|
- }, 600)
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ let unitType = 0
|
|
|
+ let num = ele.bigCount
|
|
|
+ if(Number(ele.smallCount) > 0){
|
|
|
+ unitType = 1
|
|
|
+ num = (ele.smallCount/ele.ratio).toFixed(2)
|
|
|
}
|
|
|
+ return { productId: ele.id, num:num,ptItemId:ele.itemId,property:1,unitType:unitType,property:1};
|
|
|
});
|
|
|
- },
|
|
|
- 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);
|
|
|
- },
|
|
|
- // 表单验证
|
|
|
- async formSubmit(e) {
|
|
|
- try {
|
|
|
- // 进行表单检查
|
|
|
- let formData = this.form;
|
|
|
+ let params = { product: JSON.stringify(product) }
|
|
|
+ createOrder(params).then(res => {
|
|
|
+ if(res.code && res.code == 1){
|
|
|
|
|
|
- const product = this.selectList.map(ele => {
|
|
|
- return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount };
|
|
|
- });
|
|
|
- formData.product = JSON.stringify(product);
|
|
|
- if (!this.getMerchantInfo) {
|
|
|
- await this.initMerchantInfo();
|
|
|
- }
|
|
|
- formData.shopId = this.getMerchantInfo.id;
|
|
|
- let checkRes = formUtil.validation(formData, []);
|
|
|
- // 验证通过!
|
|
|
- if (!checkRes) {
|
|
|
- this.confirmFn(formData);
|
|
|
- } else {
|
|
|
- this.$msg(checkRes);
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
- console.log(999999, error);
|
|
|
- }
|
|
|
+ });
|
|
|
},
|
|
|
- gobackEvent() {
|
|
|
+ modifyItem() {
|
|
|
this.$msg('开发中')
|
|
|
- //this.$util.pageTo({url: "/pagesPurchase/ghsProduct",query: {id:this.options.id},type: 2})
|
|
|
}
|
|
|
}
|
|
|
};
|