Explorar el Código

商品、团餐订单bug修复-8.17

baijunde hace 3 semanas
padre
commit
59a40cb4fd

+ 5 - 1
pages/merchantDish/dish/combo.vue

@@ -28,7 +28,7 @@
 							</view>
 							<view class="row">
 								<text class="label">价格</text>
-								<input class="input" v-model="dish.price" type="digit" placeholder="输入金额" placeholder-class="ph" />
+								<input class="input" v-model="dish.price" type="digit" placeholder="输入金额" placeholder-class="ph" @blur="onPriceBlur(dish, $event)" />
 								<text class="unit">元</text>
 							</view>
 							<view class="row last">
@@ -99,6 +99,10 @@ export default {
 		}
 	},
 	methods: {
+		onPriceBlur(dish, event) {
+			const value = String((event.detail && event.detail.value) || '');
+			dish.price = value.replace(/-/g, '');
+		},
 		getPrevFormPage() {
 			const pages = getCurrentPages();
 			const prev = pages[pages.length - 2];

+ 13 - 4
pages/merchantDish/dish/form.vue

@@ -110,19 +110,19 @@
 				<view class="panel panel-single">
 					<view class="row">
 						<text class="label required">售价 (元)</text>
-						<input class="input" type="digit" :value="form.price" @input="onPriceInput('price', $event)" placeholder="请输入" placeholder-class="ph" />
+						<input class="input" type="digit" :value="form.price" @input="onPriceInput('price', $event)" @blur="onNonNegativeBlur('price', $event)" placeholder="请输入" placeholder-class="ph" />
 					</view>
 					<view class="row">
 						<text class="label required">原价 (元)</text>
-						<input class="input" type="digit" :value="form.sellingPrice" @input="onPriceInput('sellingPrice', $event)" placeholder="请输入" placeholder-class="ph" />
+						<input class="input" type="digit" :value="form.sellingPrice" @input="onPriceInput('sellingPrice', $event)" @blur="onNonNegativeBlur('sellingPrice', $event)" placeholder="请输入" placeholder-class="ph" />
 					</view>
 					<view class="row">
 						<text class="label required">可售库存</text>
-						<input class="input" type="number" :value="form.stock" @input="onPriceInput('stock', $event)" placeholder="请输入" placeholder-class="ph" />
+						<input class="input" type="number" :value="form.stock" @input="onPriceInput('stock', $event)" @blur="onNonNegativeBlur('stock', $event)" placeholder="请输入" placeholder-class="ph" />
 					</view>
 					<view class="row">
 						<text class="label">成本价 (元)</text>
-						<input class="input" type="digit" :value="form.costPrice" @input="onPriceInput('costPrice', $event)" placeholder="请输入 (选填)" placeholder-class="ph" />
+						<input class="input" type="digit" :value="form.costPrice" @input="onPriceInput('costPrice', $event)" @blur="onNonNegativeBlur('costPrice', $event)" placeholder="请输入 (选填)" placeholder-class="ph" />
 					</view>
 				</view>
 				<view class="panel panel-multi">
@@ -403,8 +403,12 @@ export default {
 			if (this.specLocked && specMode !== 'single') return '当前仅支持单规格';
 			if (specMode === 'single') {
 				if (f.price === '') return '请填写售价';
+				if (Number(f.price) < 0) return '售价不能为负数';
 				if (f.sellingPrice === '') return '请填写原价';
+				if (Number(f.sellingPrice) < 0) return '原价不能为负数';
 				if (f.stock === '') return '请填写可售库存';
+				if (Number(f.stock) < 0) return '可售库存不能为负数';
+				if (f.costPrice !== '' && Number(f.costPrice) < 0) return '成本价不能为负数';
 				return '';
 			}
 			const hasSelected = (f.specs || []).some((s) => (s.values || []).some((v) => v.selected));
@@ -455,6 +459,11 @@ export default {
 			this.form[key] = val == null ? '' : String(val);
 			this.refreshNextEnabled();
 		},
+		onNonNegativeBlur(key, e) {
+			const val = e && e.detail ? e.detail.value : this.form[key];
+			this.form[key] = val == null ? '' : String(val).replace(/-/g, '');
+			this.refreshNextEnabled();
+		},
 		toggleSpecValue(v) {
 			v.selected = !v.selected;
 			this.refreshNextEnabled();

+ 1 - 1
pages/merchantDish/orders/index.vue

@@ -341,7 +341,7 @@ export default {
 			})
 		},
 		getReserveDate(item) {
-			const value = item.reserveDate || item.appointmentDate || item.mealDate || item.deliveryDate || item.createTime || ''
+			const value = item.reservationDate || ''
 			return String(value).slice(0, 10).replace(/-/g, '.') || '--'
 		},
 		getMealLabel(item) {