|
@@ -41,20 +41,35 @@
|
|
|
<u-loadmore :status="loadStatus" @loadmore="onLoadMore" />
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
+ <error-pop
|
|
|
+ v-model="actionPop.errorShow"
|
|
|
+ isCenter
|
|
|
+ cancelBtnText="取消"
|
|
|
+ confirmBtnText="确定"
|
|
|
+ @close="actionPop.errorShow = false"
|
|
|
+ @confirm="submit"
|
|
|
+ :content="actionPop.errorText"
|
|
|
+ ></error-pop>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import checkItem from "./components/check-item.vue";
|
|
|
+import errorPop from "@/components/error-pop/error-pop.vue";
|
|
|
+
|
|
|
import {
|
|
|
taskStocktakingList,
|
|
|
startTask,
|
|
|
+ taskComplete,
|
|
|
+ taskStocktakingDetail,
|
|
|
} from "@/common/request/apis/inventoryTask";
|
|
|
import { taskStatusList } from "../inventory-task/utils/index.js";
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
checkItem,
|
|
|
+ errorPop,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -68,6 +83,14 @@ export default {
|
|
|
pageSize: 10,
|
|
|
loadStatus: "loadmore", //加载前值为loadmore,加载中为loading,没有数据为nomore
|
|
|
list: [],
|
|
|
+
|
|
|
+ activeTaskId: null,
|
|
|
+ actionPop: {
|
|
|
+ // 警告提示弹框状态
|
|
|
+ errorShow: false,
|
|
|
+ submitActionFlag: false,
|
|
|
+ errorText: "是否提交盘点?",
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
onLoad() {
|
|
@@ -158,9 +181,46 @@ export default {
|
|
|
});
|
|
|
break;
|
|
|
case "去提交":
|
|
|
+ taskStocktakingDetail(data.id).then((res) => {
|
|
|
+ console.log("taskStocktakingDetail=======", res);
|
|
|
+ let { finishCount, materialCount } = res.data;
|
|
|
+ const a = Number(finishCount || 0);
|
|
|
+ const b = Number(materialCount || 0);
|
|
|
+ this.activeTaskId = data.id;
|
|
|
+ this.actionPop.errorShow = true;
|
|
|
+ if (a === b) {
|
|
|
+ // 进度100%
|
|
|
+ this.actionPop.errorText = "是否提交盘点?";
|
|
|
+ this.actionPop.submitActionFlag = true;
|
|
|
+ } else {
|
|
|
+ this.actionPop.errorText = "尚有货物未完成盘点,请先去盘点";
|
|
|
+ this.actionPop.submitActionFlag = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
+ resetErrorPopData() {
|
|
|
+ this.actionPop.errorShow = false;
|
|
|
+ this.actionPop.submitActionFlag = false;
|
|
|
+ this.actionPop.errorShow = "";
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ if (this.actionPop.submitActionFlag) {
|
|
|
+ taskComplete(this.activeTaskId).then((res) => {
|
|
|
+ this.resetErrorPopData();
|
|
|
+ if (res.code === 200) {
|
|
|
+ uni.$u.toast(res.msg);
|
|
|
+ this.onRefresh();
|
|
|
+ } else {
|
|
|
+ uni.$u.toast(res.data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.resetErrorPopData();
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|