order-out-table.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <div class="outOrderTable">
  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. <el-tooltip
  123. class="fr"
  124. style="margin: 3px 0 0 0"
  125. effect="dark"
  126. content="添加"
  127. placement="top"
  128. >
  129. <i
  130. class="el-icon-circle-plus-outline tb-icon"
  131. style="color: #63cbe7"
  132. @click="openHouseModal()"
  133. ></i>
  134. <!-- @click="openModal('add', '028')" -->
  135. <!-- -->
  136. </el-tooltip>
  137. </template>
  138. <template slot-scope="scope">
  139. <el-tooltip
  140. effect="dark"
  141. content="查看"
  142. v-if="!scope.row.edit"
  143. placement="top"
  144. >
  145. <i
  146. class="el-icon-view tb-icon"
  147. @click="openHouseModal(scope.$index)"
  148. ></i>
  149. </el-tooltip>
  150. <el-tooltip
  151. v-if="sitem.status == '5'"
  152. class="fr"
  153. effect="dark"
  154. content="新建售后申请"
  155. placement="top"
  156. >
  157. <i
  158. class="el-icon-warning tb-icon"
  159. @click="openModal('add', scope.row)"
  160. ></i>
  161. </el-tooltip>
  162. </template>
  163. </el-table-column>
  164. </el-table>
  165. <out-order-add-model
  166. :showModel="modelShowModel"
  167. :id="modelId"
  168. :sitem="modelItem"
  169. />
  170. <add-edit
  171. :id="modelId"
  172. :sitem="s_sitem"
  173. :show-model="showModel"
  174. :is-detail="isDetail"
  175. @refresh="searchList"
  176. @cancel="showModel = false"
  177. />
  178. </div>
  179. </template>
  180. <script>
  181. import mixinPage from "@/mixins/elPaginationHandle";
  182. import resToken from "@/mixins/resToken";
  183. import asyncRequest from "@/apis/service/sellOut/salesOrder/detail";
  184. import outOrderAddModel from "./out-order-add-model";
  185. import addEdit from "@/views/sellOut/goodsService/components/addEdit.vue";
  186. import { mapGetters } from "vuex";
  187. export default {
  188. name: "salesOrderDetail",
  189. mixins: [mixinPage, resToken],
  190. props: ["newTime", "id", "sitem"],
  191. components: { addEdit, outOrderAddModel },
  192. watch: {
  193. newTime: function (val) {
  194. if (val) {
  195. this.initForm();
  196. }
  197. },
  198. },
  199. computed: {
  200. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  201. powers() {
  202. let tran =
  203. this.$store.getters.btnList.find(
  204. (item) => item.menu_route == "salesOrderDetail"
  205. ) || {};
  206. if (tran && tran.action && tran.action.length > 0) {
  207. return tran.action;
  208. } else {
  209. return [];
  210. }
  211. },
  212. },
  213. data() {
  214. return {
  215. // 状态
  216. statusOptions: [
  217. { id: "1", label: "已出库" },
  218. { id: "2", label: "验收中" },
  219. { id: "3", label: "验收完成" },
  220. ],
  221. showGoodsModel: false,
  222. stock_code: "",
  223. tableData: [],
  224. loading: false,
  225. queryId: "",
  226. status: "",
  227. showModel: null,
  228. modelId: "",
  229. modelItem: null,
  230. s_sitem: null,
  231. };
  232. },
  233. mounted() {
  234. this.initForm();
  235. },
  236. methods: {
  237. async initForm() {
  238. console.log("12");
  239. this.status = "";
  240. this.queryId = this.$route.query.id;
  241. // this.rulesThis = this.rules;
  242. this.resetForm();
  243. },
  244. getNewTime() {
  245. this.newTime = new Date().valueOf();
  246. },
  247. async resetForm() {
  248. // 重置
  249. await this.$nextTick(() => {
  250. // console.log(this.$refs.addrForm);
  251. // if (this.$refs.addrForm) {
  252. // this.$refs.addrForm.resetFields();
  253. // this.$refs.addrForm.clearValidate();
  254. const { bum } = this.sitem;
  255. this.tableData = bum;
  256. // }
  257. });
  258. },
  259. editRow(index) {
  260. let findex = this.stockForm.good_stock.findIndex((v) => v.edit === true);
  261. if (findex !== -1) {
  262. this.$message.warning("当前已有发货仓库信息在编辑,请保存后再试!");
  263. return;
  264. } else {
  265. this.stockForm.good_stock[index].edit = true;
  266. }
  267. },
  268. checkStockRow(index) {
  269. let total = parseInt(this.stockForm.good_stock[index].usable_stock),
  270. num = parseInt(this.stockForm.good_stock[index].num);
  271. if (total === 0) {
  272. this.$message.warning("该仓库已无该商品库存!不能销售!");
  273. return;
  274. } else {
  275. if (num > total) {
  276. this.$message.warning("销售数量不能大于可用库存!");
  277. return;
  278. } else {
  279. this.stockForm.good_stock[index].edit = false;
  280. }
  281. }
  282. },
  283. openHouseModal() {
  284. this.modelId = "add";
  285. this.modelItem = this.sitem;
  286. this.modelShowModel = true;
  287. },
  288. //省市区保存某一行
  289. checkRow(rowIndex) {
  290. this.$refs.addrForm.validate((valid) => {
  291. if (valid) {
  292. this.tableData[rowIndex].edit = false;
  293. } else {
  294. console.log("error submit!!");
  295. return false;
  296. }
  297. });
  298. },
  299. // 省市区删除行操作
  300. deleteRow(index, rows) {
  301. rows.splice(index, 1);
  302. },
  303. async submitForm() {
  304. await this.$refs.ruleForm.validate(async (valid) => {
  305. if (valid) {
  306. this.loading = true;
  307. const { order_addr } = JSON.parse(JSON.stringify(this.addrForm));
  308. let model = {
  309. id: this.queryId,
  310. order_addr: [],
  311. };
  312. order_addr.forEach((v2) => {
  313. let model2 = {
  314. post_fee: v2.post_fee,
  315. id: v2.id,
  316. };
  317. model.order_addr.push(model2);
  318. });
  319. let res = await asyncRequest.salefee(model);
  320. this.loading = false;
  321. if (res && res.code === 0) {
  322. this.$notify.success({
  323. title: "反馈物流费用成功!",
  324. message: "",
  325. });
  326. this.showModelThis = false;
  327. // 刷新
  328. this.$emit("refresh");
  329. } else if (res && res.code >= 100 && res.code <= 104) {
  330. await this.logout();
  331. } else {
  332. this.$message.warning(res.message);
  333. }
  334. } else {
  335. console.log("error submit!!");
  336. return false;
  337. }
  338. });
  339. },
  340. openModal(code, btn_code) {
  341. console.log(code, btn_code);
  342. this.s_sitem = btn_code;
  343. this.btn_code = btn_code;
  344. this.modelId = code;
  345. this.showModel = true;
  346. },
  347. },
  348. };
  349. </script>
  350. <style lang="scss" scoped>
  351. </style>