workDiff-table.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <div class="work-diff-table">
  3. <el-table
  4. ref="addrForm"
  5. :data="tableData"
  6. border
  7. :size="'mini'"
  8. style="width: 100%"
  9. row-key="key"
  10. >
  11. <el-table-column
  12. show-overflow-tooltip
  13. prop="orderCode"
  14. label="采购单编号"
  15. width="150"
  16. />
  17. <el-table-column
  18. show-overflow-tooltip
  19. prop="outCode"
  20. label="商品分类"
  21. width="150"
  22. />
  23. <el-table-column
  24. show-overflow-tooltip
  25. prop="apply_name"
  26. label="商品名称"
  27. width="85"
  28. />
  29. <el-table-column
  30. show-overflow-tooltip
  31. prop="post_name"
  32. label="物流公司"
  33. width="110"
  34. />
  35. <el-table-column
  36. show-overflow-tooltip
  37. prop="post_code"
  38. label="物流单号"
  39. width="160"
  40. />
  41. <el-table-column
  42. show-overflow-tooltip
  43. prop="post_fee"
  44. label="预计物流费"
  45. width="100"
  46. />
  47. <el-table-column
  48. show-overflow-tooltip
  49. prop="status"
  50. label="状态"
  51. width="80"
  52. >
  53. <template slot-scope="scope">
  54. <el-tag
  55. :size="tablebtnSize"
  56. :type="scope.row.status == '0' ? 'warning' : ''"
  57. v-text="
  58. (statusOptions.find((item) => item.id == scope.row.status) || {})
  59. .label || '--'
  60. "
  61. ></el-tag>
  62. </template>
  63. </el-table-column>
  64. <el-table-column
  65. show-overflow-tooltip
  66. prop="sendtime"
  67. label="发货时间"
  68. min-width="170"
  69. />
  70. <el-table-column
  71. show-overflow-tooltip
  72. prop="send_num"
  73. label=" 发货数量"
  74. width="80"
  75. />
  76. <el-table-column
  77. show-overflow-tooltip
  78. prop="check_num"
  79. label="验收数量"
  80. width="80"
  81. />
  82. <el-table-column
  83. show-overflow-tooltip
  84. prop="addr_info"
  85. label="省市区"
  86. min-width="170"
  87. />
  88. <el-table-column
  89. show-overflow-tooltip
  90. prop="addr"
  91. label="收货地址"
  92. min-width="170"
  93. />
  94. <el-table-column
  95. show-overflow-tooltip
  96. prop="contact"
  97. label="联系人"
  98. width="80"
  99. />
  100. <el-table-column
  101. show-overflow-tooltip
  102. prop="mobile"
  103. label="联系电话"
  104. width="110"
  105. />
  106. <el-table-column
  107. show-overflow-tooltip
  108. prop="wsm_supplier"
  109. label="供应商"
  110. min-width="220"
  111. />
  112. <el-table-column
  113. show-overflow-tooltip
  114. prop="wsm_supplierNo"
  115. label="仓库供应商"
  116. min-width="170"
  117. />
  118. <!-- v-if="status === '0' && powers.some((item) => item == '005')" -->
  119. <el-table-column fixed="right" width="80">
  120. <template slot="header" slot-scope="scope">
  121. <span>操作</span>
  122. </template>
  123. <template slot-scope="scope">
  124. <el-tooltip
  125. effect="dark"
  126. content="查看"
  127. v-if="!scope.row.edit"
  128. placement="top"
  129. >
  130. <i
  131. class="el-icon-view tb-icon"
  132. @click="openHouseModal(scope.$index)"
  133. ></i>
  134. </el-tooltip>
  135. <!-- v-if="sitem.status == '5'" -->
  136. <el-tooltip
  137. class="fr"
  138. effect="dark"
  139. content="新建售后申请"
  140. placement="top"
  141. >
  142. <i
  143. class="el-icon-plus tb-icon"
  144. @click="openModal('add', scope.row)"
  145. ></i>
  146. </el-tooltip>
  147. </template>
  148. </el-table-column>
  149. </el-table>
  150. </div>
  151. </template>
  152. <script>
  153. import mixinPage from "@/mixins/elPaginationHandle";
  154. import resToken from "@/mixins/resToken";
  155. import asyncRequest from "@/apis/service/sellOut/salesOrder/detail";
  156. import { mapGetters } from "vuex";
  157. export default {
  158. name: "workDdiffTable",
  159. mixins: [mixinPage, resToken],
  160. props: ["newTime", "id", "sitem"],
  161. // components: { addEdit, outOrderAddModel },
  162. watch: {
  163. newTime: function (val) {
  164. if (val) {
  165. this.initForm();
  166. }
  167. },
  168. },
  169. computed: {
  170. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  171. powers() {
  172. let tran =
  173. this.$store.getters.btnList.find(
  174. (item) => item.menu_route == "workDdiffTable"
  175. ) || {};
  176. if (tran && tran.action && tran.action.length > 0) {
  177. return tran.action;
  178. } else {
  179. return [];
  180. }
  181. },
  182. },
  183. data() {
  184. return {
  185. orderCode: "",
  186. outCode: "",
  187. // 状态
  188. statusOptions: [
  189. { id: "1", label: "已出库" },
  190. { id: "2", label: "验收中" },
  191. { id: "3", label: "验收完成" },
  192. ],
  193. showGoodsModel: false,
  194. stock_code: "",
  195. tableData: [],
  196. loading: false,
  197. queryId: "",
  198. status: "",
  199. showModel: null,
  200. modelId: "",
  201. modelItem: null,
  202. s_sitem: null,
  203. };
  204. },
  205. mounted() {
  206. this.initForm();
  207. },
  208. methods: {
  209. refresh() {
  210. this.$emit("refresh");
  211. },
  212. async initForm() {
  213. this.status = "";
  214. this.queryId = this.$route.query.id;
  215. const { bum } = this.sitem;
  216. this.tableData = bum;
  217. },
  218. editRow(index) {
  219. let findex = this.stockForm.good_stock.findIndex((v) => v.edit === true);
  220. if (findex !== -1) {
  221. this.$message.warning("当前已有发货仓库信息在编辑,请保存后再试!");
  222. return;
  223. } else {
  224. this.stockForm.good_stock[index].edit = true;
  225. }
  226. },
  227. checkStockRow(index) {
  228. let total = parseInt(this.stockForm.good_stock[index].usable_stock),
  229. num = parseInt(this.stockForm.good_stock[index].num);
  230. if (total === 0) {
  231. this.$message.warning("该仓库已无该商品库存!不能销售!");
  232. return;
  233. } else {
  234. if (num > total) {
  235. this.$message.warning("销售数量不能大于可用库存!");
  236. return;
  237. } else {
  238. this.stockForm.good_stock[index].edit = false;
  239. }
  240. }
  241. },
  242. openHouseModal() {
  243. this.modelId = "add";
  244. this.modelItem = this.sitem;
  245. this.modelShowModel = true;
  246. },
  247. //省市区保存某一行
  248. checkRow(rowIndex) {
  249. this.$refs.addrForm.validate((valid) => {
  250. if (valid) {
  251. this.tableData[rowIndex].edit = false;
  252. } else {
  253. console.log("error submit!!");
  254. return false;
  255. }
  256. });
  257. },
  258. // 省市区删除行操作
  259. deleteRow(index, rows) {
  260. rows.splice(index, 1);
  261. },
  262. async submitForm() {
  263. await this.$refs.ruleForm.validate(async (valid) => {
  264. if (valid) {
  265. this.loading = true;
  266. const { order_addr } = JSON.parse(JSON.stringify(this.addrForm));
  267. let model = {
  268. id: this.queryId,
  269. order_addr: [],
  270. };
  271. order_addr.forEach((v2) => {
  272. let model2 = {
  273. post_fee: v2.post_fee,
  274. id: v2.id,
  275. };
  276. model.order_addr.push(model2);
  277. });
  278. let res = await asyncRequest.salefee(model);
  279. this.loading = false;
  280. if (res && res.code === 0) {
  281. this.$notify.success({
  282. title: "反馈物流费用成功!",
  283. message: "",
  284. });
  285. this.showModelThis = false;
  286. // 刷新
  287. this.$emit("refresh");
  288. } else if (res && res.code >= 100 && res.code <= 104) {
  289. await this.logout();
  290. } else {
  291. this.$message.warning(res.message);
  292. }
  293. } else {
  294. console.log("error submit!!");
  295. return false;
  296. }
  297. });
  298. },
  299. openModal(code, sitem, outcode) {
  300. console.log(sitem);
  301. this.s_sitem = sitem;
  302. this.modelId = code;
  303. this.showModel = true;
  304. },
  305. },
  306. };
  307. </script>
  308. <style lang="scss" scoped>
  309. </style>