gx
queenwuli
2021-01-15 4b80c98ef5fda8d6358778f2efe8bb35cb20ccf9
hive-app/pages/workbench/confirmService.vue
@@ -55,14 +55,28 @@
      <view class="footer">
         <button :disabled="isDisabled" class="blue-btn" @click="createOrder">提交服务单</button>
      </view>
      <uni-popup ref="popup" type="center" @change="popupChange">
         <view class="popup-container">
            <view class="popup-title">请输入资金密码</view>
            <password-input :numLng='password'></password-input>
         </view>
      </uni-popup>
      <number-keyboard ref='KeyboarHid' :topBarShow="false" @input='changePwd' psdLength='6' :value="password"></number-keyboard>
   </view>
</template>
<script>
   import numberKeyboard from '@/components/number-keyboard/number-keyboard.vue'
   import passwordInput from '@/components/password-input/password-input.vue'
   import DateTimePicker from '../../components/bory-dateTimePicker/bory-dateTimePicker.vue'
   import uniPopup from '@/components/uni-popup/uni-popup.vue'
   export default{
      components:{
         DateTimePicker
         DateTimePicker,
         numberKeyboard,
         passwordInput,
         uniPopup
      },
      data(){
         return{
@@ -73,7 +87,9 @@
            curEmployee: {},
            memberInfo: {},
            remark: '',
            isDisabled: false
            isDisabled: false,
            password: '',
            isExistPwd: false
         }
      },
      computed:{
@@ -98,9 +114,17 @@
      onLoad(options) {
         this.id = options.id;
         this.list = JSON.parse(decodeURIComponent(options.list));
         this.loadIsExistFundPassword();
         this.loadMemberInfo();
      },
      methods:{
         loadIsExistFundPassword(){
            this.$httpUtils.request('/api/vip/isExistFundPassword/'+this.id).then((res) => {
               if(res.status == 200){
                  this.isExistPwd = res.mapInfo.isExist;
               }
            })
         },
         loadMemberInfo(){
            this.$httpUtils.request('/api/vip/findVipInfoById/'+this.id).then((res) => {
               if(res.status == 200){
@@ -128,6 +152,9 @@
            this.loadEmployeeList()
         },
         employeeChange(e){
            if(!this.employeeList.length){
               return;
            }
            this.curEmployee = this.employeeList[e.detail.value];
         },
         valid(){
@@ -135,16 +162,43 @@
               this.$toast.info('请预约时间');
               return false
            }
            if(!this.curEmployee.id){
            if(!this.curEmployee || !this.curEmployee.id){
               this.$toast.info('请预约美疗师');
               return false
            }
         },
         // 弹窗状态change
         popupChange(e) {
            if(!e.show){
               this.password = '';
               this.$refs.KeyboarHid.close();
            }
         },
         changePwd(val){
            this.password = val;
            if(this.password.length == 6){
               this.submit()
            }
         },
         createOrder(){
            if(this.valid() === false){
               return;
            }
            this.isDisabled = true;
            // 未设置资金密码,不弹出密码框
            if(!this.isExistPwd){
               this.submit();
               return;
            }
            this.$refs.popup.open();
            setTimeout(() => {
               this.$refs.KeyboarHid.open()
            }, 50);
         },
         submit(){
            if(this.isRequesting){
               return;
            }
            this.isRequesting = true;
            let projItems = this.list.map((item) => {
               return {
                  "count": item.num,
@@ -157,17 +211,20 @@
               remark: this.remark,
               totalTime: this.totalTime,
               yyTime: this.yyTime,
               vipId: this.id
               vipId: this.id,
               password: this.password
            }, 'POST').then((res) => {
               if(res.status == 200){
                  uni.navigateTo({
                     url: './submitSucceed?type=2'
                  })
               }else{
                  this.password = '';
               }
               this.$toast.info(res.info);
               this.isDisabled = false;
               this.isRequesting = false;
            }).catch(() => {
               this.isDisabled = false;
               this.isRequesting = false;
            })
         }
      }
@@ -175,6 +232,22 @@
</script>
<style>
   .popup-container{
      background: #FFFFFF;
      width: 500rpx;
      padding: 20px 20px 30px;
      border-radius: 6px;
   }
   .popup-title{
      font-size: 16px;
      text-align: center;
      margin-bottom: 15px;
   }
   .popup-sub-title{
      font-size: 15px;
      text-align: center;
      padding: 10px 0;
   }
   page{
      background: #F6F6F8;
      padding-top: 10px;