Browse Source

commit -m 快捷支付

zhengjinyi 2 years ago
parent
commit
e1047acd0e
2 changed files with 51 additions and 13 deletions
  1. 0 3
      pages/user/pay/card-comfirm-sub.vue
  2. 51 10
      pages/user/pay/card-comfirm.vue

+ 0 - 3
pages/user/pay/card-comfirm-sub.vue

@@ -100,9 +100,6 @@ export default {
 			setTimeout(() => {
 				this.skeletonShow = false
 			}, 500)
-			console.log('params', this.params)
-			console.log('codeParams', this.codeParams)
-			console.log('orderId', this.orderId)
 		},
 		handleCodeTime() {
 			// 倒计时

+ 51 - 10
pages/user/pay/card-comfirm.vue

@@ -73,16 +73,27 @@
 						maxlength="11"
 					/>
 				</view>
-				<view class="card-row" v-if="pickerIndex === 2">
+				<view class="card-row picker" v-if="pickerIndex === 2">
 					<view class="form-label">有效期</view>
-					<input
-						class="form-input"
-						type="number"
-						name="input"
-						v-model="params.quickPayBankExpireTime"
-						placeholder="请输入贷记卡有效期(示例:23/04)"
-						maxlength="5"
-					/>
+					<view class="form-input">
+						<picker
+							mode="date"
+							fields="month"
+							:value="date"
+							:start="startDate"
+							:end="endDate"
+							@change="handleDateChange($event)"
+						>
+							<input
+								class="form-input"
+								type="text"
+								disabled="false"
+								v-model="handleBankExpireTime"
+								placeholder="请选择信用卡有效期"
+							/>
+						</picker>
+					</view>	
+					<view class="iconfont icon-xiayibu"></view>
 				</view>
 				<view class="card-row" v-if="pickerIndex === 2">
 					<view class="form-label">CVV2</view>
@@ -113,7 +124,11 @@
 <script>
 export default {
 	data() {
+		const currentDate = this.getDate({
+		    format: true
+		})
 		return {
+			date: currentDate,
 			skeletonShow:true,
 			pickerIndex: 1,
 			orderId: 0,
@@ -130,6 +145,7 @@ export default {
 			showCardNumber: '',
 			maxLen: 26,
 			subType: 0, // 1直接绑卡  2//首次绑卡并支付 3//确认支付
+			handleBankExpireTime:'请选择信用卡有效期',
 			cardTytpeText: '借记卡',
 			subButtonText: '下一步',
 			stateActions: [{ name: '借记卡', value: 1 }, { name: '贷记卡', value: 2 }]
@@ -141,6 +157,12 @@ export default {
 	},
 	filters: {},
 	computed: {
+		startDate() {
+		    return this.getDate('start')
+		},
+		endDate() {
+		    return this.getDate('end')
+		},
 		showClear() {
 			return this.params.quickPayBankNumber.length <= 12
 		},
@@ -222,8 +244,13 @@ export default {
 				this.$util.msg(error.msg, 2000)
 			}
 		},
+		handleDateChange(event) {
+		    //开始时间
+			console.log('event',event)
+		    this.handleBankExpireTime = this.params.quickPayBankExpireTime = event.detail.value
+		},
 		handleBindPicker(e) {
-			//选择联系人身份
+			//选择银行卡类型
 			this.cardTytpeText = this.stateActions[e.target.value].name
 			this.pickerIndex = this.stateActions[e.target.value].value
 		},
@@ -252,6 +279,20 @@ export default {
 		getOriginValue() {
 			//获取input的原始值
 			return this.showCardNumber.split(' ').join('')
+		},
+		getDate(type) {
+		    const date = new Date()
+		    let year = date.getFullYear()
+		    let month = date.getMonth() + 1
+		    let day = date.getDate()
+		    if (type === 'start') {
+		        year = year - 1
+		    } else if (type === 'end') {
+		        year = year + 1
+		    }
+		    month = month > 9 ? month : '0' + month
+		    day = day > 9 ? day : '0' + day
+		    return `${year}-${month}`
 		}
 	},
 	onShow() {