Kaynağa Gözat

优化可用时间

lishanshan 7 ay önce
ebeveyn
işleme
e8431df779
1 değiştirilmiş dosya ile 30 ekleme ve 25 silme
  1. 30 25
      pages/product/creatProduct.vue

+ 30 - 25
pages/product/creatProduct.vue

@@ -267,7 +267,7 @@
 				</view>
 			</view>
 		</view>
-		<rangTime ref="rangTime" :mode="mode" @onSubmit="onEndTimeChange" :title="timeTitle"/>
+		<!-- <rangTime ref="rangTime" :mode="mode" @onSubmit="onEndTimeChange" :title="timeTitle"/> -->
 		<refund v-show="isRefund" :Confirm="form.refundConfirm" :Label="form.refundLabel" @confirm="saveFound"
 			@close="cutRule" />
 		<view class="popup" v-if="isSelectType">
@@ -534,6 +534,33 @@
 				})
 
 			},
+			// 更新时间
+			updateRangeTime() {
+				uni.getStorage({
+					key: 'smdate',
+					success: (res) => {
+						if (res.data.useType == 2) {
+							this.showSellDate = res.data.availableStartDate + '-' + res.data.availableEndDate
+							this.form.availableStartDate = res.data.availableStartDate
+							this.form.availableEndDate = res.data.availableEndDate
+							this.form.expirationDays = null
+							this.form.useType = 2
+						} else if (res.data.useType == 1) {
+							this.form.expirationDays = res.data.expirationDays
+							this.form.availableEndDate = null
+							this.form.availableStartDate = null
+							this.form.useType = 1
+							this.$nextTick(() => {
+								this.showSellDate = res.data.expirationDays + '天后失效'
+							});
+						} else if (res.data.useType == 3) {
+							this.form.useType = 3
+							this.showSellDate = '长期有效'
+						}
+
+					}
+				})
+			},
 			// 保存退款规则
 			saveFound(rules) {
 				this.form.refundConfirm = rules.refundConfirm.refundConfirm
@@ -798,6 +825,7 @@
 			this.getProductGroup()
 			this.getLeftTree()
 			this.getForm()
+			this.updateRangeTime()
 		},
 		onLoad(options) {
 			if (options.productId) {
@@ -816,30 +844,7 @@
 					that.form.merchantId = res.data.merchantId
 				}
 			})
-			uni.getStorage({
-				key: 'smdate',
-				success: (res) => {
-					if (res.data.availableEndDate) {
-						this.showSellDate = res.data.availableStartDate + '-' + res.data.availableEndDate
-						this.form.availableStartDate = res.data.availableStartDate
-						this.form.availableEndDate = res.data.availableEndDate
-						this.form.expirationDays = null
-						this.form.useType = 2
-					} else if (res.data.expirationDays) {
-						this.form.expirationDays = res.data.expirationDays
-						this.form.availableEndDate = null
-						this.form.availableStartDate = null
-						this.form.useType = 1
-						this.$nextTick(() => {
-							this.showSellDate = res.data.expirationDays + '天后失效'
-						});
-					}else if(res.data.useType == 3){
-						this.form.useType = 3
-						this.showSellDate = '长期有效'
-					}
-
-				}
-			})
+		 that.updateRangeTime()
 			uni.getStorage({
 				key: 'group',
 				success: function(res) {