瀏覽代碼

feat: NC-7: 微信支付、区分国内海外商品

Tyler 1 年之前
父節點
當前提交
eb62542667

+ 1 - 0
frontendEle/package.json

@@ -71,6 +71,7 @@
     "postcss-import": "^11.0.0",
     "postcss-loader": "^2.0.8",
     "postcss-url": "^7.2.1",
+    "qrcode": "^1.5.3",
     "rimraf": "^2.6.0",
     "selenium-server": "^3.0.1",
     "semver": "^5.3.0",

+ 1 - 1
frontendEle/src/utils/network.js

@@ -100,7 +100,7 @@ const network = {
           // 更新本地userInfo
           userInfo.userId(response.ID)
           userInfo.userName(response.USER_NAME)
-          userInfo.baseData({AVATAR: response.AVATAR,VERIFIED: response.VERIFIED,DEC_LV: response.DEC_LV,EMP_LV: response.EMP_LV,PROVINCE: response.PROVINCE,CITY: response.CITY,COUNTY: response.COUNTY})
+          userInfo.baseData({AVATAR: response.AVATAR,VERIFIED: response.VERIFIED,DEC_LV: response.DEC_LV,EMP_LV: response.EMP_LV,PROVINCE: response.PROVINCE,CITY: response.CITY,COUNTY: response.COUNTY, IS_STUDIO: response.IS_STUDIO, })
           // 成功
           resolve(response)
         }).catch(error => {

+ 2 - 0
frontendEle/src/views/dashboard/index.vue

@@ -15,6 +15,7 @@
                   v-for="(o,key) in parseInt(myEmpLv['ICON_NUM'])"
                   :key="key" v-if="myEmpLv['ICON_TYPE']>0">
               </el-col>
+              <el-col v-if="isStudio" :xs="24" :sm="24" :md="24" :lg="4" :xl="12">是否店铺:{{isStudio}}</el-col>
               <el-col :xs="24" :sm="24" :md="24" :lg="4" :xl="12">会员级别:{{decLvName}}</el-col>
               <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">当前业绩期:{{periodNum}}</el-col>
 <!--              <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">剩余PV:{{myRemainPv}}</el-col>&lt;!&ndash;剩余的PV&ndash;&gt;-->
@@ -124,6 +125,7 @@
         myRemainPv: '',
         activeEnd: '',
         bannerHeight: '',
+        isStudio: userInfo.baseData().IS_STUDIO === '1' ? '是' : '否',
       }
     },
     computed: {

+ 19 - 1
frontendEle/src/views/shop/index.vue

@@ -1,5 +1,11 @@
 <template>
     <div v-loading="loading">
+      <div class="radio">
+        <el-radio-group v-model="cateId" @change="cateIdChange">
+          <el-radio :label="1">国内商品</el-radio>
+          <el-radio :label="2">海外商品</el-radio>
+        </el-radio-group>
+      </div>
         <div class="white-box">
             <el-table v-if="numList.length > 0" class="withdraw-table" :data="tableData" stripe style="width: 100%;" ref="multipleTable"
              @selection-change="handleSelectionChange">
@@ -77,6 +83,7 @@ export default {
                 numList: [],
                 selectLock:false,
                 cate: [],
+                cateId: 1,
             }
         },
         watch: {
@@ -92,6 +99,11 @@ export default {
           // })
         },
         methods: {
+            cateIdChange(val){
+              if(val){
+                this.getData(this.currentPage, this.pageSize)
+              }
+            },
             handleChange(val){
                 console.log(val);
             },
@@ -209,7 +221,10 @@ export default {
             },*/
             getData (page, pageSize) {
                 let obj = this
-                network.getPageData(this, `shop/index`, page, pageSize, this.filterData, function (response) {
+                let filterData = {
+                  cateId: obj.cateId
+                }
+                network.getPageData(this, `shop/index`, page, pageSize, filterData, function (response) {
                     obj.loading = false;
                     obj.currentPage = response.currentPage;
                     obj.list = response.list;
@@ -253,4 +268,7 @@ export default {
 .flex{
     display: flex;
 }
+.radio{
+  margin-bottom: 1rem;
+}
 </style>

+ 85 - 41
frontendEle/src/views/shop/order-overseas.vue

@@ -128,6 +128,7 @@
 <script>
  import network from '@/utils/network'
  import tool from '@/utils/tool'
+ import QRCode from 'qrcode'
   export default{
       name: 'order-overseas',
       data() {
@@ -175,6 +176,7 @@
               consigneeIdNo: '',
               IDCardDialog: false,
               IDCardWebsite: 'http://t.taoplus.com.my/Home/UploadIDCard',
+              flag:this.isPC()
           }
       },
       created() {
@@ -207,6 +209,43 @@
           this.IDCardDialog  = true
       },
       methods:{
+        async pay(info) {
+          if (this.flag === 'website') {
+            //pc
+            let payTypeText = this.payType === 'WECHAT' ? '微信' : '支付宝'
+            let url = await QRCode.toDataURL(info.qrCode);
+            await this.$alert(`<img src=${url}  alt="" >`, `请使用${payTypeText}扫码支付`, {
+              showClose: false,
+              showCancelButton: true,
+              showConfirmButton: true,
+              confirmButtonText: '支付成功',
+              cancelButtonText: '取消支付',
+              dangerouslyUseHTMLString: true,
+              center: true,
+              callback: action => {
+                if(action === 'confirm'){
+                  this.$router.push({path: `/shop/order-list`})
+                }else{
+                  this.$router.push({path: `/shop/index`})
+                }
+              }
+            });
+            if (this.payType === 'WECHAT') {
+              //微信
+            } else {
+             //支付宝
+            }
+          } else {
+            //移动端
+            let origin = window.location.origin + '/#/shop/order-list'
+            window.location.replace(info.mweb_url + '&redirect_url=' + encodeURIComponent(origin))
+            if (this.payType === 'WECHAT') {
+              //微信
+            } else {
+
+            }
+          }
+        },
           getSummaries(param) {
             const { columns, data } = param;
             const sums = [];
@@ -264,42 +303,43 @@
                 consigneeIdNo: this.consigneeIdNo,
                 consigneeRealName: this.consigneeRealName,
               }
-              this.$confirm(`确定要购买商品吗?`, '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning',
-                customClass: 'msgbox',
-              }).then(() => {
-                network.postData(`shop/sure-approach-order`, data).then(response => {
-                  this.submitButtonStat = false
-
-                  // 跳转到中转页面
-                  // 'http://nc-fele-mips.elken.com:8016' // test
-                  // 'http://fele.ncshop.elken.com' // prod
-                  location.href = 'https://fele.ncshop.elken.com/pay.html?RefNo=' + response.SN
-
-                  // 唤起支付页面
-                  // network.postData(`shop/i-pay88`, { Amount: response.ORDER_AMOUNT, RefNo: response.SN }).then(payment => {
-                  //   this.actionUrl = payment.transactionUrl
-                  //   this.form = payment.paymentFields
-                  //
-                  //   this.visible = true
-                  //   this.payLoading = false
-                  // }).catch(err => {
-                  //   this.$message({
-                  //     message: err,
-                  //     type: 'error'
-                  //   })
-                  //   this.submitButtonStat = false
-                  // })
-                })
-              }).catch(err => {
-                this.$message({
-                  message: err,
-                  type: 'error'
-                })
+              network.postData(`shop/sure-approach-order`, data).then(async response => {
+                await this.pay(response)
                 this.submitButtonStat = false
+                // 跳转到中转页面
+                // 'http://nc-fele-mips.elken.com:8016' // test
+                // 'http://fele.ncshop.elken.com' // prod
+                // location.href = 'https://fele.ncshop.elken.com/pay.html?RefNo=' + response.SN
+
+                // 唤起支付页面
+                // network.postData(`shop/i-pay88`, { Amount: response.ORDER_AMOUNT, RefNo: response.SN }).then(payment => {
+                //   this.actionUrl = payment.transactionUrl
+                //   this.form = payment.paymentFields
+                //
+                //   this.visible = true
+                //   this.payLoading = false
+                // }).catch(err => {
+                //   this.$message({
+                //     message: err,
+                //     type: 'error'
+                //   })
+                //   this.submitButtonStat = false
+                // })
               })
+              // this.$confirm(`确定要购买商品吗?`, '提示', {
+              //   confirmButtonText: '确定',
+              //   cancelButtonText: '取消',
+              //   type: 'warning',
+              //   customClass: 'msgbox',
+              // }).then(() => {
+              //
+              // }).catch(err => {
+              //   this.$message({
+              //     message: err,
+              //     type: 'error'
+              //   })
+              //   this.submitButtonStat = false
+              // })
           },
           getSumMoney(){
               let cash_plus_sum=[];
@@ -328,7 +368,7 @@
             this.pointsSum = this.cashSum = tool.formatPrice(tool.sum(cash_plus_sum) + this.freight) ;
           },
           getShowCart(){
-              network.getData('shop/show-cart')
+              network.getData(`shop/show-cart?device=${this.flag}`)
               .then(response=>{
                   this.loading=false;
                   this.all_address=response.allAddress;
@@ -342,12 +382,9 @@
                       this.addressId = this.all_address[0].ID
                   }
 
-                  for(let key in response.payList){
+                  for(let key in response.onlinePayList){
                     // 如果是海外商品,则只有在线支付
-                    if (key === 'online') {
-                      this.payList.push({type:key, name:response.payList[key].name})
-                      break;
-                    }
+                    this.payList.push({type:key, name:response.onlinePayList[key].name})
                   }
 
                 //默认设置为第一项付款方式
@@ -355,7 +392,7 @@
               })
           },
           chosePayType(type){
-
+            console.log(type)
           },
           choseAddress(addressId){
           },
@@ -406,6 +443,13 @@
             // window.location.href = this.IDCardWebsite
             window.open(this.IDCardWebsite, '_blank')
           },
+          isPC() {
+            let flag = window.navigator.userAgent.match(
+              /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
+            );
+            return flag ? 'mobile' :'website'
+
+          },
       }
   }
 </script>