retail_list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :getList="getList"
  5. :exportList="exportList"
  6. :operation="operation()"
  7. :optionsEvensGroup="optionsEvensGroup"
  8. :columnParsing="columnParsing"
  9. :operationColumnWidth="200"
  10. >
  11. <EditDateDialog :isShow.sync="isShowEditDateDialog" :dateForm.sync="dateForm" @submit="submitDateForm" />
  12. <Popu v-if="isShowDetail || isShowForm || isShowExamine || isShowReturn">
  13. <RetailDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  14. <RetailForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  15. <RetailExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
  16. <RetailReturn :listItem="queryItem" v-if="isShowReturn" @backListFormDetail="backList" />
  17. </Popu>
  18. </template-page>
  19. </template>
  20. <script>
  21. import TemplatePage from '@/components/template/template-page-1.vue'
  22. import import_mixin from '@/components/template/import_mixin.js'
  23. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  24. import Popu from '@/components/template/popu.vue'
  25. import {
  26. getList,
  27. closeData,
  28. submitData,
  29. editData,
  30. abandonData,
  31. deleteData,
  32. withdrawData,
  33. getRetaillListV2,
  34. exportRetaillListV2
  35. } from '@/api/supply/retail'
  36. import { getSalesmanList, getTypeList } from '@/api/common'
  37. import RetailDetail from '@/views/supply/retail/components/retail_detail'
  38. import RetailForm from '@/views/supply/retail/components/retail_form'
  39. import RetailExamine from '@/views/supply/retail/components/retail_examine'
  40. import RetailReturn from '@/views/supply/retail/components/retail_return'
  41. import EditDateDialog from '@/components/Common/edit-date-dialog'
  42. import { getNoRebateWalletList } from '@/api/policy_list'
  43. export default {
  44. components: { TemplatePage, Popu, RetailDetail, RetailForm, RetailExamine, RetailReturn, EditDateDialog },
  45. mixins: [import_mixin, add_callback_mixin],
  46. data() {
  47. return {
  48. visible: false,
  49. // 事件组合
  50. optionsEvensGroup: [
  51. [
  52. [
  53. {
  54. name: '新增',
  55. click: this.addOn(() => {
  56. this.toForm()
  57. }),
  58. isRole: this.$checkBtnRole('add', this.$route.meta.roles)
  59. }
  60. ]
  61. ]
  62. ],
  63. // 表格属性
  64. tableAttributes: {
  65. // 启用勾选列
  66. selectColumn: true
  67. }, // 关闭新增弹窗
  68. // 表格事件
  69. tableEvents: {
  70. 'selection-change': this.selectionChange
  71. },
  72. recordSelected: [],
  73. currentPage: 1, // 当前页码
  74. pageSize: 10, // 每页数量
  75. listTotal: 0, // 列表总数
  76. dataList: null, // 列表数据
  77. listLoading: false, // 列表加载loading
  78. screenForm: {
  79. // 筛选表单数据
  80. orderNum: '',
  81. goodsName: '',
  82. model: '',
  83. jxsName: '',
  84. date: [],
  85. isDirectTransfer: '',
  86. zbMan: '',
  87. shMan: '',
  88. salesMan: '',
  89. status: '',
  90. k3ServiceId: '',
  91. serviceId: '',
  92. saleTypeId: '',
  93. customerWalletId: ''
  94. },
  95. statusList: [
  96. { label: '已保存', value: 'SAVE' },
  97. { label: '待审核', value: 'WAIT' },
  98. { label: '审核通过', value: 'OK' }
  99. // { label: "已关闭", value: "CLOSE" },
  100. ],
  101. salesmanList: [],
  102. NoRebateWalletList: [],
  103. typeList: [],
  104. queryItem: {},
  105. isShowDetail: false,
  106. isShowForm: false,
  107. isShowExamine: false,
  108. isShowReturn: false,
  109. isCollapse: true,
  110. editId: null,
  111. isShowEditDateDialog: false,
  112. dateForm: {
  113. date: ''
  114. }
  115. }
  116. },
  117. methods: {
  118. // 列表请求函数
  119. getList(...p) {
  120. this.recordSelected = []
  121. return getRetaillListV2(...p)
  122. },
  123. // 列表导出函数
  124. exportList: exportRetaillListV2,
  125. // 表格列解析渲染数据更改
  126. columnParsing(item, defaultData) {
  127. if (item.colName === 'the_time') {
  128. defaultData.render = (h, { row, index, column }) => {
  129. return (
  130. <div class="dateClass">
  131. <span>{row.theTime}</span>
  132. {this.$checkBtnRole('date', this.$route.meta.roles) ? (
  133. <el-button
  134. type="text"
  135. icon="el-icon-edit"
  136. style="padding: 0; margin-left: 6px"
  137. onClick={() => this.editDate(row)}
  138. />
  139. ) : (
  140. ''
  141. )}
  142. </div>
  143. )
  144. }
  145. }
  146. return defaultData
  147. },
  148. // 监听勾选变化
  149. selectionChange(data) {
  150. this.recordSelected = data
  151. },
  152. operation() {
  153. return (h, { row, index, column }) => {
  154. const statusData = row.selectMapData.examineStatus
  155. return (
  156. <div class="operation-btns">
  157. {this.$checkBtnRole('apply', this.$route.meta.roles) && row.examineStatus === statusData['SAVE'] ? (
  158. <el-popconfirm title="确定申请吗?" onOnConfirm={() => this.handleSubmit(row.id)}>
  159. <el-button slot="reference" type="text">
  160. 申请
  161. </el-button>
  162. </el-popconfirm>
  163. ) : null}
  164. {this.$checkBtnRole('apply', this.$route.meta.roles) && row.examineStatus === statusData['WAIT'] ? (
  165. <el-popconfirm title="确定撤回吗?" onOnConfirm={() => this.handleWithdraw(row.id)}>
  166. <el-button slot="reference" type="text">
  167. 撤回
  168. </el-button>
  169. </el-popconfirm>
  170. ) : null}
  171. {this.$checkBtnRole('examine', this.$route.meta.roles) && row.examineStatus === statusData['OK'] ? (
  172. <el-popconfirm title="确定弃审吗?" onOnConfirm={() => this.handleAbandon(row.id)}>
  173. <el-button slot="reference" type="text">
  174. 弃审
  175. </el-button>
  176. </el-popconfirm>
  177. ) : null}
  178. {this.$checkBtnRole('examine', this.$route.meta.roles) &&
  179. !row.closeTime &&
  180. (row.examineStatus === statusData['SAVE'] || row.examineStatus === statusData['WAIT']) ? (
  181. <el-popconfirm title="确定关闭吗?" onOnConfirm={() => this.handleClose(row.id)}>
  182. <el-button slot="reference" type="text">
  183. 关闭
  184. </el-button>
  185. </el-popconfirm>
  186. ) : null}
  187. {this.$checkBtnRole('del', this.$route.meta.roles) && row.examineStatus === statusData['SAVE'] ? (
  188. <el-popconfirm title="确定删除吗?" onOnConfirm={() => this.handleDelete(row.id)}>
  189. <el-button slot="reference" type="text" style="color: #f56c6c">
  190. 删除
  191. </el-button>
  192. </el-popconfirm>
  193. ) : null}
  194. {this.$checkBtnRole('examine', this.$route.meta.roles) && row.examineStatus === statusData['WAIT'] ? (
  195. <el-button type="text" onClick={() => this.toExamine(row)}>
  196. 审批
  197. </el-button>
  198. ) : null}
  199. {this.$checkBtnRole('edit', this.$route.meta.roles) && row.examineStatus === statusData['SAVE'] ? (
  200. <el-button type="text" onClick={() => this.toForm(row)}>
  201. 编辑
  202. </el-button>
  203. ) : null}
  204. {this.$checkBtnRole('examine', this.$route.meta.roles) && row.examineStatus === statusData['OK'] ? (
  205. <el-button type="text" onClick={() => this.toReturn(row)}>
  206. 退订
  207. </el-button>
  208. ) : null}
  209. <el-button type="text" onClick={() => this.toDetail(row)}>
  210. {' '}
  211. 详情{' '}
  212. </el-button>
  213. </div>
  214. )
  215. }
  216. },
  217. // 获取业务员列表
  218. getSalesmanList() {
  219. getSalesmanList({
  220. pageNum: 1,
  221. pageSize: -1,
  222. isCustomer: 0,
  223. status: true
  224. }).then(res => {
  225. this.salesmanList = res.data.records
  226. })
  227. getNoRebateWalletList({
  228. walletName: ''
  229. }).then(res => {
  230. console.log(res)
  231. this.NoRebateWalletList = res.data
  232. console.log(this.NoRebateWalletList)
  233. })
  234. getTypeList({ pageNum: 1, pageSize: -1 }).then(res => {
  235. this.typeList = res.data.records
  236. console.log(this.typeList)
  237. })
  238. },
  239. // 提交筛选表单
  240. submitScreenForm() {
  241. this.currentPage = 1
  242. this.$refs.pageRef.refreshList()
  243. },
  244. // 重置筛选表单
  245. resetScreenForm() {
  246. this.$refs.screenForm.resetFields()
  247. this.currentPage = 1
  248. this.$refs.pageRef.refreshList()
  249. },
  250. // 更改每页数量
  251. handleSizeChange(val) {
  252. this.pageSize = val
  253. this.currentPage = 1
  254. this.$refs.pageRef.refreshList()
  255. },
  256. // 更改当前页
  257. handleCurrentChange(val) {
  258. this.currentPage = val
  259. this.$refs.pageRef.refreshList()
  260. },
  261. // 进入表单
  262. toForm(item) {
  263. this.queryItem = item
  264. this.isShowForm = true
  265. },
  266. // 进入详情
  267. toDetail(item) {
  268. this.queryItem = item
  269. this.isShowDetail = true
  270. },
  271. // 进入审批
  272. toExamine(item) {
  273. this.queryItem = item
  274. this.isShowExamine = true
  275. },
  276. // 进入退订
  277. toReturn(item) {
  278. if (item.refundableQty < 1) {
  279. return this.$errorMsg('可退数量为0')
  280. }
  281. this.queryItem = item
  282. this.isShowReturn = true
  283. },
  284. backList() {
  285. this.queryItem = {}
  286. this.addOff(() => {
  287. this.isShowDetail = false
  288. this.isShowForm = false
  289. this.isShowExamine = false
  290. this.isShowReturn = false
  291. })()
  292. this.$refs.pageRef.refreshList()
  293. },
  294. // 关闭
  295. handleClose(id) {
  296. closeData({ id }).then(res => {
  297. this.$successMsg()
  298. this.$refs.pageRef.refreshList()
  299. })
  300. },
  301. // 删除
  302. handleDelete(id) {
  303. deleteData({ id }).then(res => {
  304. this.$successMsg()
  305. this.$refs.pageRef.refreshList()
  306. })
  307. },
  308. // 弃审
  309. handleAbandon(id) {
  310. abandonData({ id }).then(res => {
  311. this.$successMsg()
  312. this.$refs.pageRef.refreshList()
  313. })
  314. },
  315. // 申请
  316. handleSubmit(id) {
  317. submitData({ id }).then(res => {
  318. this.$successMsg()
  319. this.$refs.pageRef.refreshList()
  320. })
  321. },
  322. // 撤回
  323. handleWithdraw(id) {
  324. withdrawData({ id }).then(res => {
  325. this.$successMsg()
  326. this.$refs.pageRef.refreshList()
  327. })
  328. },
  329. // 打开 修改订单日期
  330. editDate(item) {
  331. this.editId = item.id
  332. this.dateForm.date = item.theTime.slice(0, 10)
  333. this.isShowEditDateDialog = true
  334. },
  335. // 提交 修改订单日期
  336. submitDateForm() {
  337. editData({
  338. id: this.editId,
  339. theTime: this.dateForm.date + ' 00:00:00'
  340. }).then(res => {
  341. this.isShowEditDateDialog = false
  342. this.$refs.pageRef.refreshList()
  343. this.$successMsg('修改成功')
  344. })
  345. }
  346. }
  347. }
  348. </script>
  349. <style lang="scss" scoped></style>