Jelajahi Sumber

Merge branch 'master' of http://18.167.157.193:1026/guanli/ngds

kevin_zhangl 3 tahun lalu
induk
melakukan
b3079c706d

+ 2 - 1
frontendApi/modules/v1/controllers/ShopController.php

@@ -309,6 +309,7 @@ class ShopController extends BaseController {
         foreach ($data['list'] as &$value) {
             $value['TAX_AMOUNT'] = Tool::calculateTax($value['REAL_PRICE'], floatval($value['TAX_RATE']), intval($value['BUY_NUMS']));
             $value['STATUS'] = \Yii::$app->params['orderStatus'][$value['STATUS']]['label'] ?? '';
+            $value['CREATED_AT'] = $value['CREATED_AT'] ? Date::convert($value['CREATED_AT'],'Y-m-d H:i:s') : '';
         }
 
         return static::notice($data);
@@ -486,7 +487,7 @@ class ShopController extends BaseController {
         $uname = Info::getUserNameByUserId(\Yii::$app->user->id);
         $orderSn = \Yii::$app->request->get('orderSn');
 
-        $condition = " AND (USER_ID=:USER_ID OR CREATE_USER='$uname') AND SN=:SN";
+        $condition = " AND ORDER_TYPE='FX' AND (USER_ID=:USER_ID OR CREATE_USER='$uname') AND SN=:SN";
         $params = [
             ':USER_ID' => \Yii::$app->user->id,
             ':SN' => $orderSn,

+ 1 - 1
frontendEle/src/views/config/receive-address-edit.vue

@@ -33,7 +33,7 @@
         <el-form-item prop="areaSelected">
           <template slot="label">
             <span class="text-danger">*</span>
-            region<!-- 地区 -->
+            State<!-- 地区 -->
           </template>
           <el-cascader
             size="large"

+ 6 - 5
frontendEle/src/views/shop/dec-order-list.vue

@@ -16,11 +16,12 @@
                 <el-table-column width="150" label="Shipping Address" prop="ADDRESS"></el-table-column><!--收货地址-->
                 <el-table-column width="120" label="Sponsor code" prop="CON_USER_NAME"></el-table-column><!--接点人编号-->
                 <el-table-column width="120" label="Status" prop="STATUS"></el-table-column><!--状态-->
-                <el-table-column width="150" label="Created time"><!--创建时间-->
-                    <template slot-scope="scope">
-                        {{tool.formatDate(scope.row.CREATED_AT)}}
-                    </template>
-                </el-table-column >
+<!--                <el-table-column width="150" label="Created time">&lt;!&ndash;创建时间&ndash;&gt;-->
+<!--                    <template slot-scope="scope">-->
+<!--                        {{tool.formatDate(scope.row.CREATED_AT)}}-->
+<!--                    </template>-->
+<!--                </el-table-column >-->
+                <el-table-column width="150" label="Created time" prop="CREATED_AT"></el-table-column >
                 <el-table-column width="120" label="Action"><!--操作-->
                     <template slot-scope="scope">
                         <el-button type="primary" size="small" @click.native="handleOrderExportPDF(scope.row.ORDER_SN)">Export PDF</el-button><!--导出PDF-->

+ 345 - 351
frontendEle/src/views/shop/order.vue

@@ -128,8 +128,6 @@
                         </div>
                     </div>
 
-
-
                     <div v-if="category_type === 5">
                         <div class="sum_box">
                             <div>Car House bonus</div><!-- 名车积分 -->
@@ -140,9 +138,8 @@
                 </div>
 
                 <div>
-
+                    <el-button type="danger" @click="cancelOrder()">Go Back</el-button>
                     <el-button type="primary" @click="goToAccounts()" :loading="submitButtonStat">Pay</el-button><!--去结算-->
-
                 </div>
               </div>
           </div>
@@ -194,356 +191,353 @@
 </template>
 
 <script>
- import network from '@/utils/network'
- import tool from '@/utils/tool'
- import userInfo from '@/utils/userInfo'
- import { PAY_STACK_PUBLIC_KEY, PAY_STACK_CURRENCY } from '@/utils/config'
- import paystack from 'vue-paystack'
-
-    export default{
-        name:'order',
-        data(){
-            return{
-                loading: true,
-                goods:[],
-                payList:[],
-                all_address:[],
-                balance:{},
-                addressId:'',
-                payType:'',
-                payTypeId: '',
-                pointsSum:'',
-                cashSum:'',
-                freight:'',
-                pointFreight:'',
-                freeShipping: '',
-                goodsId:'',
-                goodsNum:'',
-                payPassword:'',
-                submitButtonStat:false,
-                category_type: '',
-                prefixSign: '₦',
-                unit: 'NGN',
-                sn: '',
-                payDialog: false,
-                countdown: 5,
-                visible: false,
-                payStackLoading: false,
-                form: {
-                    publicKey: PAY_STACK_PUBLIC_KEY,
-                    currency: PAY_STACK_CURRENCY,
-                    firstname: userInfo.userName(),
-                    lastname: '',
-                    email: userInfo.userEmail(),
-                    amount: 0,  // kobo
-                    orderSn: '',
-                    metadata: {
-                        cart_id: this.sn,
-                        custom_fields: [
-                            {
-                                display_name: 'orderSn',
-                                variable_name: 'orderSn',
-                                value: this.sn
-                            },
-                        ]
-                    },
-                },
-            }
-        },
-        components: {
-            paystack
-        },
-        async created(){
-            let option= sessionStorage.getItem('order_goods');
-            this.category_type = parseInt(sessionStorage.getItem('category_type'))
-            await this.getShowCart();
-            if(option){
-                let pageGoodsList=JSON.parse(option);
-                // console.log(pageGoodsList);
-                let pageList;
-                for( let i in pageGoodsList ) {
-                    pageList =  pageGoodsList[i];
-                    if (!pageList) continue;
-
-                    pageList.map((pageData, index)=>{
-                        if( Number(pageData.chose_num) > 0 ) {
-                            let discount = pageData.DISCOUNT / 100;
-                            pageData.member_price = Math.round(pageData.SELL_PRICE * discount * 100) / 100;
-                            pageData.member_price_plus = Math.round(pageData.SELL_PRICE * Number(pageData.chose_num) * discount * 100) / 100;
-
-                            pageData.member_pv = Math.round(pageData.PRICE_PV * discount * 100) / 100;
-                            pageData.member_pv_plus = Math.round(pageData.PRICE_PV * Number(pageData.chose_num) * discount * 100) / 100;
-
-                            pageData.tax_amount_plus = Math.round((pageData.member_price - pageData.member_price / (1 + pageData.TAX_RATE / 100)) * pageData.chose_num * 100) / 100;
-
-                            this.goods.push(pageData)
-                        }
-                    })
-                }
-
-                await this.getSumMoney();
-            }
-        },
-        computed: {
-            reference() {
-                let text = "";
-                let possible =
-                    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-                for (let i = 0; i < 10; i++)
-                    text += possible.charAt(Math.floor(Math.random() * possible.length));
-                return text;
-            }
-        },
-        methods:{
-            cancelOrder(){
-              history.go(-1)
-            },
-            setFreight() {
-                //如果地址为自提,则运费为0
-                if (this.addressId == '100000000000000000') {
-                    this.pointFreight = Number(0)
-                } else {
-                    this.pointFreight = Number(this.freight)
-                }
-            },
-            getSummaries(param) {
-              const { columns, data } = param;
-              const sums = [];
-              columns.forEach((column, index) => {
-                if (index === 0) {
-                  sums[index] = 'Total';// 合计
-                  return;
-                }
-                const values = data.map(item => Number(item[column.property]));
-                if ((!values.every(value => isNaN(value))) && [5, 6, 7, 8].includes(index)) {
-                  sums[index] = values.reduce((prev, curr) => {
-                    const value = Number(curr);
-                    if (!isNaN(value)) {
-                      return Math.round((prev + curr) * 100) / 100;
-                    } else {
-                      return Math.round(prev * 100) / 100;
-                    }
-                  }, 0);
-                }
-              });
-
-              return sums;
-            },
-            goToAccounts(){
-                let amountBalance = 0
-                // 前置判断余额是否够支付
-                if (this.category_type === 1) {
-                    if (this.payType === 'cash') {
-                        amountBalance = this.balance.cash
-                    } else if (this.payType === 'exchange') {
-                        amountBalance = this.balance.exchange
-                    }
-                } else if (this.category_type === 4) {
-                    amountBalance = this.balance.tourism_points
-                } else if (this.category_type === 5) {
-                    amountBalance = this.balance.garage_points
-                }
-
-                // 提示信息
-                let tips = 'Ecoin' //余额
-                if (this.payType !== 'cash' && this.payType !== 'pay_stack') {
-                    let payObj = this.payList.find((item) => {
-                        return item.label === this.payType
-                    })
-                    tips = (payObj.length <= 0) ? '' : payObj.name
-                }
-
-                // 余额是否充足
-                if ((amountBalance > 0) && (this.payType !== 'pay_stack') && ((amountBalance - this.cashSum) < 0)) {
-                    let tips = this.payList[this.payType] ? this.payList[this.payType].label : 'Ecoin'
-                    this.$message({
-                        message: tips + ' insufficient, unable to buy products', // 不足,无法购买商品
-                        type: 'error'
-                    })
-                    this.submitButtonStat = false
-                    return false
-                }
-
-                this.submitButtonStat = true
-                // let path = 'sure-order'
-                this.$prompt('Please enter your payment password', 'Hint', {//'请输入支付密码', '提示'
-                    confirmButtonText: 'Confirm',//确定
-                    cancelButtonText: 'Cancel',//取消
-                    inputType: 'password',
-                    inputPattern: /\S+/,
-                    inputErrorMessage: 'Please enter your payment password'//请输入支付密码
-                }).then(({value}) => {
-                    this.payPassword = value
-                    let params = {
-                        addressId: this.addressId,
-                        payType: this.payType,
-                        goodsId: this.goodsId,
-                        goodsNum: this.goodsNum,
-                        payPassword: this.payPassword,
-                        email: this.form.email,
-                    }
-
-                    // PayStack支付
-                    if (this.payType === 'pay_stack') {
-                        return network.postData('shop/sure-approach-order', params).then((response) => {
-                            this.submitButtonStat = false
-
-                            this.form.orderSn = response.SN
-                            this.form.amount = this.cashSum
-                            this.form.metadata.custom_fields[0].value = response.SN
-                            this.visible = true
-                        }).catch(() => {
-                            this.submitButtonStat = true
-                        })
-                    } else {
-                        // 非PayStack支付
-                        return network.postData('shop/sure-order', params).then(() => {
-                            this.submitButtonStat = false
-                                this.$router.push({path: `/shop/order-list`})
-                        }).catch(() => {
-                            this.submitButtonStat = true
-                        })
-                    }
-                }).catch(() => {
-                    this.submitButtonStat = false
-                })
-            },
-            getSumMoney(){
-                // let points_plus_sum=[];
-                let cash_plus_sum=[];
-                let goodsId=[];
-                let goodsNum=[];
-                let choseNum = 0;
-                this.goods.map((item,index)=>{
-                    choseNum = Number(item.chose_num);
-                    if( choseNum > 0 ) {
-                        // points_plus_sum.push(item.SELL_PRICE * choseNum);
-                        cash_plus_sum.push(item.SELL_PRICE * choseNum*(item.DISCOUNT/100));
-                        goodsId.push(item.ID);
-                        goodsNum.push(choseNum);
-                    }
-                })
-                this.goodsNum=goodsNum;
-                this.goodsId=goodsId;
-                //增加运费03-12yuan
-                let payAmount = tool.sum(cash_plus_sum);
-                // let payPointAmount = tool.sum(points_plus_sum);
-
-                // 只有普通商品有运费
-                if (this.category_type === 1) {
-                    // 商品自提,免运费
-                    this.setFreight();
-                    // 商品总价大于预定值,免运费
-                    this.pointFreight = (this.pointFreight > 0) ? ((payAmount >= this.freeShipping) ? 0 : this.freight) : 0
-                } else {
-                    // 非普通商品,没有运费
-                    this.pointFreight = 0
-                }
-                // if(payPointAmount>=300){
-                //     this.pointFreight = 0;
-                // }else{
-                //     this.pointFreight = 15;
-                // }
-                //console.log('points_plus_sum',points_plus_sum);
-                //console.log('cash_plus_sum',cash_plus_sum);
-                // this.pointsSum=tool.formatPrice(tool.sum(points_plus_sum) + this.pointFreight);
-              this.pointsSum = this.cashSum = this.form.amount = tool.formatPrice(tool.sum(cash_plus_sum) + this.pointFreight) ;
-            },
-            async getShowCart() {
-                await network.getData('shop/show-cart', {categoryType: this.categoryType}).then(response => {
-                    this.loading = false
-                    // 收货地址
-                    this.all_address = response.allAddress;
-                    this.all_address.map((item, index) => {
-                      if (item.IS_DEFAULT == 1) {
-                        this.addressId = item.ID
-                      }
-                    })
-                    // 账户
-                    this.balance = response.userBalance
-
-                    // 支付方式
-                    for (let item of response.sellType) {
-                      if (item.id === this.category_type) {
-                        this.payList = item.sell_type
-                        break
-                      }
-                    }
-
-                    // 支付方式的第一项默认选中
-                    this.payType = Object.values(this.payList)[0]['label']
-                    // 免运费阈值
-                    this.freeShipping = response.freeShipping
-                    // 运费
-                    this.freight = response.freight
-                })
-            },
-            // 切换支付方式
-            chosePayType(type) {
-                this.payType = type
-            },
-            choseAddress(addressId){
-                this.addressId = addressId
-                this.setFreight()
-                this.getSumMoney()
-            },
-            // 关闭支付回调
-            handleClose() {
-                let _this = this
-                _this.$confirm('Confirm to close?').then(() => {
-                    return network.postData('shop/delete-approach-order', {orderSn: this.form.orderSn}).then(() => {
-                        // 关闭支付模态框
-                        _this.visible = false
-                        // 关闭购物车页面,返回到订单列表页
-                        sessionStorage.setItem('order_goods', null)
-                        sessionStorage.setItem('category_type', null)
-                        this.$router.push({path: `/shop/index`})
-                    })
-                }).catch(() => {
-                    // 关闭支付模态框
-                    _this.visible = false
-                    // 关闭购物车页面,返回到订单列表页
-                    sessionStorage.setItem('order_goods', null)
-                    sessionStorage.setItem('category_type', null)
-                    this.$router.push({path: `/shop/index`})
-                })
-            },
-            // 支付成功回调
-            processPayment(response) {
-                // 关闭支付页面
-                this.visible = false
-                this.payStackLoading = false
-
-                // 显示支付成功模态框
-                this.payDialog = true
-                this.handleCountdown()
-            },
-            // 关闭支付回调
-            processClose() {
-                // 关闭支付模态框
-                this.visible = false
-                // 关闭购物车页面,返回到订单列表页
-                sessionStorage.removeItem('order_goods')
-                sessionStorage.removeItem('category_type')
-                this.$router.push({path: `/shop/index`})
-            },
-            handleOrderList() {
-                this.$router.push({path: `/shop/order-list`})
-            },
-            // 启动倒计时
-            handleCountdown() {
-                //创建定时器
-                setInterval(() => {
-                    // 每隔1秒把time的值减一,赋值给span标签
-                    this.countdown--
-                    if (this.countdown === 0) {
-                        // 倒计时结束,跳转到订单列表
-                        this.$router.push({path: `/shop/order-list`})
-                    }
-                }, 1000)
+import network from '@/utils/network'
+import tool from '@/utils/tool'
+import userInfo from '@/utils/userInfo'
+import { PAY_STACK_PUBLIC_KEY, PAY_STACK_CURRENCY } from '@/utils/config'
+import paystack from 'vue-paystack'
+
+export default{
+  name: 'order',
+  data (){
+    return {
+      loading: true,
+      goods: [],
+      payList: [],
+      all_address: [],
+      balance: {},
+      addressId: '',
+      payType: '',
+      payTypeId: '',
+      pointsSum: '',
+      cashSum: '',
+      freight: '',
+      pointFreight: '',
+      freeShipping: '',
+      goodsId: '',
+      goodsNum: '',
+      payPassword: '',
+      submitButtonStat: false,
+      category_type: '',
+      prefixSign: '₦',
+      unit: 'NGN',
+      sn: '',
+      payDialog: false,
+      countdown: 5,
+      visible: false,
+      payStackLoading: false,
+      form: {
+        publicKey: PAY_STACK_PUBLIC_KEY,
+        currency: PAY_STACK_CURRENCY,
+        firstname: userInfo.userName(),
+        lastname: '',
+        email: userInfo.userEmail(),
+        amount: 0, // kobo
+        orderSn: '',
+        metadata: {
+          cart_id: this.sn,
+          custom_fields: [
+            {
+              display_name: 'orderSn',
+              variable_name: 'orderSn',
+              value: this.sn
             },
+          ]
         },
+      },
+    }
+  },
+  components: {
+    paystack
+  },
+  async created () {
+    let option = sessionStorage.getItem('order_goods');
+    this.category_type = parseInt(sessionStorage.getItem('category_type'))
+    await this.getShowCart();
+    if (option){
+      let pageGoodsList = JSON.parse(option);
+      // console.log(pageGoodsList);
+      let pageList;
+      for ( let i in pageGoodsList ) {
+        pageList = pageGoodsList[i];
+        if (!pageList) continue;
+
+        pageList.map((pageData, index) => {
+          if (Number(pageData.chose_num) > 0) {
+            let discount = pageData.DISCOUNT / 100;
+            pageData.member_price = Math.round(pageData.SELL_PRICE * discount * 100) / 100;
+            pageData.member_price_plus = Math.round(pageData.SELL_PRICE * Number(pageData.chose_num) * discount * 100) / 100;
+            pageData.member_pv = Math.round(pageData.PRICE_PV * discount * 100) / 100;
+            pageData.member_pv_plus = Math.round(pageData.PRICE_PV * Number(pageData.chose_num) * discount * 100) / 100;
+            pageData.tax_amount_plus = Math.round((pageData.member_price - pageData.member_price / (1 + pageData.TAX_RATE / 100)) * pageData.chose_num * 100) / 100;
+            this.goods.push(pageData)
+          }
+        })
+      }
+
+      await this.getSumMoney();
+    }
+  },
+  computed: {
+    reference () {
+      let text = '';
+      let possible =
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+      for (let i = 0; i < 10; i++)
+        text += possible.charAt(Math.floor(Math.random() * possible.length));
+      return text;
     }
+  },
+  methods:{
+    cancelOrder(){
+      history.go(-1)
+    },
+    setFreight () {
+      // 如果地址为自提,则运费为0
+      if (this.addressId == '100000000000000000') {
+        this.pointFreight = Number(0)
+      } else {
+        this.pointFreight = Number(this.freight)
+      }
+    },
+    getSummaries (param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = 'Total'; // 合计
+          return;
+        }
+        const values = data.map(item => Number(item[column.property]));
+        if ((!values.every(value => isNaN(value))) && [5, 6, 7, 8].includes(index)) {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return Math.round((prev + curr) * 100) / 100;
+            } else {
+              return Math.round(prev * 100) / 100;
+            }
+          }, 0);
+        }
+      });
+
+      return sums;
+    },
+    goToAccounts () {
+      let amountBalance = 0
+      // 前置判断余额是否够支付
+      if (this.category_type === 1) {
+        if (this.payType === 'cash') {
+          amountBalance = this.balance.cash
+        } else if (this.payType === 'exchange') {
+          amountBalance = this.balance.exchange
+        }
+      } else if (this.category_type === 4) {
+        amountBalance = this.balance.tourism_points
+      } else if (this.category_type === 5) {
+        amountBalance = this.balance.garage_points
+      }
+
+      // 提示信息
+      let tips = 'Ecoin' // 余额
+      if (this.payType !== 'cash' && this.payType !== 'pay_stack') {
+        let payObj = this.payList.find((item) => {
+          return item.label === this.payType
+        })
+        tips = (payObj.length <= 0) ? '' : payObj.name
+      }
+
+      // 余额是否充足
+      if ((amountBalance > 0) && (this.payType !== 'pay_stack') && ((amountBalance - this.cashSum) < 0)) {
+        let tips = this.payList[this.payType] ? this.payList[this.payType].label : 'Ecoin'
+        this.$message({
+          message: tips + ' insufficient, unable to buy products', // 不足,无法购买商品
+          type: 'error'
+        })
+        this.submitButtonStat = false
+        return false
+      }
+
+      this.submitButtonStat = true
+      // let path = 'sure-order'
+      this.$prompt('Please enter your payment password', 'Hint', {//'请输入支付密码', '提示'
+        confirmButtonText: 'Confirm',//确定
+        cancelButtonText: 'Cancel',//取消
+        inputType: 'password',
+        inputPattern: /\S+/,
+        inputErrorMessage: 'Please enter your payment password'//请输入支付密码
+      }).then(({value}) => {
+        this.payPassword = value
+        let params = {
+          addressId: this.addressId,
+          payType: this.payType,
+          goodsId: this.goodsId,
+          goodsNum: this.goodsNum,
+          payPassword: this.payPassword,
+          email: this.form.email,
+        }
+
+        // PayStack支付
+        if (this.payType === 'pay_stack') {
+          return network.postData('shop/sure-approach-order', params).then((response) => {
+            this.submitButtonStat = false
+
+            this.form.orderSn = response.SN
+            this.form.amount = this.cashSum
+            this.form.metadata.custom_fields[0].value = response.SN
+            this.visible = true
+          }).catch(() => {
+            this.submitButtonStat = true
+          })
+        } else {
+          // 非PayStack支付
+          return network.postData('shop/sure-order', params).then(() => {
+            this.submitButtonStat = false
+            this.$router.push({path: `/shop/order-list`})
+          }).catch(() => {
+            this.submitButtonStat = true
+          })
+        }
+      }).catch(() => {
+        this.submitButtonStat = false
+      })
+    },
+    getSumMoney () {
+      // let points_plus_sum=[];
+      let cash_plus_sum = [];
+      let goodsId = [];
+      let goodsNum = [];
+      let choseNum = 0;
+      this.goods.map((item,index)=> {
+        choseNum = Number(item.chose_num);
+        if (choseNum > 0) {
+          // points_plus_sum.push(item.SELL_PRICE * choseNum);
+          cash_plus_sum.push(item.SELL_PRICE * choseNum * (item.DISCOUNT / 100));
+          goodsId.push(item.ID);
+          goodsNum.push(choseNum);
+        }
+      })
+      this.goodsNum = goodsNum;
+      this.goodsId = goodsId;
+      // 增加运费03-12yuan
+      let payAmount = tool.sum(cash_plus_sum);
+      // let payPointAmount = tool.sum(points_plus_sum);
+
+      // 只有普通商品有运费
+      if (this.category_type === 1) {
+        // 商品自提,免运费
+        this.setFreight();
+        // 商品总价大于预定值,免运费
+        this.pointFreight = (this.pointFreight > 0) ? ((payAmount >= this.freeShipping) ? 0 : this.freight) : 0
+      } else {
+        // 非普通商品,没有运费
+        this.pointFreight = 0
+      }
+      // if(payPointAmount>=300){
+      //     this.pointFreight = 0;
+      // }else{
+      //     this.pointFreight = 15;
+      // }
+      // console.log('points_plus_sum',points_plus_sum);
+      // console.log('cash_plus_sum',cash_plus_sum);
+      // this.pointsSum=tool.formatPrice(tool.sum(points_plus_sum) + this.pointFreight);
+      this.pointsSum = this.cashSum = this.form.amount = tool.formatPrice(tool.sum(cash_plus_sum) + this.pointFreight) ;
+    },
+    async getShowCart () {
+      await network.getData('shop/show-cart', {categoryType: this.categoryType}).then(response => {
+        this.loading = false
+        // 收货地址
+        this.all_address = response.allAddress;
+        this.all_address.map((item, index) => {
+          if (item.IS_DEFAULT == 1) {
+            this.addressId = item.ID
+          }
+        })
+        // 账户
+        this.balance = response.userBalance
+
+        // 支付方式
+        for (let item of response.sellType) {
+          if (item.id === this.category_type) {
+            this.payList = item.sell_type
+            break
+          }
+        }
+
+        // 支付方式的第一项默认选中
+        this.payType = Object.values(this.payList)[0]['label']
+        // 免运费阈值
+        this.freeShipping = response.freeShipping
+        // 运费
+        this.freight = response.freight
+      })
+    },
+    // 切换支付方式
+    chosePayType (type) {
+      this.payType = type
+    },
+    choseAddress (addressId) {
+      this.addressId = addressId
+      this.setFreight()
+      this.getSumMoney()
+    },
+    // 关闭支付回调
+    handleClose () {
+      let _this = this
+      _this.$confirm('Confirm to close?').then(() => {
+        return network.postData('shop/delete-approach-order', {orderSn: this.form.orderSn}).then(() => {
+          // 关闭支付模态框
+          _this.visible = false
+          // 关闭购物车页面,返回到订单列表页
+          sessionStorage.setItem('order_goods', null)
+          sessionStorage.setItem('category_type', null)
+          this.$router.push({path: `/shop/index`})
+        })
+      }).catch(() => {
+        // 关闭支付模态框
+        _this.visible = false
+        // 关闭购物车页面,返回到订单列表页
+        sessionStorage.setItem('order_goods', null)
+        sessionStorage.setItem('category_type', null)
+        this.$router.push({path: `/shop/index`})
+      })
+    },
+    // 支付成功回调
+    processPayment (response) {
+      // 关闭支付页面
+      this.visible = false
+      this.payStackLoading = false
+
+      // 显示支付成功模态框
+      this.payDialog = true
+      this.handleCountdown()
+    },
+    // 关闭支付回调
+    processClose () {
+      // 关闭支付模态框
+      this.visible = false
+      // 关闭购物车页面,返回到订单列表页
+      sessionStorage.removeItem('order_goods')
+      sessionStorage.removeItem('category_type')
+      this.$router.push({path: `/shop/index`})
+    },
+    handleOrderList () {
+      this.$router.push({path: `/shop/order-list`})
+    },
+    // 启动倒计时
+    handleCountdown () {
+      // 创建定时器
+      setInterval(() => {
+        // 每隔1秒把time的值减一,赋值给span标签
+        this.countdown--
+        if (this.countdown === 0) {
+          // 倒计时结束,跳转到订单列表
+          this.$router.push({path: `/shop/order-list`})
+        }
+      }, 1000)
+    },
+  },
+}
 </script>
 
 <style scoped>