Przeglądaj źródła

refactor:使用优惠券

zhanghui 2 lat temu
rodzic
commit
c3e8239250

+ 2 - 58
myPages/serviceObjectFaceAuth/index.vue

@@ -3,7 +3,7 @@
     <!-- 提示内容 -->
 
     <view class="h-title">
-      <text>*请输1张服务对象人脸影像</text>
+      <text>*请输选择1张服务对象人脸影像</text>
     </view>
 
     <view class="h-upload-wrap">
@@ -27,62 +27,6 @@
       <text>下一步</text>
     </view>
 
-    <u-popup :show="errShow" :round="10"  mode="center">
-      <view class="h-popo-content">
-        <view class="h-img">
-          <u-icon name="close" color="red" size="40"></u-icon>
-        </view>
-        <view class="h-text">
-          <text>你未实名认证</text>
-        </view>
-        <view class="h-btn-wrap">
-          <view @click="errShow = false" class="h-left-btn">
-            <text>取消</text>
-          </view>
-          <view @click="getoRealNameAuth()" class="h-right-btn">
-            <text>去实名认证</text>
-          </view>
-        </view>
-      </view>
-    </u-popup>
-
-    <!-- 填写姓名 -->
-    <u-popup :show="okShow" :round="10"  mode="center">
-      <view class="h-popo-content">
-
-        <view class="h-text">
-          <u--form
-                  labelPosition="left"
-                  :model="parms"
-                  ref="form1"
-          >
-            <u-form-item
-                    label="宝贝昵称"
-                    prop="userInfo"
-                    labelWidth="auto"
-                    labelAlign="right"
-            >
-              <u--input
-                      v-model="parms.userName"
-                      placeholder="请输入宝贝昵称"
-                      border="bottom"
-                      type="text"
-                      maxlength="12"
-              ></u--input>
-            </u-form-item>
-
-          </u--form>
-        </view>
-        <view class="h-btn-wrap">
-          <view @click="okShow = false" class="h-left-btn">
-            <text>取消</text>
-          </view>
-          <view @click="gotoAutoLetter()" class="h-right-btn">
-            <text>确定</text>
-          </view>
-        </view>
-      </view>
-    </u-popup>
   </view>
 </template>
 
@@ -224,7 +168,7 @@
 
         this.$api.verifyFace(that.reqParm).then((res)=>{
           uni.hideLoading();
-          if(res.data.code == '500'){ //
+          if(res.data.data.code == '500'){ //人脸不存在
             res.facePhotoUrl = that.imgUrl1;
             res.facePhoto = that.ossImg.ossId1;
             res.facePhotos = that.parms.facePhotos;

+ 2 - 1
orderPages/bookService/index.vue

@@ -318,7 +318,7 @@ export default {
                 orderNo: this.subOrderNo,
                 password: ''
             }).then((res)=>{
-
+                that.$refs.popup.close()
                 uni.showToast({
                     title: '支付成功!'
                 });
@@ -333,6 +333,7 @@ export default {
                 this.getUserInfo()
             }).catch((res) =>{
               console.log(res)
+                that.$refs.popup.close()
               let msg = res.data.msg || '操作失败';
                 uni.showToast({
                     title: msg,

+ 5 - 4
orderPages/orderDetail/index.vue

@@ -288,7 +288,7 @@ export default {
       },
         balancePay(){
 
-            // let that = this;
+            let that = this;
             // if(this.password.length< 6 ){
             //     uni.showToast({
             //         title: "交易密码不能小于6位"
@@ -298,15 +298,16 @@ export default {
             // this.$refs.passwordPopup.close()
 
             this.$api.trade({
-                tradeNo: this.tradeNo
-                // password: this.password
+                tradeNo: this.tradeNo,
+                password: ''
             }).then((res)=>{
                 uni.showToast({
                     title: '支付成功!'
                 });
-
+                that.$refs.popup.close()
                 that.getOrderDetailByOrderId(that.orderId)
             }).catch(() =>{
+                that.$refs.popup.close()
                 uni.showToast({
                     title: "操作失败"
                 })

+ 10 - 0
orderPages/serviceItems/index.rpx.scss

@@ -300,6 +300,16 @@
   line-height: 84rpx;
 }
 
+.text-group_5 {
+  overflow-wrap: break-word;
+  color: red;
+  font-size: 28rpx;
+  font-family: PingFangSC-Regular;
+  font-weight: normal;
+  white-space: nowrap;
+  line-height: 84rpx;
+}
+
 .thumbnail_6 {
   width: 32rpx;
   height: 32rpx;

+ 44 - 10
orderPages/serviceItems/index.vue

@@ -1,7 +1,7 @@
 <template>
     <view class="content">
         <view class="page">
-                <view class="block_2 flex-row justify-start" v-for="(item,index) in projects.projectVos" :key="index" @click="clickItem(item.id)">
+                <view class="block_2 flex-row justify-start" v-for="(item,index) in projects.projectVos" :key="index" @click="clickItem(item)">
 
                     <view class="flex-col justify-center ">
                         <u-icon v-if="item.id === serviceProjectId" name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
@@ -43,10 +43,19 @@
                 <view class="flex-row justify-center" @click="goUseCoupons">
                     <view class="block_3 ">
                         <text lines="1" class="text_15">优惠券</text>
-                        <view class="image-text_4">
-                            <text lines="1" class="text-group_4">未选择</text>
-                            <u-icon name="arrow-right" color="#666" size="18"></u-icon>
+                        <view>
+                            <view class="flex-row justify-between" v-if="coupons.length>0">
+                                <view class="flex-row">
+                                    <text class="text-group_5" v-for="(iter,i) in coupons" :key="i">{{iter.name}}:-¥{{iter.discountsPrice}}</text>
+                                </view>
+                                <u-icon name="arrow-right" color="#666" size="18"></u-icon>
+                            </view>
+                            <view v-else class="image-text_4 ">
+                                <text  class="text-group_4">未选择</text>
+                                <u-icon name="arrow-right" color="#666" size="18"></u-icon>
+                            </view>
                         </view>
+
                     </view>
                 </view>
 
@@ -65,30 +74,55 @@ export default {
     },
     data() {
         return {
-            title: 'Hello',
+            coupons:[],
+            couponIds:'',
             tabIndex: 3,
             projects:{},
             serviceStationId:'',
             orderId:'',
-            serviceProjectId:''
+            serviceProject:{},
+            serviceProjectId:'',
         }
     },
     onLoad(e) {
         this.orderId=e.orderId
         this.serviceStationId=e.serviceStationId
         this.getStationById(e.serviceStationId)
+
+        uni.$off('getUseCoupons')
+        uni.$on('getUseCoupons',this.getUseCoupons)
+
     },
+
     methods: {
 
+        getUseCoupons(e){
+            console.log('++++++++getUseCoupons+++++++++++++++',e)
+            this.coupons= e
+            this.couponIds = ''
+            for (let eElement of e) {
+                this.couponIds += eElement.id + ','
+            }
+            if (this.couponIds.length>0){
+                this.couponIds = this.couponIds.substring(0,this.couponIds.length-1)
+            }
+        },
+
         goUseCoupons(){
+            if (this.serviceProjectId.length === 0){
+                uni.$u.toast('请先选择服务项目')
+                return
+            }
+
             uni.navigateTo({
-                url: 'orderPages/useCoupons/index'
+                url: '/orderPages/useCoupons/index?standardPrice='+this.serviceProject.standardPrice
             })
 
         },
 
-        clickItem(id){
-            this.serviceProjectId = id
+        clickItem(item){
+            this.serviceProjectId = item.id
+            this.serviceProject = item
         },
 
         addChildProject(){
@@ -100,7 +134,7 @@ export default {
                 serviceProjectId:this.serviceProjectId,
                 servicePersonId:this.projects.personId,
                 serviceStationId:this.serviceStationId,
-                couponIds:''
+                couponIds:this.couponIds
             }).then(res=>{
                 uni.navigateTo({
                     url:'/orderPages/orderDetail/index?id='+ this.orderId

+ 5 - 2
orderPages/useCoupons/index.rpx.scss

@@ -41,11 +41,11 @@
   height: 188rpx;
 }
 .h-center-content{
-  width: 398rpx;
+  width: 298rpx;
   height: 188rpx;
 }
 .h-right-content{
-  width: 88rpx;
+  width: 188rpx;
   height: 188rpx;
 }
 .money{
@@ -103,3 +103,6 @@
 .row-list:first-child{
   margin-top: 0;
 }
+.grayscale{
+  filter: grayscale(100%);
+}

+ 2 - 2
orderPages/useCoupons/index.vue

@@ -100,8 +100,8 @@ export default {
               }
           }
           uni.$emit('getUseCoupons',useCoupons)
-          uni.redirectTo({
-              url:'/orderPages/serviceItems/index'
+          uni.navigateBack({
+              data:1
           })
       },
 

+ 10 - 4
pages/order/index.vue

@@ -206,6 +206,8 @@
 				this.tabIndex = uni.getStorageSync('orderListIndex')
 			}
 			uni.removeStorageSync('orderListIndex');
+
+			this.$refs.MescrollItem[this.tabIndex].downCallback()
 		},
 
 		methods: {
@@ -278,9 +280,10 @@
 				if (this.openType == 2){
 					//支付预约费用
 					this.$api.balancePay({
-						orderNo: this.appointmentOrder.subOrderNo
-						// password: this.password
+						orderNo: this.appointmentOrder.subOrderNo,
+						password: ''
 					}).then((res)=>{
+						that.$refs.popup.close()
 						uni.showToast({
 							title: '支付成功'
 						})
@@ -288,6 +291,7 @@
 						that.getUserInfo()
 						that.password = ''
 					}).catch((err) =>{
+						that.$refs.popup.close()
 						uni.showToast({
 							title: err.msg,
 							icon:'error'
@@ -298,9 +302,10 @@
 				}else {
 					//支付子订单费用
 					this.$api.trade({
-						tradeNo: this.tradeNo
-						// password: this.password
+						tradeNo: this.tradeNo,
+						password: ''
 					}).then((res)=>{
+						that.$refs.popup.close()
 						uni.showToast({
 							title: '支付成功'
 						})
@@ -308,6 +313,7 @@
 						that.getUserInfo()
 						that.password = ''
 					}).catch((err) =>{
+						that.$refs.popup.close()
 						uni.showToast({
 							title: err.msg,
 							icon:'error'