diff --git a/pages/tally/abnormalManageList.vue b/pages/tally/abnormalManageList.vue index 712cca0..e2bf678 100644 --- a/pages/tally/abnormalManageList.vue +++ b/pages/tally/abnormalManageList.vue @@ -51,38 +51,60 @@ </view> </view> <view class="input-box row verCenter" style="flex: 0 0 100%;" @click="open()"> - <text class="label">异常编码:</text> + <text class="label" @click="open()">异常编码:</text> <text class="text">{{item.abnormal_number}}</text> </view> - <view class="input-box row verCenter" style="flex: 0 0 100%;"> - <text class="label">订单型号:</text> - <text class="text">{{item.order_model}}</text> - </view> - <view class="input-box row verCenter" style="flex: 0 0 100%;"> - <text class="label">实物型号:</text> - <view class="text"> - <rich-text :nodes="highlightDifferences(item.order_model, item.actual_model)"></rich-text> - </view> - </view> - <view class="input-box row verCenter" style="flex: 0 0 100%;"> - <text class="label">订单品牌:</text> - <text class="text">{{item.order_brand}}</text> - </view> - <view class="input-box row verCenter" style="flex: 0 0 100%;"> - <text class="label">订单数量:</text> - <text class="text">{{item.order_qty}}</text> + <view class="input-box row verCenter" style="flex: 0 0 100%;background-color: #f1f4f6;padding: 10rpx 0;"> + <template v-if="item.abnormal_type == 1"> + <text class="label">订单品牌:</text> + <text class="text">{{item.order_brand}}</text> + </template> + <template v-else-if="item.abnormal_type == 2"> + <text class="label">订单型号:</text> + <text class="text">{{item.order_model}}</text> + </template> + <template v-else-if="item.abnormal_type == 3"> + <text class="label">订单产地:</text> + <text class="text">{{item.order_origin}}</text> + </template> + <template v-else-if="item.abnormal_type == 4"> + <text class="label">订单数量:</text> + <text class="text">{{item.order_qty}}</text> + </template> </view> - <view class="input-box row verCenter" style="flex: 0 0 100%;"> - <text class="label">订单产地:</text> - <text class="text">{{item.order_origin}}</text> + <view class="input-box row verCenter" style="flex: 0 0 100%;background-color: #f1f4f6;padding: 10rpx 0;"> + <template v-if="item.abnormal_type == 1"> + <text class="label">实物品牌:</text> + <view class="text"> + <rich-text :nodes="highlightDifferences(item.order_brand, item.actual_brand)"></rich-text> + </view> + </template> + <template v-else-if="item.abnormal_type == 2"> + <text class="label">实物型号:</text> + <view class="text"> + <rich-text :nodes="highlightDifferences(item.order_model, item.actual_model)"></rich-text> + </view> + </template> + <template v-else-if="item.abnormal_type == 3"> + <text class="label">实物产地:</text> + <view class="text"> + <rich-text :nodes="highlightDifferences(item.order_origin, item.actual_origin)"></rich-text> + </view> + </template> + <template v-else-if="item.abnormal_type == 4"> + <text class="label">实物数量:</text> + <view class="text"> + <rich-text :nodes="highlightDifferences(item.order_qty, item.actual_qty)"></rich-text> + </view> + </template> </view> <view class="input-box row verCenter" style="flex: 0 0 100%;"> <text class="label">异常说明:</text> - <text class="text">{{item.abnormal_explain}}</text> + <text class="text" style="max-width: 500rpx;" @click="show(item.abnormal_explain)">{{item.abnormal_explain}}</text> </view> <view class="input-box row verCenter" style="flex: 0 0 100%;"> <text class="label">业务回复:</text> - <text class="text" style="color: red;">{{item.handle_explain}}</text> + <text class="text" style="color: red;" @click="show(item.handle_explain)">{{item.handle_explain}}</text> </view> <view class="input-box row verCenter" style="flex: 0 0 100%;"> <text class="label">创建时间:</text> @@ -93,7 +115,7 @@ <text class="text">{{item.salesman_handle_time}}</text> </view> <view class="input-box row" style="flex: 0 0 100%;"> - <text class="label">理货照片:</text> + <text class="label">异常图片:</text> <view class="pick_img_list row"> <template v-if="item.abnormal_pic_urls.length > 0"> <view class="img_list" v-for="(v, i) in item.abnormal_pic_urls" :key="i"> @@ -284,30 +306,32 @@ * @returns {string} 处理后的第二个字符串,带有<em>标签 */ highlightDifferences(str1, str2) { - // 去除前后空格 - str1 = str1.trim(); - str2 = str2.trim(); + if (str1 && str2) { + // 去除前后空格 + str1 = str1.toString().trim(); + str2 = str2.toString().trim(); - // 初始化结果字符串 - let result = ''; - const maxLength = Math.max(str1.length, str2.length); + // 初始化结果字符串 + let result = ''; + const maxLength = Math.max(str1.length, str2.length); - // 逐字符比较 - for (let i = 0; i < maxLength; i++) { - const char1 = str1[i] || ''; // 如果str1比str2短,取空字符 - const char2 = str2[i] || ''; // 如果str2比str1短,取空字符 + // 逐字符比较 + for (let i = 0; i < maxLength; i++) { + const char1 = str1[i] || ''; // 如果str1比str2短,取空字符 + const char2 = str2[i] || ''; // 如果str2比str1短,取空字符 - // 比较字符 - if (char1 !== char2) { - // 如果字符不同,在第二个字符串中用<em>包裹 - result += `<span style="color: red">${char2}</span>`; - } else { - // 如果字符相同,直接添加到结果中 - result += char2; + // 比较字符 + if (char1 !== char2) { + // 如果字符不同,在第二个字符串中用<em>包裹 + result += `<span style="color: red">${char2}</span>`; + } else { + // 如果字符相同,直接添加到结果中 + result += char2; + } } - } - return result; + return result; + } }, /** * 预览图片 @@ -496,6 +520,23 @@ }) }, /** + * 展示文本详情 + */ + show(val) { + uni.showModal({ + content: val, + showCancel: false, + confirmText: '关闭', + success: function(res) { + if (res.confirm) { + console.log('用户点击确定'); + } else if (res.cancel) { + console.log('用户点击取消'); + } + } + }); + }, + /** * 异常作废 */ cancelAbnormal(abnormal_id) { diff --git a/pages/tally/addAbnormal.vue b/pages/tally/addAbnormal.vue index 31e3ce8..850c09a 100644 --- a/pages/tally/addAbnormal.vue +++ b/pages/tally/addAbnormal.vue @@ -132,6 +132,7 @@ is_business_processing: ['否', '是'], is_business_processing_index: -1, abnormal_pic_url: [], + order_id: '', form: { order_goods_id: '', entrust_no: '', @@ -147,7 +148,7 @@ }; }, onLoad(options) { - this.form.order_goods_id = options.order_id; + this.order_id = options.order_id; this.form.entrust_no = options.erp_order_sn; this.salesman = options.salesman; this.orderDetailByIdIndex = options.orderDetailByIdIndex; @@ -184,9 +185,10 @@ this.form.abnormal_explain = val; }, getData() { - this.request(API.getOrderDetailById, 'GET', { order_id: this.form.order_goods_id }, true).then(res => { + this.request(API.getOrderDetailById, 'GET', { order_id: this.order_id }, true).then(res => { if (res.err_code === 0) { this.orderDetailByIdList = res.data[this.orderDetailByIdIndex]; + this.form.order_goods_id = this.orderDetailByIdList.order_goods_id; } else { uni.showToast({ title: res.err_msg, diff --git a/pages/tally/index.vue b/pages/tally/index.vue index 3450f85..0780fd0 100644 --- a/pages/tally/index.vue +++ b/pages/tally/index.vue @@ -391,6 +391,8 @@ this.getStayHandleCount(); if (this.box_sn && this.erp_order_sn && this.noexebshowFalg) { + this.tallyData = []; + this.form = []; this.getTallyData(); }