waitTeamList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <div class="">
  3. <div class="">
  4. <div class="tableWrap">
  5. <el-table
  6. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  7. :data="tableList"
  8. >
  9. <!-- @selection-change="handleSelectionChange" -->
  10. <!-- <el-table-column type="selection" width="55"> </el-table-column> -->
  11. <el-table-column label="商品编号" prop="sn" align="center">
  12. </el-table-column>
  13. <el-table-column label="商品名称" align="center" prop="name">
  14. </el-table-column>
  15. <el-table-column label="商品类型" align="center" prop="type">
  16. <template slot-scope="scope">
  17. <div>
  18. {{ scope.row.type | shopType }}
  19. </div>
  20. </template>
  21. </el-table-column>
  22. <el-table-column label="具体型号" align="center" prop="specification">
  23. </el-table-column>
  24. <el-table-column label="数量统计" align="center" prop="sellCount">
  25. </el-table-column>
  26. </el-table>
  27. </div>
  28. </div>
  29. <div class="btnWrap" style="margin-top: 20px">
  30. <el-button
  31. type="primary"
  32. v-if="tableList.length > 0"
  33. v-permission="'order/musicalListExport'"
  34. @click="musicalListExport"
  35. >订货清单导出</el-button
  36. >
  37. <el-button
  38. type="primary"
  39. v-if="tableList.length > 0"
  40. v-permission="'order/musicalListDetailExport'"
  41. @click="musicalListDetailExport"
  42. >分发清单导出</el-button
  43. >
  44. <!-- v-if="
  45. musicalStatus &&
  46. $helpers.permission('musicGroup/takeEffectOfinstrumentInsurance')
  47. " -->
  48. <el-button
  49. type="primary"
  50. @click="onDelivery"
  51. >确认发货</el-button
  52. >
  53. <!-- <el-button
  54. type="warning okBtn"
  55. v-if="team_status == 'PREPARE' && !hasVerifyMusicalList"
  56. v-permission="'order/verifyMusicalList'"
  57. @click="okDetailList"
  58. >乐器清单确认</el-button
  59. > -->
  60. <!-- <div class="okBtn" v-permission="'order/verifyMusicalList'"
  61. @click="okDetailList">确认</div> -->
  62. </div>
  63. <el-dialog :visible.sync="addrVisiable" title="确认清单" width="500px">
  64. <deliverGoods v-if="addrVisiable" :form="activeChiose" ref='deliverGoods' @close='()=>{addrVisiable = false}' @getList='getList'/>
  65. <div slot="footer" class="dialog-footer">
  66. <el-button @click="addrVisiable = false">取 消</el-button>
  67. <el-button type="primary" @click="onsubmitDelivery"
  68. >确 定</el-button
  69. >
  70. </div>
  71. </el-dialog>
  72. </div>
  73. </template>
  74. <script>
  75. import { getTeamDetailList, getTeamBaseInfo } from "@/api/buildTeam";
  76. import { getTeamList } from "@/api/teamServer";
  77. import {
  78. verifyMusicalList,
  79. takeEffectOfinstrumentInsurance,
  80. } from "@/api/orderManager";
  81. import deliverGoods from './modals/deliverGoods.vue'
  82. import axios from "axios";
  83. import qs from "qs";
  84. import { getToken, getTenantId } from "@/utils/auth";
  85. import load from "@/utils/loading";
  86. export default {
  87. data() {
  88. return {
  89. teamid: "",
  90. tableList: [],
  91. Fsearch: null,
  92. Frules: null,
  93. team_status: "",
  94. musicalInstrumentsProvideStatus: 0, // 是否确认发货 1已发货
  95. hasVerifyMusicalList: true,
  96. activeChiose:[],
  97. addrVisiable:false
  98. };
  99. },
  100. components:{deliverGoods},
  101. mounted() {
  102. this.init();
  103. },
  104. activated() {
  105. this.init();
  106. },
  107. computed: {
  108. musicalStatus() {
  109. const template = ["PREPARE", "PROGRESS"];
  110. const teamStatus = this.$route.query.team_status;
  111. const status = template.includes(teamStatus);
  112. console.log(this.musicalInstrumentsProvideStatus, status);
  113. return !this.musicalInstrumentsProvideStatus && status ? true : false;
  114. },
  115. },
  116. methods: {
  117. init() {
  118. this.team_status = this.$route.query.team_status;
  119. this.teamid = this.$route.query.id;
  120. if (this.teamid) {
  121. // getTeamList({ musicGroupId: this.teamid }).then(res=>{
  122. // if(res.code == 200){
  123. // this.hasVerifyMusicalList = res?.data?.rows[0]?.hasVerifyMusicalList
  124. // }
  125. // })
  126. this.getList()
  127. this.getMusicInfo();
  128. }
  129. },
  130. getList(){
  131. this.addrVisiable=false;
  132. getTeamDetailList({ musicGroupId: this.teamid,deliveryStatus:'0' }).then((res) => {
  133. if (res.code == 200) {
  134. this.tableList = res.data ? res.data : [];
  135. }
  136. });
  137. },
  138. async getMusicInfo() {
  139. await getTeamBaseInfo({ musicGroupId: this.teamid }).then((res) => {
  140. if (res.code == 200) {
  141. this.musicalInstrumentsProvideStatus =
  142. res.data?.musicGroup?.musicalInstrumentsProvideStatus;
  143. this.hasVerifyMusicalList =
  144. res.data?.musicGroup?.hasVerifyMusicalList;
  145. }
  146. });
  147. },
  148. handleSelectionChange (val) {
  149. this.activeChiose = val
  150. },
  151. onCancel() {
  152. this.$store.dispatch("delVisitedViews", this.$route);
  153. this.$router.push({ path: "/teamList" });
  154. },
  155. onDelivery() {
  156. // console.log('自动发货')
  157. this.addrVisiable = true;
  158. // return
  159. // this.$confirm("是否确认发货", "提示", {
  160. // confirmButtonText: "确定",
  161. // cancelButtonText: "取消",
  162. // type: "warning",
  163. // }).then(async () => {
  164. // try {
  165. // await takeEffectOfinstrumentInsurance({ musicGroupId: this.teamid });
  166. // this.$message.success("确定发货成功");
  167. // this.getMusicInfo();
  168. // } catch {
  169. // //
  170. // }
  171. // });
  172. },
  173. onsubmitDelivery(){
  174. this.$refs.deliverGoods.submit()
  175. console.log('确认发货发货')
  176. },
  177. okDetailList() {
  178. this.$confirm(`是否确认发放清单?`, "提示", {
  179. confirmButtonText: "确定",
  180. cancelButtonText: "取消",
  181. type: "warning",
  182. })
  183. .then(() => {
  184. verifyMusicalList({ musicGroupId: this.teamid }).then((res) => {
  185. if (res.code == 200) {
  186. this.$store.dispatch("delVisitedViews", this.$route);
  187. this.$router.push({
  188. path: "/teamList",
  189. query: { search: this.Fsearch, rules: this.Frules },
  190. });
  191. }
  192. });
  193. })
  194. .catch(() => {});
  195. },
  196. musicalListExport() {
  197. // 报表导出
  198. let url = "/api-web/order/musicalListExport";
  199. let data = {
  200. musicGroupId: this.$route.query.id,
  201. deliveryStatus:'0'
  202. };
  203. const options = {
  204. method: "POST",
  205. headers: {
  206. Authorization: getToken(),
  207. tenantId: getTenantId(),
  208. },
  209. data: qs.stringify(data),
  210. url,
  211. responseType: "blob",
  212. };
  213. this.$confirm("您确定导出订货清单", "提示", {
  214. confirmButtonText: "确定",
  215. cancelButtonText: "取消",
  216. type: "warning",
  217. })
  218. .then(() => {
  219. load.startLoading();
  220. axios(options)
  221. .then((res) => {
  222. let blob = new Blob([res.data], {
  223. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  224. type: "application/vnd.ms-excel;charset=utf-8",
  225. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  226. });
  227. let text = new Response(blob).text();
  228. text.then((res) => {
  229. // 判断是否报错
  230. if (res.indexOf("code") != -1) {
  231. let json = JSON.parse(res);
  232. if (json.code == 403) {
  233. this.$message.error(`登录过期,请重新登录!`);
  234. setTimeout(() => {
  235. this.$store.dispatch("user/resetToken").then(() => {
  236. location.reload();
  237. });
  238. }, 1000);
  239. return;
  240. }
  241. this.$message.error(json.msg);
  242. } else {
  243. let objectUrl = URL.createObjectURL(blob);
  244. let link = document.createElement("a");
  245. let nowTime = new Date();
  246. let ymd =
  247. nowTime.getFullYear() +
  248. "" +
  249. (nowTime.getMonth() + 1) +
  250. "" +
  251. nowTime.getDate() +
  252. "" +
  253. nowTime.getHours() +
  254. "" +
  255. nowTime.getMinutes();
  256. let fname = this.$route.query.id + "-" + ymd + "订货清单.xls"; //下载文件的名字
  257. link.href = objectUrl;
  258. link.setAttribute("download", fname);
  259. document.body.appendChild(link);
  260. link.click();
  261. }
  262. });
  263. load.endLoading();
  264. })
  265. .catch((error) => {
  266. this.$message.error("导出数据失败,请联系管理员");
  267. load.endLoading();
  268. });
  269. })
  270. .catch(() => {});
  271. },
  272. musicalListDetailExport() {
  273. // 报表导出
  274. let url = "/api-web/order/musicalListDetailExport";
  275. let data = {
  276. musicGroupId: this.$route.query.id,
  277. deliveryStatus:'0'
  278. };
  279. const options = {
  280. method: "POST",
  281. headers: {
  282. Authorization: getToken(),
  283. tenantId: getTenantId(),
  284. },
  285. data: qs.stringify(data),
  286. url,
  287. responseType: "blob",
  288. };
  289. this.$confirm("您确定导出分发清单", "提示", {
  290. confirmButtonText: "确定",
  291. cancelButtonText: "取消",
  292. type: "warning",
  293. })
  294. .then(() => {
  295. load.startLoading();
  296. axios(options)
  297. .then((res) => {
  298. let blob = new Blob([res.data], {
  299. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  300. type: "application/vnd.ms-excel;charset=utf-8",
  301. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  302. });
  303. let text = new Response(blob).text();
  304. text.then((res) => {
  305. // 判断是否报错
  306. if (res.indexOf("code") != -1) {
  307. let json = JSON.parse(res);
  308. if (json.code == 403) {
  309. this.$message.error(`登录过期,请重新登录!`);
  310. setTimeout(() => {
  311. this.$store.dispatch("user/resetToken").then(() => {
  312. location.reload();
  313. });
  314. }, 1000);
  315. return;
  316. }
  317. this.$message.error(json.msg);
  318. } else {
  319. let objectUrl = URL.createObjectURL(blob);
  320. let link = document.createElement("a");
  321. let nowTime = new Date();
  322. let ymd =
  323. nowTime.getFullYear() +
  324. "" +
  325. (nowTime.getMonth() + 1) +
  326. "" +
  327. nowTime.getDate() +
  328. "" +
  329. nowTime.getHours() +
  330. "" +
  331. nowTime.getMinutes();
  332. let fname = this.$route.query.id + "-" + ymd + "分发清单.xls"; //下载文件的名字
  333. link.href = objectUrl;
  334. link.setAttribute("download", fname);
  335. document.body.appendChild(link);
  336. link.click();
  337. }
  338. });
  339. load.endLoading();
  340. })
  341. .catch((error) => {
  342. this.$message.error("导出数据失败,请联系管理员");
  343. load.endLoading();
  344. });
  345. })
  346. .catch(() => {});
  347. },
  348. },
  349. };
  350. </script>
  351. <style lang="scss" scoped>
  352. </style>