xiebaomin 1 year ago
parent
commit
399a03e5d7

+ 1 - 3
.env.development

@@ -1,8 +1,6 @@
 # 文件标记
 NODE_ENV = 'development'
-
-# 网站地址
-LOCALHOSE = 'https://sell-b.caimei365.com'
+BASE_URL = 'https://sell-b.caimei365.com/'
 
 # 接口api地址
 #VUE_APP_URL = 'http://192.168.2.103:18002'

+ 3 - 2
.env.production

@@ -2,10 +2,11 @@
 NODE_ENV = 'production'
 
 # 网站地址
-LOCALHOSE = 'sell.caimei365.com'
+BASE_URL = 'https://sell-b.caimei365.com/'
 
 # 接口api地址
-BASE_URL = ''
+#VUE_APP_URL = 'http://192.168.2.103:18002'
+VUE_APP_URL = 'https://core.caimei365.com'
 
 # 静态资源文件地址
 STATIC_URL = 'https://static.caimei365.com/app/mini-distribution'

+ 34 - 0
src/api/institutionApi/pay.js

@@ -44,3 +44,37 @@ export const getBankList = (params) => http({
     isToken: true
   }
 })
+
+export const orderPayOnline = (data) => http({
+  url: '/order/pay/online',
+  method: 'POST',
+  data
+})
+
+export const orderPayQuickBindCard = (data) => http({
+  url: '/order/pay/quick/bind/card',
+  method: 'POST',
+  data,
+  headers: {
+    isToken: true
+  }
+})
+
+export const orderPayQuickPay = (data) => http({
+  url: '/order/pay/quick/pay',
+  method: 'POST',
+  data,
+  headers: {
+    isToken: true
+  }
+})
+
+// 信息校验
+export const orderPayQuickBindCode = (params) => http({
+  url: '/order/pay/quick/bind/code',
+  method: 'GET',
+  params,
+  headers: {
+    isToken: true
+  }
+})

+ 1 - 1
src/components/share-popup.vue

@@ -61,7 +61,7 @@ export default {
     onSelect ($event) {
       const form = {
         0: () => {
-          console.log('点击右上角...分享微信好友')
+          Toast.success('请点击右上角...分享好友')
         },
         1: () => this.getPoster()
       }

+ 9 - 2
src/permission.js

@@ -7,7 +7,7 @@ import { Toast } from 'vant'
 
 NProgress.configure({ showSpinner: false })
 
-const whiteList = ['/login', '/pwlogin', '/forgotPW', '/goods-detail', '/order-list', '/share', '/order-detail']
+const whiteList = ['/login', '/pwlogin', '/forgotPW', '/goods-detail', '/order-list', '/share', '/order-detail', '/order-pay', '/paymentOnline', '/paymentOffline', '/wechatpay']
 
 router.beforeEach((to, from, next) => {
   NProgress.start()
@@ -20,6 +20,13 @@ router.beforeEach((to, from, next) => {
       next({ path: '/pwlogin' })
       NProgress.done()
     } else {
+      const href = window.location.href
+      if (href.indexOf('/?code') > -1 && href.lastIndexOf('#') > 50) {
+        const urlArr = href.split('/?')
+        const leftUrl = urlArr[0] + '/#/'
+        const rightUrlArr = urlArr[1].split('#/')
+        location.href = `${leftUrl}${rightUrlArr[1]}?${rightUrlArr[0]}`
+      }
       if (!store.getters.userInfo) {
         store.dispatch('user/getUserInfo', store.getters.userId).then(() => {
           store.dispatch('institution/addressList').then(() => {
@@ -38,8 +45,8 @@ router.beforeEach((to, from, next) => {
   } else {
     // 没有token
     if (whiteList.indexOf(to.path) !== -1) {
-      // 在免登录白名单,直接进入
       next()
+      // 在免登录白名单,直接进入
     } else {
       Toast.fail('登入失效请重新登录')
       next(`/pwlogin?redirect=${to.fullPath}`) // 否则全部重定向到登录页

+ 17 - 1
src/router/index.js

@@ -286,12 +286,28 @@ const routes = [
     meta: {
       title: '查看物流'
     }
+  },
+  {
+    path: '/wechatpay',
+    name: 'wechatpay',
+    component: () => import('@/views/pay/wechatPay.vue'),
+    meta: {
+      title: '微信支付'
+    }
+  },
+  {
+    path: '/addBanks',
+    name: 'addBanks',
+    component: () => import('@/views/pay/addBanks.vue'),
+    meta: {
+      title: '添加银行卡'
+    }
   }
 ]
 
 const router = new VueRouter({
   mode: 'hash',
-  base: process.env.BASE_URL,
+  base: '',
   routes
 })
 

+ 6 - 2
src/util/http.js

@@ -28,7 +28,7 @@ request.interceptors.request.use(
     Vue.$showLoading = true
     Toast.loading({
       message: '加载中...',
-      forbidClick: false
+      forbidClick: true
     })
     let cancelFunction // 引用取消请求的cancelToken
     // 挂载请求key
@@ -111,8 +111,11 @@ request.interceptors.response.use(
     } else {
       Toast.loading({
         message: '加载中...',
-        forbidClick: false
+        forbidClick: true
       })
+      setTimeout(() => {
+        Toast.clear()
+      }, 1000)
       return Promise.resolve(data)
     }
   },
@@ -121,6 +124,7 @@ request.interceptors.response.use(
     // 对响应错误做点什么
     Toast.fail(error.message)
     Vue.$showLoading = false
+    Toast.clear()
     return Promise.reject(error)
   }
 )

+ 3 - 2
src/views/goods-information/index.vue

@@ -19,7 +19,8 @@ export default {
       formData: {
         productName: '',
         pageNum: 1,
-        pageSize: 10
+        pageSize: 10,
+        id: this.$store.getters.userInfo.id
       },
       hasNextPage: false,
       goodsList: []
@@ -33,7 +34,7 @@ export default {
       this.$router.push(`/goods-information-detail?archiveId=${$event.archiveId}&productId=${$event.productId}`)
     },
     async getArchiveList () {
-      const j = this.$store.getters.isManage ? { id: this.$store.getters.userInfo.id } : { parentId: this.$store.getters.userInfo.id }
+      const j = this.$store.getters.isManage ? { id: this.$store.getters.userInfo.id } : { id: this.$store.getters.userInfo.parentId }
       const form = {
         ...this.formData,
         ...j

+ 4 - 4
src/views/ins-intention-report/detail.vue

@@ -31,11 +31,11 @@
       class="detail-btn"
       v-if="
         resultInfo.cmReportingClub &&
-        isReportAuditStatus(resultInfo.auditStatus) && !isReportLock(resultInfo.cmReportingClub.lockStatus)
+        isReportAuditStatus(resultInfo.auditStatus) && !isReportDeal(resultInfo.cmReportingClub.orderStatus)
       "
     >
-      <van-button color="#FF5B00" v-if="isLock === 1" @click="handlerPlaceOrder(resultInfo.cmReportingClub)">下单</van-button>
-      <van-button style="color: #ff9100" @click="shareOrderConfirm" v-else
+      <van-button color="#FF5B00" @click="handlerPlaceOrder(resultInfo.cmReportingClub)">下单</van-button>
+      <van-button style="color: #ff9100" @click="shareOrderConfirm" v-if="!isReportLock(resultInfo.cmReportingClub.lockStatus)"
         >分享采购意向确认</van-button
       >
     </div>
@@ -84,7 +84,7 @@ export default {
       this.resultInfo = data
     },
     shareOrderConfirm () {
-      this.$router.push(`/intention-confirm?id=${this.id}`)
+      this.$router.push(`/intention-confirm?id=${this.resultInfo.cmReportingClub.id}`)
     },
     handlerPlaceOrder ($event) {
       this.$router.push(`/goods-detail?productId=${$event.productId}&typeId=0&isLock=1&cId=${$event.id}`)

+ 3 - 3
src/views/ins-intention-report/index.vue

@@ -22,13 +22,13 @@
             <div>锁定状态:<span style="color: #ff9100">{{ data.lockStatus | isLockStatus }}</span></div>
           </div>
           <div v-if="active === 0">
-            <div class="change-btn" v-if="isReportAuditStatus(item.auditStatus) && !isReportLock(data.lockStatus)">
+            <div class="change-btn" v-if="isReportAuditStatus(item.auditStatus) && !isReportDeal(data.orderStatus)">
               <van-button @click="handlerPlaceOrder(item.cmReportingClub)">下单</van-button>
               <van-button @click="handlerDetail(item)">查看详情</van-button>
             </div>
-            <div class="detail-btn" v-if="isReportAuditStatus(item.auditStatus) && isReportLock(data.lockStatus)">
+            <!--<div class="detail-btn" v-if="isReportAuditStatus(item.auditStatus) && isReportLock(data.lockStatus)">
               <van-button @click="handlerDetail(item)">查看详情</van-button>
-            </div>
+            </div>-->
             <div class="detail-btn" v-else>
               <van-button @click="handlerDetail(item)">查看详情</van-button>
             </div>

+ 35 - 28
src/views/order-list/components/order-btn-type.vue

@@ -46,6 +46,10 @@ export default {
     productInfo: {
       type: Object,
       default: () => ({})
+    },
+    activeBtn: {
+      type: Number,
+      default: () => 0
     }
   },
   data () {
@@ -62,10 +66,12 @@ export default {
   },
   computed: {
     isIns () {
-      return this.$route.query.isIns
+      return this.$route.query.isIns * 1
     },
     orderBtnList () {
+      if (this.activeBtn !== 2) return []
       if (this.isIns) {
+        console.log(this.isIns)
         return [
           {
             id: 0,
@@ -103,34 +109,35 @@ export default {
             link: '/upload-voucher'
           }
         ]
+      } else {
+        return [
+          {
+            id: 0,
+            name: '确认订单',
+            label: 'isConfirm'
+          },
+          {
+            id: 1,
+            name: '取消订单',
+            label: 'isCancel'
+          },
+          {
+            id: 2,
+            name: '分享订单',
+            label: 'isShare'
+          },
+          {
+            id: 3,
+            name: '查看物流',
+            label: 'isQuery'
+          },
+          {
+            id: 4,
+            name: '分享支付',
+            label: 'isPay'
+          }
+        ]
       }
-      return [
-        {
-          id: 0,
-          name: '确认订单',
-          label: 'isConfirm'
-        },
-        {
-          id: 1,
-          name: '取消订单',
-          label: 'isCancel'
-        },
-        {
-          id: 2,
-          name: '分享订单',
-          label: 'isShare'
-        },
-        {
-          id: 3,
-          name: '查看物流',
-          label: 'isQuery'
-        },
-        {
-          id: 4,
-          name: '分享支付',
-          label: 'isPay'
-        }
-      ]
     }
   },
   watch: {

+ 3 - 2
src/views/order-list/index.vue

@@ -42,6 +42,7 @@
             <order-btn-type
               :productInfo="item"
               :status="item.status"
+              :activeBtn="activeBtn"
               @orderCancel="orderCancel"
               @orderPay="orderPay"
               @orderQuery="orderQuery"
@@ -171,7 +172,7 @@ export default {
     handlerOrder (item) {
       console.log(item)
       this.$router.push(
-        `/order-detail?shopOrderId=${item[0].shopOrderId}&userId=${item[1]}&isIns=${this.isIns}`
+        `/order-detail?shopOrderId=${item[0].shopOrderId}&userId=${item[1]}&isIns=${this.isIns}&activeBtn=${this.activeBtn}`
       )
     },
     async orderList (form) {
@@ -208,7 +209,7 @@ export default {
           link: `https://sell-b.caimei365.com/#/share?type=1&shopOrderId=${info.shopOrderId}&userId=${info.userId}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
           imgUrl: 'https://static.caimei365.com/app/mini-distribution/qrcode.png', // 分享图标
           fail: () => {
-            this.initAppMessageShareData()
+            this.initAppMessageShareData(info)
           }
         })
       })

+ 31 - 2
src/views/order-list/order-detail.vue

@@ -92,10 +92,12 @@
       <order-btn-type
         :productInfo="orderInfo"
         :status="orderInfo.status"
+        :activeBtn="activeBtn"
         @orderCancel="orderCancel"
         @orderPay="orderPay"
         @orderQuery="orderQuery"
         @orderConfirm="orderConfirm"
+        @shareOrder="shareOrder"
       />
     </div>
   </div>
@@ -108,6 +110,7 @@ import PaymentRecords from './components/payment-records'
 import InvoiceInformation from './components/invoice-information'
 import ContactSelect from './components/contact-select'
 import { orderDetail } from '@/api/institutionApi/order.js'
+import { Toast } from 'vant'
 export default {
   components: {
     OrderBtnType,
@@ -128,8 +131,10 @@ export default {
   },
   filters: {
     NumFormat (value) {
-      // 处理金额
-      return Number(value).toFixed(2)
+      if (value) {
+        // 处理金额
+        return Number(value).toFixed(2)
+      } else return 0
     },
     // 设置发票文案
     setInvoiceText (data) {
@@ -177,6 +182,9 @@ export default {
     },
     userId () {
       return this.$route.query.userId
+    },
+    activeBtn () {
+      return this.$route.query.activeBtn * 1
     }
   },
   mounted () {
@@ -207,6 +215,27 @@ export default {
     },
     orderConfirm () {
       this.orderDetail()
+    },
+    // 分享当前页面
+    initAppMessageShareData (info) {
+      this.$wxReady((wx) => {
+        // 需在用户可能点击分享按钮前就先调用
+        wx.updateAppMessageShareData({
+          title: '分享订单', // 分享标题
+          desc: '分享订单', // 分享描述
+          link: `https://sell-b.caimei365.com/#/share?type=1&shopOrderId=${info.shopOrderId}&userId=${info.userId}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
+          imgUrl: 'https://static.caimei365.com/app/mini-distribution/qrcode.png', // 分享图标
+          fail: () => {
+            this.initAppMessageShareData(info)
+          }
+        })
+      })
+    },
+    shareOrder (info) {
+      this.initAppMessageShareData(info)
+      setTimeout(() => {
+        Toast.success('请点击右上角...进行分享')
+      }, 1000)
     }
   }
 }

+ 4 - 4
src/views/order-list/order-pay.vue

@@ -16,10 +16,10 @@
         <span style="color: #F85050;">{{ '¥' + item.obligation }}</span>
       </div>
       <div class="pay">
-        <div class="pay-btn" v-if="item.onlinePay === 1">
+        <div class="pay-btn">
           <van-button color="#FF5B00" @click="payMent(item)">线上支付</van-button>
         </div>
-        <div class="pay-btn" v-else>
+        <div class="pay-btn">
           <van-button color="#FF5B00" @click="payMent(item)">线下支付</van-button>
         </div>
       </div>
@@ -51,8 +51,8 @@ export default {
       this.orderList = data
     },
     payMent ($event) {
-      if ($event.onlinePay === 1) return this.$router.push(`/paymentOnline?shopOrderId=${$event.shopOrderId}`)
-      else return this.$router.push(`/paymentOffline?shopOrderId=${$event.shopOrderId}`)
+      return this.$router.push(`/paymentOnline?shopOrderId=${$event.shopOrderId}`)
+      // else return this.$router.push(`/paymentOffline?shopOrderId=${$event.shopOrderId}`)
     }
   }
 }

+ 115 - 0
src/views/pay/addBanks.vue

@@ -0,0 +1,115 @@
+<template>
+  <div>
+    <nav-bar title="添加银行卡" @click-left="$router.back()" />
+    <div class="content">
+      <van-field v-model="formData.quickPayBankNumber" label="卡号" />
+      <van-cell is-link title="卡类型" :value="type" @click="show = true" />
+      <van-field v-model="formData.quickPayUserName" label="姓名" />
+      <van-field v-model="formData.idCard" label="身份证" />
+      <van-field v-model="formData.quickPayMobile" type="tel" label="预留手机号" />
+      <van-cell is-link title="有效期" :value="type" @click="showTimePicker = true" v-if="pickerIndex === 2"/>
+      <van-field v-model="formData.cvvCode" label="cvv2" v-if="pickerIndex === 2"/>
+    </div>
+    <van-action-sheet v-model="show" :actions="actions" @select="onSelect" />
+    <div class="handerBtn">
+      <van-button :disabled="disabled" @click="handlerNext" color="#FF5B00">下一步</van-button>
+    </div>
+  </div>
+</template>
+
+<script>
+import { orderPayQuickPay, orderPayQuickBindCard } from '@/api/institutionApi/pay'
+export default {
+  data () {
+    return {
+      show: true,
+      formData: {
+        userId: '',
+        quickPayBankNumber: '',
+        quickPayUserName: '',
+        idCard: '',
+        quickPayMobile: '',
+        cvvCode: '',
+        quickPayBankExpireTime: ''
+      },
+      actions: [{ id: 1, name: '借记卡' }, { id: 2, name: '贷记卡' }],
+      type: '借记卡',
+      pickerIndex: 1,
+      showTimePicker: false
+    }
+  },
+  computed: {
+    disabled () {
+      if (this.pickerIndex === 1) {
+        return !(
+          this.formData.quickPayBankNumber.length > 12 && this.formData.quickPayUserName !== '' && this.formData.idCard !== '' && this.formData.quickPayMobile !== ''
+        )
+      } else {
+        return !(
+          this.formData.quickPayBankNumber.length > 12 && this.formData.quickPayUserName !== '' && this.formData.idCard !== '' && this.formData.quickPayMobile !== '' && this.formData.quickPayBankExpireTime !== '' && this.formData.cvvCode !== ''
+        )
+      }
+    },
+    subType () {
+      // 1直接绑卡  2//首次绑卡并支付 3//确认支付
+      return this.$route.query.type * 1
+    }
+  },
+  methods: {
+    onSelect ($event) {
+      this.type = $event.name
+      this.pickerIndex = $event.id
+      this.show = false
+    },
+    handlerNext () {
+      if (this.subType === 1) {
+        this.orderPayQuickBindCard()
+      } else {
+        this.orderPayQuickPay()
+      }
+    },
+    async orderPayQuickBindCard () {
+      // 直接绑卡
+      try {
+        const res = await orderPayQuickBindCard(this.formData)
+        console.log('res', res.data)
+        const data = JSON.stringify({ formData: this.formData, payData: res.data })
+        this.$api.navigateTo(`/pages/user/pay/card-comfirm-sub?type=${this.subType}&data=${data}`)
+      } catch (error) {
+        this.$util.msg(error.msg, 2000)
+      }
+    },
+    async orderPayQuickPay () {
+      // 绑卡并支付
+      try {
+        const res = await orderPayQuickPay(this.formData)
+        console.log('res', res.data)
+        const data = {
+          formData: this.formData,
+          payData: res.data,
+          orderId: this.orderId,
+          payAmount: this.payAmount
+        }
+        this.$api.navigateTo(`/pages/user/pay/card-comfirm-sub?type=${this.subType}&data=${JSON.stringify(data)}`)
+      } catch (error) {
+        this.$util.msg(error.msg, 2000)
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.handerBtn {
+  margin-top: 6vw;
+  width: 100%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  .van-button {
+    width: 80vw;
+    height: 10vw;
+    border-radius: 5vw;
+  }
+}
+</style>

+ 289 - 0
src/views/pay/bankRequired.vue

@@ -0,0 +1,289 @@
+<template>
+<div class="container card clearfix">
+    <div class="card-content">
+      <div class="card-title" v-if="subType === 2 || subType === 3">
+        <div class="card-pay-text">¥{{ payAmount }}</div>
+      </div>
+      <div class="card-mains">
+        <div class="card-form-text">已发送至手机号 {{ phoneNumbe }}</div>
+        <div class="card-form">
+          <input
+            class="card-input"
+            v-model="codeParams.bindCode"
+            @input="handleInput"
+            type="number"
+            maxlength="6"
+            placeholder="请输入短信验证码"
+          />
+          <div
+            class="card-form-code"
+            :class="isMobileDisabled ? 'disabled' : ''"
+            @click.stop="handleMobileCode"
+          >
+            <text>{{ mobileCodeText }}</text>
+          </div>
+        </div>
+      </div>
+      <div class="card-mains-btn">
+        <button
+          class="add-btn"
+          :disabled="disabled"
+          :class="[disabled ? 'disabled' : '']"
+          @click="handleAddCard"
+        >
+          {{ suBbtnText }}
+        </button>
+      </div>
+    </div>
+</div>
+</template>
+<script>
+import { Toast } from 'vant'
+import { orderPayQuickPay, orderPayQuickBindCard } from '@/api/institutionApi/pay'
+export default {
+  data () {
+    return {
+      orderId: 0,
+      params: {},
+      payAmount: '',
+      subType: 1, // 1直接绑卡  2//首次绑卡并支付 3//确认支付
+      isMobileDisabled: true, // 手机验证码按钮控制
+      mobilCount: '', // 倒计时
+      mobileCodeText: '重新发送',
+      mobilTime: null,
+      codeParams: {
+        orderId: '',
+        infoId: '',
+        bindCode: '',
+        flag: 1 // 1绑卡 2 付款
+      },
+      skeletonShow: true,
+      suBbtnText: '确认绑定'
+    }
+  },
+  mounted () {
+    this.initOption(this.$route.query.data, this.$route.query.type)
+  },
+  filters: {},
+  computed: {
+    phoneNumbe () {
+      // 手机号仅显示前三位及后四位数字,隐藏信息用*代替
+      return this.params.quickPayMobile.substr(0, 3) + '****' + this.params.quickPayMobile.substring(7)
+    },
+    disabled () {
+      return !(this.codeParams.bindCode.length > 4)
+    }
+  },
+  methods: {
+    initOption (option, type) {
+      console.log('option', option)
+      const data = JSON.parse(option)
+      this.subType = Number(type)
+      this.params = data.params
+      this.codeParams = Object.assign(this.codeParams, data.payData)
+      if (this.subType === 1) {
+        this.codeParams.flag = 1
+      } else {
+        this.codeParams.flag = 2
+        this.orderId = data.orderId
+        this.payAmount = this.params.quickPayFlag === 2 ? data.payAmount : this.params.payAmount
+      }
+      this.handleCodeTime()
+      this.handleBbtnText(this.subType)
+      setTimeout(() => {
+        Toast.loading('加载中')
+      }, 500)
+    },
+    handleCodeTime () {
+      // 倒计时
+      const TIME_COUNT = 60
+      if (!this.mobilTime) {
+        this.mobilCount = TIME_COUNT
+        this.isMobileDisabled = true
+        this.mobilTime = setInterval(() => {
+          if (this.mobilCount > 1 && this.mobilCount <= TIME_COUNT) {
+            this.mobilCount--
+            this.mobileCodeText = this.mobilCount + '秒后重发'
+          } else {
+            this.isMobileDisabled = false
+            clearInterval(this.mobilTime)
+            this.mobilTime = null
+            this.mobileCodeText = '重新发送'
+          }
+        }, 1000)
+      }
+    },
+    handleBbtnText (value) {
+      const textMap = {
+        1: '确认绑定',
+        2: '确认绑定支付',
+        3: '确认支付'
+      }
+      this.suBbtnText = textMap[value]
+    },
+    async handleAddCard () {
+      // 提交绑定或支付
+      try {
+        const loadText = this.subType === 1 ? '绑定中...' : '支付中...'
+        const successMsg = this.subType === 1 ? '绑定成功' : '支付成功'
+        await this.PayService.orderPayQuickBindCode(this.codeParams, loadText)
+        Toast.success(successMsg)
+        setTimeout(() => {
+          this.handleSuccessHref()
+        }, 2000)
+      } catch (error) {
+        console.log(error)
+        Toast.fail(error.msg)
+      }
+    },
+    handleSuccessHref () {
+      //  tiaozhuan
+      if (this.subType === 1) {
+        this.$api.navigateBack(2)
+      } else {
+        if (this.params.quickPayFlag === 1) {
+          const linkData = {
+            payAmount: this.params.payAmount,
+            shopOrderId: this.shopOrderId,
+            orderId: this.orderId,
+            type: 'success'
+          }
+          this.$api.redirectTo(`/pages/user/order/order-success?data=${JSON.stringify({ data: linkData })}`)
+        } else {
+          this.$api.redirectTo('/pages/user/member/member')
+        }
+      }
+    },
+    handleMobileCode () {
+      // 获取短信验证码
+      this.isMobileDisabled = true
+      if (this.subType === 1) {
+        this.orderPayQuickBindCard()
+      } else {
+        this.orderPayQuickPay()
+      }
+    },
+    async orderPayQuickBindCard () {
+      // 直只绑卡
+      try {
+        await orderPayQuickBindCard(this.params)
+        this.handleCodeTime()
+      } catch (error) {
+        this.isMobileDisabled = false
+      }
+    },
+    async orderPayQuickPay () {
+      // 绑卡并支付
+      try {
+        await orderPayQuickPay(this.params)
+        this.handleCodeTime()
+      } catch (error) {
+        console.log(error)
+        this.isMobileDisabled = false
+      }
+    }
+  },
+  onShow () {
+  }
+}
+</script>
+
+<style lang="scss" scope>
+.container {
+    background: #ffffff;
+    height: 100%;
+}
+.card-content {
+    width: 100%;
+    height: auto;
+    box-sizing: border-box;
+    padding-top: 70px;
+}
+.card-title {
+    width: 100%;
+    height: auto;
+    box-sizing: border-box;
+    padding: 0 0 70px 0;
+    .card-pay-text {
+      width: 100%;
+      height: 90px;
+      line-height: 90px;
+      text-align: center;
+      font-size: 56px;
+      color: #ff5b00;
+      font-weight: bold;
+      box-sizing: border-box;
+    }
+}
+.card-mains {
+    width: 100%;
+    height: 100px;
+    box-sizing: border-box;
+    padding: 0 50px 0 32px;
+    .card-form-text {
+      width: 100%;
+      height: 40px;
+      line-height: 40px;
+      text-align: left;
+      font-size: $font-size-28;
+      color: #333;
+      box-sizing: border-box;
+      margin-bottom: 16px;
+    }
+    .card-form {
+      width: 100%;
+      height: 100%;
+      box-sizing: border-box;
+      border: 1px solid #cccccc;
+      padding: 14px 0;
+      border-radius: 16px;
+      position: relative;
+      .card-input {
+        width: 460px;
+        height: 100%;
+        line-height: 96px;
+        padding-left: 32px;
+        box-sizing: border-box;
+        font-size: $font-size-30;
+        color: #333;
+        border-right: 1px solid #e1e1e1;
+        float: left;
+      }
+      .card-form-code {
+        width: 204px;
+        height: 72px;
+        line-height: 72px;
+        text-align: center;
+        color: $color-system;
+        font-size: $font-size-26;
+        float: left;
+        &.disabled {
+          color: #999;
+        }
+      }
+    }
+}
+.card-mains-btn {
+    width: 100%;
+    height: auto;
+    box-sizing: border-box;
+    padding: 0 75px;
+    margin-top: 180px;
+    .add-btn {
+      width: 100%;
+      height: 90px;
+      font-size: $font-size-30;
+      line-height: 90px;
+      color: #ffffff;
+      text-align: center;
+      background: $btn-confirm;
+      border-radius: 45px;
+      border-radius: 44px;
+      margin-top: 80px;
+      &.disabled {
+        background: #e1e1e1;
+        border-radius: 44px;
+      }
+    }
+}
+</style>

+ 10 - 2
src/views/pay/components/discern-popup.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <van-popup v-model="show" round position="bottom">
-      <div>支付记录</div>
+      <div class="title">支付记录</div>
     </van-popup>
   </div>
 </template>
@@ -23,5 +23,13 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-
+.van-popup {
+  min-height: 30vw;
+  .title {
+    text-align: center;
+    font-size: 4vw;
+    font-weight: 600;
+    margin: 4vw 0;
+  }
+}
 </style>

+ 64 - 5
src/views/pay/mixins/pay.js

@@ -1,18 +1,77 @@
-// import { appId } from '@/config/js-config'
+import { appId } from '@/config/js-config'
+import { Toast } from 'vant'
+
 export default {
   methods: {
     isWeChat () {
       return window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i) === 'micromessenger'
     },
     redirectPage () {
-      // const orderInfo = {}
-      // window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=https://www.caimei365.com/pay/wechatpay.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
+      Toast.loading({
+        message: '加载中...',
+        forbidClick: true
+      })
+      const orderInfo = {
+        isShow: 1,
+        shopOrderId: this.$route.query.shopOrderId,
+        payAmount: this.$route.query.payAmount
+      }
+      location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent('https://sell-b.caimei365.com/#/wechatpay')}&response_type=code&scope=snsapi_base&state=${JSON.stringify(orderInfo)}#wechat_redirect`
     },
     inItPayMent () {
-      console.log(this.isWeChat)
-      if (this.isWeChat) {
+      if (this.isWeChat && this.isShow === 0) {
         this.redirectPage()
       }
+    },
+    getCode () {
+      const js = JSON.parse(this.$route.query.state)
+      this.payAmount = js.payAmount
+      this.shopOrderId = js.shopOrderId
+      this.wechatcode = this.$route.query.code
+    },
+    random (min, max) {
+      return Math.floor(Math.random() * (max - min)) + min
+    },
+    hlb_handlResponse (data) {
+      console.log('rt10_payInfo' + data)
+      const PayInfo = JSON.parse(data.rt10_payInfo)
+      if (typeof WeixinJSBridge === 'undefined') {
+        if (document.addEventListener) {
+          document.addEventListener('WeixinJSBridgeReady', this.hlb_onBridgeReady, false)
+        } else if (document.attachEvent) {
+          document.attachEvent('WeixinJSBridgeReady', this.hlb_onBridgeReady)
+          document.attachEvent('onWeixinJSBridgeReady', this.hlb_onBridgeReady)
+        }
+      } else {
+        this.hlb_onBridgeReady(PayInfo)
+      }
+      this.isSubMitStatus = false
+    },
+    hlb_onBridgeReady (data) { // 调起微信公众号支付
+      console.log('支付验证签名', data)
+      WeixinJSBridge.invoke('getBrandWCPayRequest', {
+        appId: data.appId, // 公众号名称,由商户传入
+        timeStamp: data.timeStamp, // 时间戳,自1970年以来的秒数
+        nonceStr: data.nonceStr, // 随机串
+        package: data.package,
+        signType: data.signType, // 微信签名方式:
+        paySign: data.paySign // 微信签名
+      },
+      function (res) {
+        if (res.err_msg === 'get_brand_wcpay_request:ok') {
+          Toast.success('支付成功')
+        } else if (res.err_msg === 'get_brand_wcpay_request:cancel') {
+          Toast.fail('用户取消支付,请重新扫码支付')
+          setTimeout(function () {
+            WeixinJSBridge.call('closeWindow')
+          }, 3000)
+        } else {
+          Toast.fail('支付失败,请重新扫码支付')
+          setTimeout(function () {
+            WeixinJSBridge.call('closeWindow')
+          }, 3000)
+        }
+      })
     }
   }
 }

+ 14 - 8
src/views/pay/paymentOnline.vue

@@ -4,7 +4,7 @@
     <div class="content">
       <div class="payIcon">
         <div class="payList">
-          <div class="text">支付记录</div>
+          <div class="text" @click="handlerDiscern">支付记录</div>
         </div>
         <div class="shouldPay">
           <div class="payment">
@@ -20,7 +20,7 @@
       <div class="payCard">
         <div class="amount">
           <div class="label">待付金额</div>
-          <div class="money">¥{{ totalAmount | handlerPayFixed }}</div>
+          <div class="money">¥{{ obligation | handlerPayFixed }}</div>
         </div>
         <div class="amount">
           <div class="label">应付总额</div>
@@ -32,7 +32,7 @@
         </div>
       </div>
       <div class="bank-pay">
-        <van-cell title="添加银行卡快捷支付" is-link />
+        <van-cell title="添加银行卡快捷支付" is-link to="addBanks?type=2" />
         <van-radio-group v-model="radio">
           <van-cell-group>
             <van-cell :title="item.title" clickable @click="handlerPay(item)" :icon="item.icon" v-for="item in payList" :key="item.id">
@@ -52,20 +52,23 @@
       <van-button color="#FF5B00" @click="bankQuickPay">{{ payName || '使用银行卡快捷支付' }}</van-button>
     </div>
     <bank-link-vue :show="showLink" @handlerShowDialog="handlerShowDialog" :bankLink="handlerPayLink"/>
+    <discern-popup :discernReceipt="discernReceipt" ref="discern" />
   </div>
 </template>
 
 <script>
 import BankLinkVue from './components/bankLinkVue'
+import discernPopup from './components/discern-popup'
 import { payCheckout, getBankList, bankQuickPay, payLink } from '@/api/institutionApi/pay.js'
-import pay from './mixins/pay'
+
 export default {
-  mixins: [pay],
-  components: { BankLinkVue },
+
+  components: { BankLinkVue, discernPopup },
   data () {
     return {
       bankList: [],
       totalAmount: 0,
+      obligation: 0,
       radio: '',
       shopOrder: {},
       userId: '',
@@ -104,13 +107,13 @@ export default {
   },
   mounted () {
     this.payCheckout()
-    this.inItPayMent()
   },
   methods: {
     async payCheckout () {
       const data = await payCheckout({ shopOrderId: this.shopOrderId })
       const data2 = await getBankList({ userId: data.shopOrder.userId })
       this.totalAmount = data.shopOrder.totalAmount.toFixed(2) || 0
+      this.obligation = data.shopOrder.obligation.toFixed(2) || 0
       this.userId = data.shopOrder.userId
       this.shopOrder = data.shopOrder
       this.bankList = data2
@@ -126,7 +129,7 @@ export default {
           console.log(error)
         }
       } else if (this.radio === 1) {
-        console.log('微信支付')
+        this.$router.push(`/wechatpay?shopOrderId=${this.shopOrderId}&payAmount=${this.totalAmount}`)
       } else {
         const form = {
           userId: this.userId,
@@ -153,6 +156,9 @@ export default {
     },
     handlerShowDialog ($event) {
       this.showLink = false
+    },
+    handlerDiscern () {
+      this.$refs.discern.show = true
     }
   }
 }

+ 161 - 3
src/views/pay/wechatPay.vue

@@ -1,15 +1,173 @@
 <template>
   <div>
-
+    <div class="pay-container  clearfix" id="payContainer" :class="isRequest? 'active' : ''">
+      <div class="pay-amount">
+          <div class="icon"><img src="/img/pay/icon-paybg@2x.png" alt=""></div>
+          <div class="pay-money">
+              <div class="label">付款金额</div>
+              <div class="mount"><span>¥</span>{{ payAmount }}</div>
+          </div>
+      </div>
+      <div class="pay-button"><div class="btn" @click="WxPaySubmit" :class="isSubMitStatus ? 'disabled' : ''">立即支付</div></div>
+      <div class="pay-logo">
+          <div class="logo">采美365网</div>
+      </div>
+    </div>
   </div>
 </template>
 
 <script>
-export default {
+import pay from './mixins/pay'
+import { orderPayOnline } from '@/api/institutionApi/pay.js'
+import { Toast } from 'vant'
 
+export default {
+  mixins: [pay],
+  data () {
+    return {
+      payAmount: '',
+      isSubMitStatus: '',
+      wechatcode: '', // 微信code
+      state: 0, // 随机数
+      isRequest: true,
+      paymentChannel: 'HLB',
+      shopOrderId: ''
+    }
+  },
+  mounted () {
+    this.inItPayMent()
+    this.getCode()
+    setTimeout(() => {
+      Toast.clear()
+    }, 1000)
+  },
+  computed: {
+    isShow () {
+      console.log(this.$route.query.state)
+      if (this.$route.query.state) return JSON.parse(this.$route.query.state).isShow * 1
+      else return 0
+    }
+  },
+  methods: {
+    WxPaySubmit () {
+      if (this.paymentChannel === 'HLB') {
+        this.hlbWechatPayFn()
+      } else {
+        this.mhWechatPayFn()
+      }
+    },
+    async hlbWechatPayFn () {
+      console.log(this.payAmount, this.shopOrderId, this.wechatcode)
+      this.isSubMitStatus = true
+      const params = {
+        payType: 'GZH',
+        payAmount: this.payAmount,
+        code: this.wechatcode,
+        state: this.random(1000, 9999),
+        shopOrderId: this.shopOrderId,
+        returnUrl: 'https://www.caimei365.com/'
+      }
+      console.log('=========>普通订单合利宝公众号支付', params)
+      try {
+        const data = await orderPayOnline(params)
+        console.log(data)
+        this.hlb_handlResponse(data)
+      } catch (error) {
+        console.log(error)
+        this.$router.replace(`/paymentOnline?shopOrderId=${this.shopOrderId}`)
+      }
+    },
+    mhWechatPayFn () {}
+  }
 }
 </script>
 
 <style lang="scss" scoped>
-
+footer{
+  display: none;
+}
+.pay-container{
+  width: 100%;
+  height: 100%;
+  padding: 6vw 10vw;
+  opacity: 0;
+  box-sizing: border-box;
+}
+.pay-container.active{
+  opacity: 1;
+}
+.pay-amount{
+  width: 100%;
+  height: auto;
+  position: relative;
+}
+.pay-amount .icon{
+  width: 16vw;
+  height: 16vw;
+  margin: 0 auto;
+}
+.pay-amount .icon img{
+  width: 100%;
+  height: 100%;
+  display: block;
+}
+.pay-amount  .pay-money{
+  width: 100%;
+  height: auto;
+  display: flex;
+  flex-direction: column;
+}
+.pay-amount  .pay-money .label{
+  flex: 1;
+  font-size: 3.4vw;
+  line-height: 10vw;
+  text-align: center;
+  color: #666;
+}
+.pay-amount  .pay-money  .mount{
+  flex: 1;
+  font-size: 3.4vw;
+  line-height: 10vw;
+  text-align: center;
+  color: #333;
+  font-weight: 600;
+}
+.pay-amount  .pay-money  .mount span{
+  font-size: 3.4vw;
+  font-weight: normal;
+}
+.pay-button{
+  width: 100%;
+  height: 10vw;
+  margin-top: 1vw;
+}
+.pay-button .btn{
+  width: 100%;
+  height: 10vw;
+  background: #09BB07;
+  line-height: 10vw;
+  text-align: center;
+  font-size: 3.4vw;
+  color: #FFF;
+  border-radius: 1.1vw;
+}
+.pay-button .btn.disabled{
+  background: #E1E1E1;
+}
+.pay-logo{
+  width: 100%;
+  height: 13vw;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  position: fixed;
+  bottom: 16vw;
+  left: 0;
+}
+.pay-logo .logo{
+  line-height: 13vw;
+  font-size: 3.6vw;
+  text-align: center;
+  background: url("/img/pay/logo@2x.png")no-repeat left top;
+}
 </style>

+ 16 - 2
src/views/shopping-mall/components/goods-share.vue

@@ -6,7 +6,11 @@
         <div class="title">
           {{ productInfo.name }}
         </div>
-        <div class="share" @click="handlerShare">
+        <div class="share" @click="handlerShare" v-if="isIns">
+          <van-image width="50%" height="60%" src="https://static.caimei365.com/app/mini-distribution/share.png"></van-image>
+          <div class="text">分享</div>
+        </div>
+        <div class="share" @click="handlerShare" v-else>
           <van-image width="50%" height="60%" src="https://static.caimei365.com/app/mini-distribution/share.png"></van-image>
           <div class="text">分享</div>
         </div>
@@ -37,6 +41,7 @@
 </template>
 
 <script>
+import { Toast } from 'vant'
 export default {
   props: {
     productInfo: {
@@ -57,9 +62,18 @@ export default {
       showShare: false
     }
   },
+  computed: {
+    isIns () {
+      return this.$route.query.isIns * 1
+    }
+  },
   methods: {
     handlerShare () {
-      this.showShare = true
+      if (this.isIns) {
+        Toast.success('点击右上角...分享好友')
+      } else {
+        this.showShare = true
+      }
     },
     handlerShow () {
       this.showShare = false

+ 1 - 8
vue.config.js

@@ -1,5 +1,5 @@
 /* eslint-disable no-dupe-keys */
-const VUE_IMG_URL = 'https://img-b.caimei365.com/'
+// const VUE_IMG_URL = 'https://img-b.caimei365.com/'
 module.exports = {
   publicPath: process.env.NODE_ENV === 'production' ? './' : './',
   outputDir: 'dist',
@@ -20,13 +20,6 @@ module.exports = {
         pathRewrite: {
           '^/api': ''
         }
-      },
-      '/api2': {
-        target: VUE_IMG_URL,
-        changeOrigin: true,
-        pathRewrite: {
-          '^/api2': ''
-        }
       }
     }
   }