فهرست منبع

优化商品管理图片展示;时间选择解决报错

lishanshan 8 ماه پیش
والد
کامیت
0cd86aab8f
4فایلهای تغییر یافته به همراه49 افزوده شده و 25 حذف شده
  1. 0 1
      components/dengrq-datetime-picker/dateSelector/index.js
  2. 6 2
      pages/product/creatProduct.vue
  3. 32 11
      pages/product/details.vue
  4. 11 11
      pages/product/usable.vue

+ 0 - 1
components/dengrq-datetime-picker/dateSelector/index.js

@@ -26,7 +26,6 @@ export default {
 				type:'year'
 			}],
 			currentIndex:null,
-			isYear:false
     };
   },
   props: {

+ 6 - 2
pages/product/creatProduct.vue

@@ -939,7 +939,7 @@ export default {
 							});
 						} else {
 							uni.showToast({
-								title: res.message,
+								title: res.data.message,
 								icon: 'none'
 							});
 						}
@@ -959,7 +959,7 @@ export default {
 						} else {
 							uni.showToast({
 								icon: 'none',
-								title: res.data.sessage
+								title: res.data.message
 							})
 						}
 						uni.removeStorage({
@@ -1635,4 +1635,8 @@ export default {
 	flex-direction: column;
 	flex-wrap: wrap;
 }
+
+::v-deep .editor-container {
+	height: 260rpx;
+}
 </style>

+ 32 - 11
pages/product/details.vue

@@ -26,8 +26,13 @@
 				<view class="img_box">
 					<span class="line">商品封面图</span>
 					<view class="img_list">
-						<view class="img">
-							<image :src="form.productImage" mode=""></image>
+						<view v-for="(val, index) in fmImageList" :key="index">
+							<view class="img">
+								<image :src="val.url" mode=""
+									style="width: 140rpx;height:140rpx;border-radius: 4px; border: 1px solid #ebecee;margin-right:20rpx;margin-bottom:10rpx">
+								</image>
+							</view>
+							<!-- <image v-for="(val, index) in fmImageList" :key="index" :src="form.productImage" mode=""></image> -->
 						</view>
 					</view>
 				</view>
@@ -52,8 +57,8 @@
 							<image :src="item" mode=""></image>
 						</view>
 					</view>
-					<view class="img_list" v-if="form.richText">
-						<rich-text style="width: 100vw;" :nodes="form.richText"></rich-text>
+					<view class="item" v-if="form.richText">
+						<rich-text :nodes="form.richText"></rich-text>
 					</view>
 				</view>
 				<view class="data" style="border:none">
@@ -133,12 +138,15 @@
 				</view> -->
 				<view class="data">
 					<span class="span">可用时间</span>
-					<view class="" v-if="form.availableStartDate">
-						{{ form.availableStartDate.slice(0, 10) }}-{{ form.availableEndDate.slice(0, 10) }}
+					<view v-if="form.useType == '3'">
+						长期有效
 					</view>
-					<view class="" v-else>
+					<view class="" v-if="form.useType == '1' && form.expirationDays">
 						购买后{{ form.expirationDays }}天失效
 					</view>
+					<view class="" v-if="form.useType == '2' && form.availableStartDate">
+						{{ form.availableStartDate.slice(0, 10) }} — {{ form.availableEndDate.slice(0, 10) }}
+					</view>
 				</view>
 				<view class="data">
 					<span class="span">预约规则</span>{{ form.preBook == 0 ? '不需要预约' : '用户需要提前预约' }}
@@ -183,7 +191,8 @@ export default {
 			ruleList: [],
 			productId: '',
 			imageHttp: 'http://192.168.0.36:8080/jeecg-boot/',
-			specItems: []
+			specItems: [],
+			fmImageList: []
 		}
 	},
 	methods: {
@@ -201,10 +210,21 @@ export default {
 			if (res.data.code == 200) {
 				this.form = res.data.result
 				console.log(this.form)
-				this.detailImages = res.data.result.detailImages.split(',')
+				if (res.data.result.detailImages) {
+					this.detailImages = res.data.result.detailImages.split(',')
+				}
 				this.form.groupingName = res.data.result.groupingName || ''
 				this.form.serviceDescription = res.data.result.serviceDescription || []
 				this.form.sellingDay = res.data.result.sellingDay || []
+				if (res.data.result.productImage) {
+					let productImagelist = []
+					productImagelist = res.data.result.productImage.split(',')
+					productImagelist.map(item => {
+						this.fmImageList.push({
+							url: item
+						})
+					})
+				}
 				if (this.form.specItems) {
 					this.form.specItems.forEach(item => {
 						if (item.replaced) {
@@ -364,14 +384,15 @@ export default {
 		.img_list {
 			display: flex;
 			flex-wrap: wrap;
-			// justify-content: space-between;
-			gap: 27rpx;
+			justify-content: space-between;
+			// gap: 27rpx;
 
 			.img {
 				flex: 0 0 calc(25% - 27rpx);
 				height: 140rpx;
 				border-radius: 12rpx;
 				overflow: hidden;
+				margin-bottom: 25rpx;
 
 				image {
 					width: 140rpx;

+ 11 - 11
pages/product/usable.vue

@@ -15,27 +15,27 @@
 				<view class="title">
 					可使用日期
 				</view>
+				<u-radio @change="radioChange" name="long" style="width: 100%;margin-top: 16rpx;">
+					<view class="title now">
+						长期有效
+					</view>
+				</u-radio>
 				<u-radio @change="radioChange" name="now"
-					style="width: 100%;height:65rpx; flex;align-items: center;border-bottom: 1px solid #eeeeee;">
+					style="width: 100%;height:65rpx; flex;align-items: center;margin-top: 16rpx;">
 					<view class="title now">
-						购买后立即生效,有效时间
-						<input type="number" style="background-color:#F7F8FC ;" v-model="expirationDays" /> 天
+						购买后立即生效,生效后
+						<input type="number" style="background-color:#F7F8FC;margin-top: 16rpx;" v-model="expirationDays" /> 天失效
 					</view>
 				</u-radio>
-				<u-radio @change="radioChange" name="date" style="width: 100%;margin-top: 16rpx;">
+				<u-radio @change="radioChange" name="date" style="width: 100%;margin-top: 16rpx;;border-bottom: 1px solid #eeeeee;">
 					<view class="title now">
-						指定消费日期
+						固定时间段
 						<view class="picker">
 							<u-input placeholder="去设置" v-model="showDate" @click="selectDate" />
 							<u-icon name="arrow-right" style="margin-left: 17rpx;"></u-icon>
 						</view>
 					</view>
 				</u-radio>
-				<u-radio @change="radioChange" name="long" style="width: 100%;margin-top: 16rpx;">
-					<view class="title now">
-						长期可用
-					</view>
-				</u-radio>
 			</u-radio-group>
 		</view>
 		<view class="foot">
@@ -126,7 +126,7 @@
 					this.back()
 				} else {
 					uni.showToast({
-						title: '选择售卖时间',
+						title: '选择时间',
 						icon: 'none'
 					});
 				}