wangn 5 лет назад
Родитель
Сommit
f526bf35e4

+ 8 - 0
hdApp/src/api/admin/index.js

@@ -0,0 +1,8 @@
+import https from '@/plugins/luch-request_0.0.7/request'
+
+/** *
+ * 广告列表  b
+ */
+export const adminSetPayPassword = data => {
+	return https.get('/admin/set-pay-password', data)
+}

+ 8 - 1
hdApp/src/api/purchase/index.js

@@ -50,8 +50,15 @@ export const createPurchaseOrderApi = async data => {
 };
 
 /** *
- * 待结款 - 微信支付 purchase-clear/wx-pay
+ * 待结款 - 微信支付 purchase/balance-pay
  */
  export const purchaseClearWxPay = async data => {
 	return https.post("/purchase-clear/wx-pay", data);
+};
+
+/** *
+ * 余额支付
+ */
+ export const purchaseBalancePay = async data => {
+	return https.get("/purchase/balance-pay", data);
 };

+ 7 - 0
hdApp/src/pages.json

@@ -671,6 +671,13 @@
 						"enablePullDownRefresh": true
 					}
 				},
+        {
+					"path": "setPsd",
+					"style": {
+						"navigationBarTitleText": "设置密码",
+						"enablePullDownRefresh": true
+					}
+				},
         {
 					"path": "wechatPay",
 					"style": {

+ 224 - 0
hdApp/src/pagesPurchase/components/keyboard.vue

@@ -0,0 +1,224 @@
+<template>
+  <div class="keyboard">
+    <bottom-popup
+      class="popup-wrap"
+      :show="show"
+      :mask="maskShow"
+      maskBgcolor="none"
+      @close="close"
+    >
+      <ul
+        class="_password"
+        @click="inFocus"
+        v-if="psdShow"
+      >
+        <li
+          v-for="(item, index) in Psdlist"
+          :key="index"
+          :class="item.class"
+        ></li>
+      </ul>
+      <input
+        type="password"
+        class="_inputHidden"
+        ref="inputPsd"
+      >
+      <div class="ui-keyboard">
+        <ul class="ui-keyboard-numbers">
+          <li
+            :class="{'zero': item == 0}"
+            v-for="(item, index) in keyLeftData"
+            :key="index"
+            @click="clickKeyFn(item)"
+          >{{ item }}</li>
+        </ul>
+        <ul class="ui-keyboard-btn">
+          <li
+            class="btn-del"
+            @click="del"
+          >
+            <i class="iconfont iconshanchu"></i>
+          </li>
+          <li
+            class="btn-ok"
+            @click="comfirm"
+          >完成</li>
+        </ul>
+      </div>
+    </bottom-popup>
+  </div>
+</template>
+
+<script>
+import BottomPopup from '@/components/plugin/bottom-popup'
+export default {
+  name: 'keyboard',
+  components: {
+    BottomPopup,
+  },
+  props: {
+    show: {
+      type: Boolean,
+      default: false
+    },
+    type: {
+      type: String,
+      default: '1'
+    },
+    psdShow: {
+      type: Boolean,
+      default: false
+    },
+    maskShow: {
+      type: Boolean,
+      default: true
+    }
+  },
+  data () {
+    return {
+      keyLeftData: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.'],
+      keyContent: '',
+      Psdlist: [{ class: '' }, { class: '' }, { class: '' }, { class: '' }, { class: '' }, { class: '' }]
+    }
+  },
+  methods: {
+    inFocus () {
+      if (this.type === '1') {
+        this.keyContent = ''
+        this.Psdlist = [{ class: '' }, { class: '' }, { class: '' }, { class: '' }, { class: '' }, { class: '' }];
+      }
+    },
+    close () {
+      if (this.type === '1') {
+        this.keyContent = ''
+        this.Psdlist = [{ class: '' }, { class: '' }, { class: '' }, { class: '' }, { class: '' }, { class: '' }];
+      }
+      // this.$emit('closeKey')
+    },
+    // 点击数字键盘
+    clickKeyFn (val) {
+      if (val !== '.') {
+        let num = 6
+        if (this.keyContent.length < num) {
+          this.keyContent += val
+        }
+        console.log('this.type===>', this.type)
+        if (this.type === '1') {
+          for (let i = 0; i < num; i++) {
+            if (this.keyContent[i]) {
+              this.Psdlist[i].class = 'active'
+            } else {
+              this.Psdlist[i].class = ''
+            }
+          }
+        }
+        this.$emit('clickKey', this.keyContent)
+      }
+    },
+    // 确认
+    comfirm () {
+      this.$emit('comfirm')
+    },
+    // 删除
+    del () {
+      if (this.type === '1') {
+        this.keyContent = this.keyContent.substr(0, this.keyContent.length - 1);
+        this.Psdlist[this.keyContent.length].class = ''
+      } else {
+        this.$emit('del')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.popup-wrap {
+  ._password {
+    height: 140upx;
+    width: 100vw;
+    // background: pink;
+    padding: 20upx;
+    display: flex;
+    box-sizing: border-box;
+    & > li {
+      flex: 1;
+      height: 100%;
+      border: 1px solid #ddd;
+      border-right: none;
+    }
+    & > li:last-child {
+      border-right: 1px solid #ddd;
+    }
+    & > .active {
+      position: relative;
+      &::after {
+        content: "";
+        position: absolute;
+        top: 50%;
+        left: 50%;
+        border-radius: 20upx;
+        transform: translate(-50%, -50%);
+        height: 40upx;
+        width: 40upx;
+        background: #666;
+      }
+    }
+  }
+  ._inputHidden {
+    width: 1px;
+    height: 1px;
+    min-height: 1px;
+    opacity: 0;
+    border: 0;
+  }
+  .ui-keyboard {
+    @include disFlex(center, center);
+    padding: 0 20px 20px 20px;
+    background-color: $backColor;
+    box-shadow: 0 -8px 16px #ddd;
+    // 左侧键盘
+    .ui-keyboard-numbers {
+      width: 78%;
+      display: flex;
+      align-items: center;
+      flex-wrap: wrap;
+      li {
+        width: calc(33.33% - 20px);
+      }
+      li.zero {
+        width: calc(66.66% - 20px);
+      }
+    }
+    // 右侧键盘
+    .ui-keyboard-btn {
+      width: 22%;
+      li {
+        margin-right: 0;
+      }
+      li.btn-ok {
+        height: 310px;
+        color: #fff;
+        background-color: $mainColor;
+        // line-height: 310px
+      }
+    }
+    li {
+      @include disFlex(center, center);
+      height: 90px;
+      // line-height: 90px;
+      text-align: center;
+      border-radius: 10px;
+      background-color: #fff;
+      margin-top: 20px;
+      margin-right: 20px;
+      font-size: 38px;
+      font-weight: bold;
+      box-shadow: 0 2px 10px #ddd;
+    }
+    li:active {
+      background-color: rgba(0, 0, 0, 0.1);
+    }
+  }
+}
+</style>

+ 4 - 0
hdApp/src/pagesPurchase/gathering.vue

@@ -323,6 +323,10 @@ export default {
 .details-select {
   margin-right: 20upx;
   display: inline-block;
+  .iconweixuanzhong,
+  .iconxuanzhong {
+    font-size: 40upx !important;
+  }
   .iconxuanzhong {
     color: $mainColor !important;
   }

+ 8 - 8
hdApp/src/pagesPurchase/order.vue

@@ -34,7 +34,7 @@
               <view
                 class="btn_entrance"
                 v-if="Number(item.debtAmount) <= 0"
-                @click="settleAccounts(item.debtAmount)"
+                @click="settleAccounts(item)"
               >
                 结账
               </view>
@@ -85,13 +85,11 @@
 </template>
 
 <script>
-import Tabs from "@/components/plugin/tabs";
 import OrderItem from "./orderItem";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import { ghsList, purchaseList } from "@/api/purchase/index";
 export default {
   components: {
-    Tabs,
     AppWrapperEmpty,
     OrderItem
   },
@@ -122,7 +120,7 @@ export default {
   methods: {
     enter () {
       uni.navigateTo({
-        url: '/pagesPurchase/cosNext'
+        url: '/pagesPurchase/wechatPay'
       })
     },
     getGHSList () {
@@ -148,10 +146,10 @@ export default {
       }).catch(err => { console.log(err) })
     },
     // 结账
-    settleAccounts (num) {
-      console.log('点击了结账', num)
+    settleAccounts (item) {
+      console.log('点击了结账', item)
       uni.navigateTo({
-        url: '/pagesPurchase/gathering'
+        url: '/pagesPurchase/gathering?avator=' + item.avatar + '&name=' + item.name
       })
     }
   }
@@ -164,7 +162,9 @@ export default {
     height: 80upx;
     line-height: 80upx;
     & > view {
-      padding: 0 80upx;
+      // padding: 0 80upx;
+      width: 50%;
+      text-align: center;
       font-size: 28upx;
       color: #666;
       display: inline-block;

+ 131 - 0
hdApp/src/pagesPurchase/setPsd.vue

@@ -0,0 +1,131 @@
+<template>
+  <view class="setPsd">
+    <ul
+      class="_password"
+      @click="inFocus"
+    >
+      <li
+        v-for="(item, index) in Psdlist"
+        :key="index"
+        :class="item.class"
+      ></li>
+    </ul>
+    <view>
+      <view
+        class="confirmBtn"
+        @click="changePsd"
+      >确认</view>
+    </view>
+    <!-- 键盘 -->
+    <keyboard-module
+      :show="keyShow"
+      @comfirm="hideKeyFn"
+      @clickKey="clickKeyFn"
+      :type="type"
+      @del="delFn"
+      :maskShow="false"
+    />
+  </view>
+</template>
+
+<script>
+import keyboardModule from './components/keyboard'
+import adminSetPayPassword from '@/api/admin/index'
+export default {
+  components: {
+    keyboardModule,
+  },
+  data () {
+    return {
+      Psdlist: [{ class: '' }, { class: '' }, { class: '' }, { class: '' }, { class: '' }, { class: '' }],
+      keyShow: true,
+      type: '2',
+      keyContent: ''
+    }
+  },
+  methods: {
+    inFocus () {
+      this.keyContent = ''
+      this.Psdlist = [{ class: '' }, { class: '' }, { class: '' }, { class: '' }, { class: '' }, { class: '' }];
+    },
+    hideKeyFn () { },
+    clickKeyFn (val) {
+      console.log(val)
+      this.keyContent = val
+      let num = 6
+      for (let i = 0; i < num; i++) {
+        if (this.keyContent[i]) {
+          this.Psdlist[i].class = 'active'
+        } else {
+          this.Psdlist[i].class = ''
+        }
+      }
+    },
+    delFn () {
+      this.keyContent = this.keyContent.substr(0, this.keyContent.length - 1);
+      this.Psdlist[this.keyContent.length].class = ''
+      console.log('点击了删除按钮', this.keyContent)
+    },
+    // 修改密码
+    changePsd () {
+      if (this.keyContent.length === 6) {
+        adminSetPayPassword({ password: this.keyContent }).then(res => {
+          console.log(res)
+          uni.navigateBack({})
+        }).catch(err => { console.log(err) })
+      } else {
+        this.$msg('请输入6位数密码')
+      }
+
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.setPsd {
+  ._password {
+    margin-top: 20%;
+    height: 140upx;
+    width: 100vw;
+    // background: pink;
+    padding: 20upx;
+    display: flex;
+    box-sizing: border-box;
+    & > li {
+      flex: 1;
+      height: 100%;
+      border: 1px solid #ddd;
+      border-right: none;
+    }
+    & > li:last-child {
+      border-right: 1px solid #ddd;
+    }
+    & > .active {
+      position: relative;
+      &::after {
+        content: "";
+        position: absolute;
+        top: 50%;
+        left: 50%;
+        border-radius: 20upx;
+        transform: translate(-50%, -50%);
+        height: 40upx;
+        width: 40upx;
+        background: #666;
+      }
+    }
+  }
+  .confirmBtn {
+    height: 88upx;
+    width: 140upx;
+    background: #3385ff;
+    text-align: center;
+    line-height: 88upx;
+    margin: 10% auto;
+    border-radius: 8px;
+    font-size: 32upx;
+    color: #ffffff;
+  }
+}
+</style>

+ 118 - 3
hdApp/src/pagesPurchase/wechatPay.vue

@@ -2,6 +2,7 @@
   <!-- 各种回调页面 -->
   <div class="app-content awaitPayYe awaitPayYe">
     <div class="callback-wrap">
+      <div class="bg_01"></div>
       <div class="callback-blo">
         <!-- 使用icon -->
         <!-- 待支付 -->
@@ -10,6 +11,7 @@
             <i class="iconfont icondaizhifu"></i>
           </div>
         </block>
+        <view class="wait">待确认</view>
         <!-- 待支付 -->
         <block>
           <div class="price">
@@ -23,26 +25,78 @@
             <button
               class="button-com green pay-wx"
               @click="_wxPay"
+              v-if="type === '2'"
+            >延期支付</button>
+            <button
+              class="button-com green pay-wx"
+              @click="_wxPay"
+              v-if="type ==='1' || type === '2'"
             >微信支付</button>
+            <button
+              class="button-com green pay-wx"
+              @click="_balancePay"
+              v-if="type === '2'"
+            >余额支付</button>
           </div>
         </block>
       </div>
     </div>
+    <!-- 键盘 -->
+    <keyboard-module
+      :show="keyShow"
+      @comfirm="hideKeyFn"
+      @clickKey="clickKeyFn"
+      :psdShow="true"
+      :type="_type"
+      @closeKey="closeKeyFn"
+    />
+    <!-- 弹窗 - 未设置支付密码 -->
+    <alert-module
+      :show="setPassModal"
+      btnText="设置"
+      btnColor="#FF2842"
+      padding="66rpx 24rpx 66rpx 24rpx"
+      @click="hideAlert"
+    >
+      <div class="go-login-module">
+        <div>请先设置支付密码!</div>
+      </div>
+    </alert-module>
   </div>
 </template>
 
 <script>
-import { purchaseClearCreateOrder, purchaseClearWxPay } from "@/api/purchase/index";
+import { purchaseClearCreateOrder, purchaseClearWxPay, purchaseBalancePay } from "@/api/purchase/index";
+import keyboardModule from './components/keyboard'
+import AlertModule from "@/components/plugin/alert";
+import { mapGetters } from "vuex";
 import wexinPay from "@/utils/pay/wxPay";
 export default {
   name: "callback",
+  components: {
+    keyboardModule,
+    AlertModule
+  },
   data () {
     return {
-      options: {}
+      options: {},
+      type: '',
+      keyShow: false,
+      modalForm: {
+        payPassword: ''
+      },
+      psdKey: '',
+      orderSn: '',
+      setPassModal: false,
+      _type: '1'
     };
   },
   onLoad (options) {
     this.getWeChat(options.id)
+    this.type = options.type
+  },
+  computed: {
+    ...mapGetters(["getLoginInfo", 'getDictionariesInfo']),
   },
   methods: {
     getWeChat (id) {
@@ -63,8 +117,47 @@ export default {
         url: '/pagesPurchase/particulars'
       })
     },
+    // 关闭键盘
+    closeKeyFn () {
+      this.keyShow = false
+    },
     getError () {
       this.$msg("支付失败!");
+    },
+    _balancePay () {
+      console.log(this.getLoginInfo, this.getDictionariesInfo)
+      if (this.getLoginInfo.payPassword) {
+        this.keyShow = true
+      } else {
+        this.setPassModal = true
+      }
+    },
+    // 设置支付密码
+    hideAlert () {
+      uni.navigateTo({
+        url: '/pagesPurchase/setPsd'
+      })
+    },
+    // 点击数字键盘
+    clickKeyFn (val) {
+      this.psdKey = val
+      console.log(this.psdKey)
+    },
+    // 点击了完成
+    hideKeyFn () {
+      if (this.psdKey.length === 6) {
+        let data = {
+          orderSn: 'CG_CS26316743',
+          password: this.psdKey
+        }
+        purchaseBalancePay(data).then(res => {
+          uni.navigateTo({
+            url: '/pagesPurchase/particulars'
+          })
+        }).catch(err => { console.log(err) })
+      } else {
+        this.$msg('请输入六位数支付密码')
+      }
     }
   }
 };
@@ -74,10 +167,25 @@ export default {
 .app-content {
   .callback-wrap {
     padding-top: 50px;
-    background-image: url("../../src/static/images/callback/bg.png");
+    // background-image: url("../../src/static/images/callback/bg.png");
     background-repeat: no-repeat;
     background-size: 100% auto;
+    position: relative;
+    .bg_01 {
+      position: absolute;
+      top: 0;
+      left: 0;
+      width: 100vw;
+      height: 290upx;
+      background: #3385ff;
+      border-radius: 0rpx 0rpx 83rpx 83rpx;
+      z-index: 1;
+    }
     .callback-blo {
+      position: absolute;
+      z-index: 9;
+      left: 50%;
+      transform: translateX(-50%);
       width: 90%;
       margin: 0 auto;
       padding: 70px 0;
@@ -122,4 +230,11 @@ export default {
     }
   }
 }
+// 待确认样式
+.wait {
+  color: #ffa92e;
+  font-size: 40upx;
+  font-weight: 700;
+  margin: 20upx 0;
+}
 </style>