소스 검색

备注问题

shish 2 달 전
부모
커밋
c528811827

+ 14 - 1
ghsApp/src/admin/billing/index2.vue

@@ -31,7 +31,7 @@
 						<view v-if="!$util.isEmpty(globalItemData)">
 							<template v-for="(productItem, productIndex) in globalItemData">
 								<view class="item_list_title" v-if="productItem.className && productItem.className!=''">{{ productItem.className }}</view>
-								<view style="height: 175upx" :key="productIndex">
+								<view class="item-row item-row--h175" :class="{ 'item-row--remark': productItem.itemRemark }" :key="productIndex">
 									<Commondity
 										:globalCheckStock="true"
 										:selectJobType="selectJobType"
@@ -42,6 +42,7 @@
 										@goTree="goTree"
 										@delProduct="delProduct"
 										@cancelLimitBuyFn="cancelLimitBuyFn"
+										@remarkCleared="onItemRemarkCleared"
 									></Commondity>
 								</view>
 							</template>
@@ -244,6 +245,16 @@ export default {
 		}
 	},
 	methods: {
+		onItemRemarkCleared(id) {
+			if (this.$util.isEmpty(this.globalItemData)) {
+				return
+			}
+			this.globalItemData.forEach((item, index) => {
+				if (item.id == id) {
+					this.$set(this.globalItemData[index], 'itemRemark', '')
+				}
+			})
+		},
 		calcKindCount() {
 			if (!this.customData || Number(this.customData.kind) !== 3) {
 				return
@@ -326,6 +337,8 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+@import '@/static/css/item-list-row.scss';
+
 .billing_box_bg {
 	background: white;
 	height: 100%;

+ 12 - 1
ghsApp/src/admin/changePrice/changeHide.vue

@@ -71,7 +71,8 @@
                                     :info="productItem" 
                                     :isChecked="isItemChecked(productItem.id)"
                                     @checkChange="handleItemCheck(productItem, $event)"
-                                    @cancelPreSellFn="cancelPreSellFn">
+                                    @cancelPreSellFn="cancelPreSellFn"
+                                    @remarkCleared="onItemRemarkCleared">
                                 </ItemComponent>
                             </view>
                         </view>
@@ -165,6 +166,16 @@ export default {
 		this.initProduct()
 	},
 	methods: {
+        onItemRemarkCleared(id) {
+            if (this.$util.isEmpty(this.globalItemData)) {
+                return
+            }
+            this.globalItemData.forEach((item, index) => {
+                if (item.id == id) {
+                    this.$set(this.globalItemData[index], 'itemRemark', '')
+                }
+            })
+        },
         isItemChecked(itemId) {
             return this.selectedIdsSet.has(itemId);
         },

+ 5 - 1
ghsApp/src/admin/changePrice/components/Item2.vue

@@ -61,7 +61,7 @@
 		<text style="position:absolute;left:40upx;">毛利 ¥{{ info.ml ? parseFloat(info.ml) : 0 }}</text>
 		<text style="position:absolute;right:50upx;">成本 ¥{{ info.avCost?parseFloat(info.avCost):0 }}</text>
 	</view>
-	<item-remark-bar :text="info.itemRemark" :item-id="info.id" :info="info" />
+	<item-remark-bar :text="info.itemRemark" :item-id="info.id" :info="info" @cleared="onItemRemarkCleared" />
 
 </view>
 </template>
@@ -142,6 +142,10 @@ export default {
 		}
 	},
 	methods: {
+		onItemRemarkCleared(id) {
+			this.$set(this.info, 'itemRemark', '')
+			this.$emit('remarkCleared', id)
+		},
 		hideChangeFn(item,status){
 			this.$emit("hideChangeFn",item,status)
 		},

+ 5 - 1
ghsApp/src/admin/changePrice/components/changeHide.vue

@@ -37,7 +37,7 @@
 			</view>
 		</view>
 	</view>
-	<item-remark-bar :text="info.itemRemark" :item-id="info.id" :info="info" />
+	<item-remark-bar :text="info.itemRemark" :item-id="info.id" :info="info" @cleared="onItemRemarkCleared" />
 </view>
 </template>
 
@@ -69,6 +69,10 @@ export default {
 		}
 	},
 	methods: {
+		onItemRemarkCleared(id) {
+			this.$set(this.info, 'itemRemark', '')
+			this.$emit('remarkCleared', id)
+		},
 		// 切换选中状态
 		toggleCheck() {
 			// 触发父组件的 checkChange 事件,传递新的状态

+ 12 - 1
ghsApp/src/admin/changePrice/list2.vue

@@ -35,7 +35,8 @@
 								<view class="item_list_title" v-if="productItem.className && productItem.className!=''">{{ productItem.className }}</view>
 								<view class="item-row item-row--h230" :class="{ 'item-row--remark': productItem.itemRemark }" :key="productIndex">
 									<ItemComponent :isPrice="false" :info="productItem" @hideChangeFn="hideChangeFn" :ref="`productRef${productItem.id}`"
-									@savePrice="savePrice" @cancelDiscountFn="cancelDiscountFn" @cancelFullOff="cancelFullOff" @cancelPreSellFn="cancelPreSellFn" @cancelLimitBuyFn="cancelLimitBuyFn"></ItemComponent>
+									@savePrice="savePrice" @cancelDiscountFn="cancelDiscountFn" @cancelFullOff="cancelFullOff" @cancelPreSellFn="cancelPreSellFn" @cancelLimitBuyFn="cancelLimitBuyFn"
+									@remarkCleared="onItemRemarkCleared"></ItemComponent>
 								</view>
 							</template>
 
@@ -106,6 +107,16 @@ export default {
 		this.initProduct()
 	},
 	methods: {
+		onItemRemarkCleared(id) {
+			if (this.$util.isEmpty(this.globalItemData)) {
+				return
+			}
+			this.globalItemData.forEach((item, index) => {
+				if (item.id == id) {
+					this.$set(this.globalItemData[index], 'itemRemark', '')
+				}
+			})
+		},
 		goBatchChange(){
 			this.$util.pageTo({url: '/admin/changePrice/batchChange'})
 		},

+ 5 - 1
ghsApp/src/admin/item/components/item2.vue

@@ -75,7 +75,7 @@
 		</view>
 	</view>
 
-	<item-remark-bar :text="info.itemRemark" :item-id="info.id" :info="info" />
+	<item-remark-bar :text="info.itemRemark" :item-id="info.id" :info="info" @cleared="onItemRemarkCleared" />
 
 	<view class="bottom-buttons-container">
 		<text class="bottom-button" @click.stop="doPrintLabel(info,1)">价码</text>
@@ -119,6 +119,10 @@ export default {
 		}
 	},
 	methods: {
+		onItemRemarkCleared(id) {
+			this.$set(this.info, 'itemRemark', '')
+			this.$emit('remarkCleared', id)
+		},
 		hideChangeFn(item){
 			let status = this.frontHide == 0 ? 1 : 0
 			this.$emit("hideChangeFn",item,status)

+ 2 - 1
ghsApp/src/admin/item/list2.vue

@@ -52,7 +52,8 @@
 										<ItemStock :info="productItem" @moreAction="moreAction" 
 										@doPrintLabel="doPrintLabel" @cancelDiscountFn="cancelDiscountFn" @cancelFullOff="cancelFullOff"
 										:ref="`productRef${productItem.id}`" @hideChangeFn="hideChangeFn" 
-										@cancelPreSellFn="cancelPreSellFn" @cancelLimitBuyFn="cancelLimitBuyFn" @breakSingleItem="breakSingleItem">
+										@cancelPreSellFn="cancelPreSellFn" @cancelLimitBuyFn="cancelLimitBuyFn" @breakSingleItem="breakSingleItem"
+										@remarkCleared="syncItemRemark($event, '')">
 										</ItemStock>
 									</view>
 								</template>

+ 17 - 2
ghsApp/src/components/module/app-commodity2.vue

@@ -1,4 +1,5 @@
 <template>
+	<view class="commodity-wrap">
 	<view class="item-cmd_bx" @click.stop="showAddModelFn()">
 		<view class="img_bx" style="background:#eeeeee">
 			<button v-if="Number(info.limitBuy) > 0" @click.stop="cancelLimitBuyFn(info)" class="admin-button-com mini-btn blue cancel-limit-buy-btn">取消限购</button>
@@ -55,11 +56,17 @@
 			</view>
 		</view>
 	</view>
+	<item-remark-bar :text="info.itemRemark" :item-id="info.id" :info="info" @cleared="onItemRemarkCleared" />
+	</view>
 </template>
 <script>
+import ItemRemarkBar from '@/components/module/itemRemarkBar.vue'
+
 export default {
 	name: "Commodity",
-	components: {},
+	components: {
+		ItemRemarkBar
+	},
 	mixins: [],
 	props: {
 		info: {
@@ -121,6 +128,10 @@ export default {
 		this.remark = this.info.remark||''
 	},
 	methods: {
+		onItemRemarkCleared(id) {
+			this.$set(this.info, 'itemRemark', '')
+			this.$emit('remarkCleared', id)
+		},
 		cancelLimitBuyFn(info){
 			this.$emit("cancelLimitBuyFn", info)
 		},
@@ -171,9 +182,13 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+.commodity-wrap {
+	width: 100%;
+	overflow: hidden;
+}
 .item-cmd_bx {
 	position: relative;
-	margin-bottom: 20upx;
+	margin-bottom: 0;
 	.img_bx {
 		height: 140upx;
 		width: 140upx;

+ 33 - 1
ghsApp/src/components/module/itemRemarkBar.vue

@@ -35,16 +35,44 @@ export default {
 			default: true
 		}
 	},
+	data() {
+		return {
+			remarkHidden: false
+		}
+	},
 	computed: {
+		remarkSource() {
+			if (this.info && this.info.itemRemark != null && this.info.itemRemark !== undefined) {
+				return this.info.itemRemark
+			}
+			return this.text
+		},
 		displayText() {
-			const t = this.text == null ? '' : String(this.text).trim()
+			if (this.remarkHidden) {
+				return ''
+			}
+			const t = this.remarkSource == null ? '' : String(this.remarkSource).trim()
 			return t
 		},
 		showCancelBtn() {
 			return this.cancelable && !!this.itemId
 		}
 	},
+	watch: {
+		text() {
+			this.resetRemarkHidden()
+		},
+		'info.itemRemark'() {
+			this.resetRemarkHidden()
+		}
+	},
 	methods: {
+		resetRemarkHidden() {
+			const t = this.remarkSource == null ? '' : String(this.remarkSource).trim()
+			if (t) {
+				this.remarkHidden = false
+			}
+		},
 		onCancelRemark() {
 			const id = this.itemId
 			if (!id) {
@@ -56,7 +84,11 @@ export default {
 						if (this.info) {
 							this.$set(this.info, 'itemRemark', '')
 						}
+						this.remarkHidden = true
 						this.$emit('cleared', id)
+						this.$nextTick(() => {
+							this.$forceUpdate()
+						})
 						uni.showToast({
 							title: res.msg || '已取消备注',
 							duration: 1500