Kirin 3 years ago
parent
commit
6585d440fa
1 changed files with 28 additions and 25 deletions
  1. 28 25
      app/admin/view/store/placeorder/index.php

+ 28 - 25
app/admin/view/store/placeorder/index.php

@@ -192,9 +192,10 @@
                                 <span class="no-shink mar-l-10">支付方式:</span>
                                 <span class="no-shink mar-l-10">支付方式:</span>
                                 <i-Select name="store_id" v-model="form.pay_type" default-label="微信" style="width: 80%"
                                 <i-Select name="store_id" v-model="form.pay_type" default-label="微信" style="width: 80%"
                                           filterable>
                                           filterable>
-<!--                                    <i-Option value="alipay">支付宝</i-Option>-->
-<!--                                    <i-Option value="weixin">微信</i-Option>-->
-                                    <i-Option value="jialie">嘉联支付</i-Option>-->
+                                    <!--                                    <i-Option value="alipay">支付宝</i-Option>-->
+                                    <!--                                    <i-Option value="weixin">微信</i-Option>-->
+                                    <i-Option value="jialie">嘉联支付</i-Option>
+                                    -->
                                     <i-Option value="yue">余额</i-Option>
                                     <i-Option value="yue">余额</i-Option>
                                     <i-Option value="integral">消费券</i-Option>
                                     <i-Option value="integral">消费券</i-Option>
                                     <!--                                    <i-Option value="consumer">消费券</i-Option>-->
                                     <!--                                    <i-Option value="consumer">消费券</i-Option>-->
@@ -253,7 +254,7 @@
                 //选中用户卡号
                 //选中用户卡号
                 checkedUserCard(e) {
                 checkedUserCard(e) {
                     const that = this;
                     const that = this;
-                    if (that.userCardInput.length == 12 || that.userCardInput.length == 15 || that.userCardInput.length == 8 || that.userCardInput.length == 11 || that.userCardInput== '1' ) {
+                    if (that.userCardInput.length == 12 || that.userCardInput.length == 15 || that.userCardInput.length == 8 || that.userCardInput.length == 11 || that.userCardInput == '1') {
                         //初始化用户数据
                         //初始化用户数据
                         that.userId = '';
                         that.userId = '';
                         that.userData = {}
                         that.userData = {}
@@ -330,7 +331,9 @@
                         if (item.num + pass * type > 0) {
                         if (item.num + pass * type > 0) {
                             item.num += pass * type;
                             item.num += pass * type;
                             //修改商品数量
                             //修改商品数量
-                            that.changeCartShop(item.cartId, item.num)
+                            that.changeCartShop(item.cartId, item.num).then(function (data) {
+                                console.log(data);
+                            })
                             layer.msg('成功' + (type > 0 ? '添加' : '减少') + pass + '件商品')
                             layer.msg('成功' + (type > 0 ? '添加' : '减少') + pass + '件商品')
                         } else {
                         } else {
                             layer.msg('商品数量不可小于0')
                             layer.msg('商品数量不可小于0')
@@ -340,21 +343,21 @@
                 //查询商品是否有库存
                 //查询商品是否有库存
                 getShopNum() {
                 getShopNum() {
                     const that = this;
                     const that = this;
-                    let num =0 ;
-                    let orderId=0;
-        
-                    if( that.shopId.length==13&&that.shopId.substr(0,2)=='20'){
-                        orderId = that.shopId.substr(2,5);
-                        num = (Math.floor(that.shopId.substr(7,6)/10)/1000).toFixed(3);
-                    }else{
+                    let num = 0;
+                    let orderId = 0;
+
+                    if (that.shopId.length == 13 && that.shopId.substr(0, 2) == '20') {
+                        orderId = that.shopId.substr(2, 5);
+                        num = (Math.floor(that.shopId.substr(7, 6) / 10) / 1000).toFixed(3);
+                    } else {
                         orderId = that.shopId;
                         orderId = that.shopId;
-                        num=1
+                        num = 1
                     }
                     }
                     that.shopId = '';
                     that.shopId = '';
                     $eb.axios.post('{:Url("getBarCode")}' + (orderId ? '?bar_code=' + orderId : '')).then(function (res) {
                     $eb.axios.post('{:Url("getBarCode")}' + (orderId ? '?bar_code=' + orderId : '')).then(function (res) {
                         console.log(res);
                         console.log(res);
                         const data = res.data.data;
                         const data = res.data.data;
-                        console.log(data,'返回数据')
+                        console.log(data, '返回数据')
                         if (that.is_consumer != data.is_consumer) {
                         if (that.is_consumer != data.is_consumer) {
                             if (that.is_consumer == 1) {
                             if (that.is_consumer == 1) {
                                 layer.msg('请选择消费券商品', {icon: 5})
                                 layer.msg('请选择消费券商品', {icon: 5})
@@ -365,7 +368,7 @@
                         } else {
                         } else {
                             console.log(res, '开始调用购物车');
                             console.log(res, '开始调用购物车');
                             //添加到购物车
                             //添加到购物车
-                            that.addCart(data,num)
+                            that.addCart(data, num)
                         }
                         }
                         that.$nextTick(function () {
                         that.$nextTick(function () {
                             that.$refs.code.focus();
                             that.$refs.code.focus();
@@ -375,7 +378,7 @@
                     })
                     })
                 },
                 },
                 //添加购物车
                 //添加购物车
-                addCart(product,num=1) {
+                addCart(product, num = 1) {
                     const that = this
                     const that = this
                     console.log('开始添加购物车');
                     console.log('开始添加购物车');
 
 
@@ -408,7 +411,7 @@
 
 
                             } else {
                             } else {
                                 //初始化商品
                                 //初始化商品
-                                that.initShopData(product, cartId,num)
+                                that.initShopData(product, cartId, num)
                                 console.log(that.shopList, '初始化后数据对象')
                                 console.log(that.shopList, '初始化后数据对象')
                             }
                             }
                         } else {
                         } else {
@@ -420,8 +423,8 @@
                     })
                     })
                 },
                 },
                 //初始化购物车商品
                 //初始化购物车商品
-                initShopData(product, cartId,num) {
-                    const that = this;              
+                initShopData(product, cartId, num) {
+                    const that = this;
                     that.shopList = ([{
                     that.shopList = ([{
                         name: product.store_name,//商品
                         name: product.store_name,//商品
                         num: num,//购物车中的数量
                         num: num,//购物车中的数量
@@ -431,7 +434,7 @@
                         unique: product.unique,//商品规格id
                         unique: product.unique,//商品规格id
                         image: product.image,//商品主图
                         image: product.image,//商品主图
                         price: product.price,//商品价格
                         price: product.price,//商品价格
-                        is_consumer:product.is_consumer//商品类型
+                        is_consumer: product.is_consumer//商品类型
                     }]).concat(that.shopList);
                     }]).concat(that.shopList);
                     console.log(this, '初始化后this对象')
                     console.log(this, '初始化后this对象')
                     //初始化该商品为1
                     //初始化该商品为1
@@ -471,7 +474,7 @@
                     try {
                     try {
 
 
                         //提交数据
                         //提交数据
-                        let  pushData = {
+                        let pushData = {
                             cartId: pusharr.join(','),
                             cartId: pusharr.join(','),
                             uid: that.userId
                             uid: that.userId
                         }
                         }
@@ -479,11 +482,11 @@
                         let res = await $eb.axios.post('{:Url("confirm")}', pushData);
                         let res = await $eb.axios.post('{:Url("confirm")}', pushData);
                         const orderKey = res.data.data.orderKey;
                         const orderKey = res.data.data.orderKey;
                         let money = await that.computedOrder(orderKey);
                         let money = await that.computedOrder(orderKey);
-                        layer.confirm('订单总金额:¥' + that.allPayMoney.toFixed(2) + '<br/> vip优惠:¥' + ((that.allPayMoney - money.data.data.result.pay_price)>0?(that.allPayMoney - money.data.data.result.pay_price).toFixed(2):0) + '<br/> 实际支付:¥' + money.data.data.result.pay_price.toFixed(2), {
+                        layer.confirm('订单总金额:¥' + that.allPayMoney.toFixed(2) + '<br/> vip优惠:¥' + ((that.allPayMoney - money.data.data.result.pay_price) > 0 ? (that.allPayMoney - money.data.data.result.pay_price).toFixed(2) : 0) + '<br/> 实际支付:¥' + money.data.data.result.pay_price.toFixed(2), {
                             btn: ['立即支付', '取消'] //按钮
                             btn: ['立即支付', '取消'] //按钮
                         }, async function (index) {
                         }, async function (index) {
                             layer.close(index);
                             layer.close(index);
-                            try{
+                            try {
                                 //微信
                                 //微信
                                 // if (that.form.pay_type == 'weixin') {
                                 // if (that.form.pay_type == 'weixin') {
                                 //     let qr = await that.weixinPay();
                                 //     let qr = await that.weixinPay();
@@ -511,7 +514,7 @@
                                     that.create(orderKey, qr)
                                     that.create(orderKey, qr)
                                 }
                                 }
 
 
-                            }catch (e) {
+                            } catch (e) {
                                 console.log(e);
                                 console.log(e);
                             }
                             }
 
 
@@ -568,7 +571,7 @@
                         payType: that.form.pay_type//支付方式
                         payType: that.form.pay_type//支付方式
                     };
                     };
                     //判断是否需要传入code码
                     //判断是否需要传入code码
-                    if(qr){
+                    if (qr) {
                         data.auth_code = qr;
                         data.auth_code = qr;
                     }
                     }
                     //提交订单
                     //提交订单