|
|
@@ -85,8 +85,10 @@
|
|
|
class="skuDeatilHeaderRight"
|
|
|
v-if="!formData.displayRewardTaskEditable"
|
|
|
style="margin-right: 85px">
|
|
|
- <span style="color: #07c160" @click="editTable" v-if="!editTableFlag">编辑</span>
|
|
|
- <span style="color: red" @click="saveTable" v-if="editTableFlag">保存</span>
|
|
|
+ <van-button round @click="editTable" v-if="!editTableFlag">编辑</van-button>
|
|
|
+ <van-button type="primary" @click="saveTable" v-if="editTableFlag">保存</van-button>
|
|
|
+ <!-- <span style="color: #07c160" @click="editTable" v-if="!editTableFlag">编辑</span>
|
|
|
+ <span style="color: red" @click="saveTable" v-if="editTableFlag">保存</span> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-table
|
|
|
@@ -272,8 +274,9 @@ export default {
|
|
|
this.toastLoading().clear();
|
|
|
if (res.code == 200 && res.data && res.data.length > 0) {
|
|
|
this.formData = res.data[0];
|
|
|
- console.log(this.formData.taskPhotoRecognitionResult);
|
|
|
- this.getSpanArr(this.formData.taskPhotoRecognitionResult);
|
|
|
+ this.taskPhotoRecognitionResult =
|
|
|
+ JSON.parse(JSON.stringify(this.formData.taskPhotoRecognitionResult)) || [];
|
|
|
+ this.getSpanArr(this.taskPhotoRecognitionResult);
|
|
|
console.log(this.formData);
|
|
|
} else {
|
|
|
this.formData = null;
|
|
|
@@ -315,7 +318,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
inputbluwl(row) {
|
|
|
- console.log(row);
|
|
|
let filteredResults = this.formData.taskPhotoRecognitionResult.filter(
|
|
|
(val) => val.skuProductCode == row.skuProductCode,
|
|
|
);
|
|
|
@@ -325,13 +327,36 @@ export default {
|
|
|
if (current < original) {
|
|
|
this.$toast('排面数不能小于原始值');
|
|
|
row.identifyTheNumberOfCards = String(original);
|
|
|
+ const existingIndex = this.editCountArr.findIndex(
|
|
|
+ (item) => item.skuProductCode === row.skuProductCode,
|
|
|
+ );
|
|
|
+ if (existingIndex >= 0) {
|
|
|
+ this.editCountArr.splice(existingIndex, 1);
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.editCountArr.push({
|
|
|
- taskId: '', // Long 任务id
|
|
|
- visitId: '', // Long 拜访id
|
|
|
- skuProductCode: '', // String 产品code
|
|
|
- editCount: '', // integer 修改产品数字的差值,为正整数。
|
|
|
- });
|
|
|
+ const editCount = current - original;
|
|
|
+ if (editCount > 0) {
|
|
|
+ const existingIndex = this.editCountArr.findIndex(
|
|
|
+ (item) => item.skuProductCode === row.skuProductCode,
|
|
|
+ );
|
|
|
+ if (existingIndex >= 0) {
|
|
|
+ this.editCountArr[existingIndex].editCount = editCount;
|
|
|
+ } else {
|
|
|
+ this.editCountArr.push({
|
|
|
+ taskId: row.taskId, // Long 任务id
|
|
|
+ visitId: row.visitId, // Long 拜访id
|
|
|
+ skuProductCode: row.skuProductCode, // String 产品code
|
|
|
+ editCount,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else if (editCount === 0) {
|
|
|
+ const existingIndex = this.editCountArr.findIndex(
|
|
|
+ (item) => item.skuProductCode === row.skuProductCode,
|
|
|
+ );
|
|
|
+ if (existingIndex >= 0) {
|
|
|
+ this.editCountArr.splice(existingIndex, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
this.$toast('排面数不能为空');
|
|
|
@@ -356,6 +381,20 @@ export default {
|
|
|
this.editTableFlag = true;
|
|
|
},
|
|
|
saveTable() {
|
|
|
+ console.log(this.editCountArr);
|
|
|
+ if (this.editCountArr.length == 0) {
|
|
|
+ // this.$toast('请至少修改一项排面数');
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ updateDisplayRewardCaseSkuCount(this.editCountArr).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$toast('修改成功');
|
|
|
+ this.getVisitsDetailFun();
|
|
|
+ } else {
|
|
|
+ this.$toast(res.message || '修改失败');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
this.editTableFlag = false;
|
|
|
},
|
|
|
onClickLeft() {
|