retail_list.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. <template>
  2. <div class="app-container">
  3. <div v-show="!isShowDetail && !isShowForm && !isShowExamine && !isShowReturn">
  4. <!-- 筛选条件 -->
  5. <div class="screen-container">
  6. <el-form ref="screenForm" :model="screenForm" label-width="70px" size="small" label-position="left">
  7. <el-row :gutter="20">
  8. <el-col :xs="24" :sm="24" :lg="24">
  9. <el-form-item prop="status" label-width="0">
  10. <el-radio-group v-model="screenForm.status" size="medium" @change="getList()">
  11. <el-radio-button label="">全部</el-radio-button>
  12. <el-radio-button v-for="(item, index) in statusList" :key="index" :label="item.value">{{item.label}}</el-radio-button>
  13. </el-radio-group>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :xs="24" :sm="12" :lg="6">
  17. <el-form-item label="订单号" prop="orderNum">
  18. <el-input v-model="screenForm.orderNum" placeholder="请输入订单号"></el-input>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :xs="24" :sm="12" :lg="6">
  22. <el-form-item label="产品名称" prop="goodsName">
  23. <el-input v-model="screenForm.goodsName" placeholder="请输入产品名称"></el-input>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :xs="24" :sm="12" :lg="6">
  27. <el-form-item label="规格型号" prop="model">
  28. <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :xs="24" :sm="12" :lg="6">
  32. <el-form-item label="经销商" prop="jxsName">
  33. <el-input v-model="screenForm.jxsName" placeholder="请输入经销商"></el-input>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :xs="24" :sm="12" :lg="6">
  37. <el-form-item label="订单日期" prop="date">
  38. <el-date-picker
  39. v-model="screenForm.date"
  40. type="datetimerange"
  41. range-separator="至"
  42. style="width: 100%;"
  43. value-format="yyyy-MM-dd HH:mm:ss"
  44. start-placeholder="开始日期"
  45. end-placeholder="结束日期">
  46. </el-date-picker>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :xs="24" :sm="12" :lg="6">
  50. <el-form-item label="是否直调" prop="isDirectTransfer">
  51. <el-select v-model="screenForm.isDirectTransfer" placeholder="请选择是否直调">
  52. <el-option label="是" :value="true"></el-option>
  53. <el-option label="否" :value="false"></el-option>
  54. </el-select>
  55. </el-form-item>
  56. </el-col>
  57. <el-col :xs="24" :sm="12" :lg="6">
  58. <el-form-item label="制表人" prop="zbMan">
  59. <el-input v-model="screenForm.zbMan" placeholder="请输入制表人"></el-input>
  60. </el-form-item>
  61. </el-col>
  62. <el-col :xs="24" :sm="12" :lg="6">
  63. <el-form-item label="审核人" prop="shMan">
  64. <el-input v-model="screenForm.shMan" placeholder="请输入审核人"></el-input>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :xs="24" :sm="12" :lg="6">
  68. <el-form-item label="业务员" prop="salesMan">
  69. <el-select v-model="screenForm.salesMan" placeholder="选择业务员" size="small" clearable filterable style="width: 100%">
  70. <el-option
  71. v-for="item in salesmanList"
  72. :key="item.adminUserId"
  73. :label="item.nickName"
  74. :value="item.adminUserId">
  75. </el-option>
  76. </el-select>
  77. </el-form-item>
  78. </el-col>
  79. <el-col :xs="24" :sm="12" :lg="18" class="tr">
  80. <el-form-item label="">
  81. <el-button size="small" @click="resetScreenForm">清空</el-button>
  82. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  83. </el-form-item>
  84. </el-col>
  85. </el-row>
  86. </el-form>
  87. </div>
  88. <div class="mymain-container">
  89. <div class="btn-group clearfix">
  90. <div class="fl">
  91. <el-button size="small" type="primary" icon="el-icon-plus" @click="toForm()" v-if="$checkBtnRole('add', $route.meta.roles)">新增</el-button>
  92. </div>
  93. <div class="fr">
  94. <ExportButton :exUrl="'retail/export'" :exParams="exParams" />
  95. </div>
  96. </div>
  97. <div class="table">
  98. <el-table
  99. v-loading="listLoading"
  100. :data="dataList"
  101. element-loading-text="Loading"
  102. border
  103. fit
  104. highlight-current-row
  105. stripe
  106. show-summary
  107. :summary-method="$getSummaries">
  108. <!-- <el-table-column align="left" label="提货进度" min-width="120" show-overflow-tooltip>
  109. <template slot-scope="scope">
  110. <el-progress :text-inside="true" :stroke-width="26" :percentage="((scope.row.hasSendQty * 100) / (scope.row.totalQty * 100)) || 0"></el-progress>
  111. </template>
  112. </el-table-column> -->
  113. <el-table-column align="left" label="审核状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
  114. <template slot-scope="scope">
  115. {{scope.row.examineStatus | statusFilter}}
  116. </template>
  117. </el-table-column>
  118. <el-table-column align="left" label="开票状态" prop="isInvoicing" min-width="100" show-overflow-tooltip>
  119. <template slot-scope="scope">
  120. {{scope.row.isInvoicing ? '已开票':'未开票'}}
  121. </template>
  122. </el-table-column>
  123. <el-table-column align="left" label="订单号" prop="id" min-width="150" show-overflow-tooltip>
  124. <template slot-scope="scope">
  125. <CopyButton :copyText="scope.row.id" />
  126. <span>{{scope.row.id}}</span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column align="left" label="订单日期" prop="theTime" min-width="120" show-overflow-tooltip>
  130. <template slot-scope="scope">
  131. <div>
  132. <span>{{scope.row.theTime | dateToDayFilter}}</span>
  133. <el-button type="text" icon="el-icon-edit" style="padding: 0; margin-left: 4px" v-if="$checkBtnRole('date', $route.meta.roles)" @click="editDate(scope.row)" ></el-button>
  134. </div>
  135. </template>
  136. </el-table-column>
  137. <el-table-column align="left" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
  138. <el-table-column align="left" label="物料编码" prop="materialCode" min-width="120" show-overflow-tooltip>
  139. <template slot-scope="scope">
  140. <CopyButton :copyText="scope.row.materialCode" />
  141. <span>{{scope.row.materialCode}}</span>
  142. </template>
  143. </el-table-column>
  144. <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="140" show-overflow-tooltip>
  145. <template slot-scope="scope">
  146. <CopyButton :copyText="scope.row.materialOldNumber" />
  147. <span>{{scope.row.materialOldNumber}}</span>
  148. </template>
  149. </el-table-column>
  150. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip>
  151. <template slot-scope="scope">
  152. <CopyButton :copyText="scope.row.materialName" />
  153. <span>{{scope.row.materialName}}</span>
  154. </template>
  155. </el-table-column>
  156. <el-table-column align="left" label="规格型号" prop="specification" min-width="180" show-overflow-tooltip>
  157. <template slot-scope="scope">
  158. <CopyButton :copyText="scope.row.specification" />
  159. <span>{{scope.row.specification}}</span>
  160. </template>
  161. </el-table-column>
  162. <el-table-column align="left" label="计量单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  163. <el-table-column align="left" label="是否直调" prop="isDirectTransfer" min-width="100" show-overflow-tooltip>
  164. <template slot-scope="scope">
  165. {{scope.row.isDirectTransfer ? '是':'否'}}
  166. </template>
  167. </el-table-column>
  168. <el-table-column align="right" label="总数量" prop="qty" min-width="100" sortable show-overflow-tooltip></el-table-column>
  169. <el-table-column align="right" label="直调数量" prop="directTransferQty" min-width="110" sortable show-overflow-tooltip></el-table-column>
  170. <el-table-column align="right" label="出库数量" prop="hasSendQty" min-width="110" sortable show-overflow-tooltip></el-table-column>
  171. <el-table-column align="right" label="可退数量" prop="refundableQty" min-width="110" sortable show-overflow-tooltip></el-table-column>
  172. <el-table-column align="right" label="单价" prop="price" min-width="100" sortable show-overflow-tooltip>
  173. <template slot-scope="scope">
  174. {{ scope.row.price | numToFixed }}
  175. </template>
  176. </el-table-column>
  177. <el-table-column align="right" label="订单金额" prop="totalAmount" min-width="110" sortable show-overflow-tooltip>
  178. <template slot-scope="scope">
  179. {{ scope.row.totalAmount | numToFixed }}
  180. </template>
  181. </el-table-column>
  182. <el-table-column align="right" label="实付金额" prop="payAmount" min-width="110" sortable show-overflow-tooltip>
  183. <template slot-scope="scope">
  184. {{ scope.row.payAmount | numToFixed }}
  185. </template>
  186. </el-table-column>
  187. <el-table-column align="left" label="返利类型" prop="customerWalletName2" min-width="140" show-overflow-tooltip></el-table-column>
  188. <el-table-column align="right" label="返利金额" prop="rebateAmount" min-width="110" sortable show-overflow-tooltip>
  189. <template slot-scope="scope">
  190. <div>{{scope.row.rebateAmount | numToFixed}}</div>
  191. </template>
  192. </el-table-column>
  193. <el-table-column align="right" label="实际返利金额" prop="payRebateAmount" min-width="130" sortable show-overflow-tooltip>
  194. <template slot-scope="scope">
  195. <div>{{scope.row.payRebateAmount | numToFixed}}</div>
  196. </template>
  197. </el-table-column>
  198. <el-table-column align="right" label="格力折扣" prop="totalDiscAmount" min-width="110" sortable show-overflow-tooltip>
  199. <template slot-scope="scope">
  200. {{ scope.row.totalDiscAmount | numToFixed }}
  201. </template>
  202. </el-table-column>
  203. <el-table-column align="left" label="业务员" prop="k3ServiceName" min-width="120" show-overflow-tooltip></el-table-column>
  204. <el-table-column align="left" label="制表人" prop="createName" min-width="100" show-overflow-tooltip></el-table-column>
  205. <el-table-column align="left" label="制表日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  206. <el-table-column align="left" label="审核人" prop="examineName" min-width="100" show-overflow-tooltip></el-table-column>
  207. <el-table-column align="left" label="审核日期" prop="examineTime" min-width="160" show-overflow-tooltip></el-table-column>
  208. <el-table-column align="center" label="操作" width="220" fixed="right">
  209. <template slot-scope="scope">
  210. <el-popconfirm
  211. style="margin-right: 10px;"
  212. title="确定申请吗?"
  213. @onConfirm="handleSubmit(scope.row.id)"
  214. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'SAVE'" >
  215. <el-button slot="reference" type="text">申请</el-button>
  216. </el-popconfirm>
  217. <el-popconfirm
  218. style="margin-right: 10px;"
  219. title="确定撤回吗?"
  220. @onConfirm="handleWithdraw(scope.row.id)"
  221. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'WAIT'" >
  222. <el-button slot="reference" type="text">撤回</el-button>
  223. </el-popconfirm>
  224. <el-popconfirm
  225. style="margin-right: 10px;"
  226. title="确定弃审吗?"
  227. @onConfirm="handleAbandon(scope.row.id)"
  228. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" >
  229. <el-button slot="reference" type="text">弃审</el-button>
  230. </el-popconfirm>
  231. <el-button
  232. type="text"
  233. @click="toExamine(scope.row)"
  234. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'WAIT'">
  235. 审批
  236. </el-button>
  237. <el-button
  238. type="text"
  239. @click="toForm(scope.row)"
  240. v-if="$checkBtnRole('edit', $route.meta.roles) && scope.row.examineStatus === 'SAVE'">
  241. 编辑
  242. </el-button>
  243. <el-button
  244. type="text"
  245. @click="toReturn(scope.row)"
  246. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'">
  247. 退订
  248. </el-button>
  249. <el-button
  250. type="text"
  251. @click="toDetail(scope.row)">
  252. 详情
  253. </el-button>
  254. <el-popconfirm
  255. style="margin-left: 10px;"
  256. title="确定关闭吗?"
  257. @onConfirm="handleClose(scope.row.id)"
  258. v-if="$checkBtnRole('examine', $route.meta.roles) && !scope.row.closeTime && (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'WAIT')" >
  259. <el-button slot="reference" type="text">关闭</el-button>
  260. </el-popconfirm>
  261. <el-popconfirm
  262. style="margin-left: 10px;"
  263. title="确定删除吗?"
  264. @onConfirm="handleDelete(scope.row.id)"
  265. v-if="$checkBtnRole('del', $route.meta.roles) && scope.row.examineStatus === 'SAVE'" >
  266. <el-button slot="reference" type="text" style="color: #f56c6c;">删除</el-button>
  267. </el-popconfirm>
  268. </template>
  269. </el-table-column>
  270. </el-table>
  271. </div>
  272. </div>
  273. <div class="pagination clearfix">
  274. <div class="fr">
  275. <el-pagination
  276. @size-change="handleSizeChange"
  277. @current-change="handleCurrentChange"
  278. :current-page="currentPage"
  279. :page-sizes="[10, 20, 30, 50]"
  280. :page-size="10"
  281. layout="total, sizes, prev, pager, next, jumper"
  282. :total="listTotal">
  283. </el-pagination>
  284. </div>
  285. </div>
  286. </div>
  287. <EditDateDialog :isShow.sync="isShowEditDateDialog" :dateForm.sync="dateForm" />
  288. <RetailDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  289. <RetailForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  290. <RetailExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
  291. <RetailReturn :listItem="queryItem" v-if="isShowReturn" @backListFormDetail="backList" />
  292. </div>
  293. </template>
  294. <script>
  295. import { getList, closeData, submitData, editData, abandonData, deleteData, withdrawData } from "@/api/supply/retail";
  296. import { getSalesmanList } from '@/api/common'
  297. import RetailDetail from "@/views/supply/retail/components/retail_detail";
  298. import RetailForm from "@/views/supply/retail/components/retail_form";
  299. import RetailExamine from "@/views/supply/retail/components/retail_examine";
  300. import RetailReturn from "@/views/supply/retail/components/retail_return";
  301. import EditDateDialog from "@/components/Common/edit-date-dialog";
  302. let that
  303. export default {
  304. components: {
  305. RetailDetail,
  306. RetailForm,
  307. RetailExamine,
  308. RetailReturn,
  309. EditDateDialog,
  310. },
  311. filters: {
  312. statusFilter(val) {
  313. let obj = that.statusList.find(o => o.value == val);
  314. return obj ? obj.label : ''
  315. }
  316. },
  317. data() {
  318. return {
  319. currentPage: 1, // 当前页码
  320. pageSize: 10, // 每页数量
  321. listTotal: 0, // 列表总数
  322. dataList: null, // 列表数据
  323. listLoading: false, // 列表加载loading
  324. screenForm: { // 筛选表单数据
  325. orderNum: '',
  326. goodsName: '',
  327. model: '',
  328. jxsName: '',
  329. date: '',
  330. isDirectTransfer: '',
  331. zbMan: '',
  332. shMan: '',
  333. salesMan: '',
  334. status: '',
  335. },
  336. statusList: [
  337. { label: '已保存', value: 'SAVE' },
  338. { label: '待审核', value: 'WAIT' },
  339. { label: '审核通过', value: 'OK' },
  340. { label: '已关闭', value: 'CLOSE' },
  341. ],
  342. salesmanList: [],
  343. queryItem: {},
  344. isShowDetail: false,
  345. isShowForm: false,
  346. isShowExamine: false,
  347. isShowReturn: false,
  348. editId: null,
  349. isShowEditDateDialog: false,
  350. dateForm: {
  351. date: '',
  352. },
  353. }
  354. },
  355. computed: {
  356. exParams() {
  357. return {
  358. examineStatus: this.screenForm.status,
  359. id: this.screenForm.orderNum,
  360. materialName: this.screenForm.goodsName,
  361. specification: this.screenForm.model,
  362. customer: this.screenForm.jxsName,
  363. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  364. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  365. createBy: this.screenForm.zbMan,
  366. examineBy: this.screenForm.shMan,
  367. isDirectTransfer: this.screenForm.isDirectTransfer,
  368. serviceId: this.screenForm.salesMan,
  369. type: 1, // 1:普通零售单,2:政策零售单
  370. }
  371. },
  372. },
  373. beforeCreate() {
  374. that = this;
  375. },
  376. created() {
  377. this.getSalesmanList();
  378. this.getList();
  379. },
  380. methods: {
  381. // 获取业务员列表
  382. getSalesmanList() {
  383. getSalesmanList({
  384. pageNum: 1,
  385. pageSize: -1,
  386. isCustomer: 0,
  387. status: true,
  388. }).then(res => {
  389. this.salesmanList = res.data.records;
  390. })
  391. },
  392. // 查询列表
  393. getList() {
  394. this.listLoading = true;
  395. let params = {
  396. pageNum: this.currentPage,
  397. pageSize: this.pageSize,
  398. examineStatus: this.screenForm.status,
  399. id: this.screenForm.orderNum,
  400. materialName: this.screenForm.goodsName,
  401. specification: this.screenForm.model,
  402. customer: this.screenForm.jxsName,
  403. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  404. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  405. createBy: this.screenForm.zbMan,
  406. examineBy: this.screenForm.shMan,
  407. isDirectTransfer: this.screenForm.isDirectTransfer,
  408. serviceId: this.screenForm.salesMan,
  409. type: 1, // 1:普通零售单,2:政策零售单
  410. };
  411. getList(params).then((res) => {
  412. res.data.records.forEach(item => {
  413. item.sums1 = ['qty', 'directTransferQty', 'hasSendQty', 'refundableQty'];
  414. item.sums2 = ['price', 'totalAmount', 'payAmount', 'rebateAmount', 'payRebateAmount', 'totalDiscAmount'];
  415. })
  416. this.dataList = res.data.records;
  417. this.listTotal = res.data.total;
  418. this.listLoading = false;
  419. })
  420. },
  421. // 提交筛选表单
  422. submitScreenForm() {
  423. this.currentPage = 1;
  424. this.getList();
  425. },
  426. // 重置筛选表单
  427. resetScreenForm() {
  428. this.$refs.screenForm.resetFields();
  429. this.currentPage = 1;
  430. this.getList();
  431. },
  432. // 更改每页数量
  433. handleSizeChange(val) {
  434. this.pageSize = val;
  435. this.currentPage = 1;
  436. this.getList();
  437. },
  438. // 更改当前页
  439. handleCurrentChange(val) {
  440. this.currentPage = val;
  441. this.getList();
  442. },
  443. // 进入表单
  444. toForm(item) {
  445. this.queryItem = item;
  446. this.isShowForm = true;
  447. },
  448. // 进入详情
  449. toDetail(item) {
  450. this.queryItem = item;
  451. this.isShowDetail = true;
  452. },
  453. // 进入审批
  454. toExamine(item) {
  455. this.queryItem = item;
  456. this.isShowExamine = true;
  457. },
  458. // 进入退订
  459. toReturn(item) {
  460. if(item.refundableQty < 1) {
  461. return this.$errorMsg('可退数量为0');
  462. }
  463. this.queryItem = item;
  464. this.isShowReturn = true;
  465. },
  466. backList() {
  467. this.queryItem = {};
  468. this.isShowDetail = false;
  469. this.isShowForm = false;
  470. this.isShowExamine = false;
  471. this.isShowReturn = false;
  472. },
  473. // 关闭
  474. handleClose(id) {
  475. closeData({id}).then(res => {
  476. this.$successMsg();
  477. this.getList();
  478. })
  479. },
  480. // 删除
  481. handleDelete(id) {
  482. deleteData({id}).then(res => {
  483. this.$successMsg();
  484. this.getList();
  485. })
  486. },
  487. // 弃审
  488. handleAbandon(id) {
  489. abandonData({id}).then(res => {
  490. this.$successMsg();
  491. this.getList();
  492. })
  493. },
  494. // 申请
  495. handleSubmit(id) {
  496. submitData({id}).then(res => {
  497. this.$successMsg();
  498. this.getList();
  499. })
  500. },
  501. // 撤回
  502. handleWithdraw(id) {
  503. withdrawData({id}).then(res => {
  504. this.$successMsg();
  505. this.getList();
  506. })
  507. },
  508. // 打开 修改订单日期
  509. editDate(item) {
  510. this.editId = item.id;
  511. this.dateForm.date = item.theTime.slice(0, 10);
  512. this.isShowEditDateDialog = true;
  513. },
  514. // 提交 修改订单日期
  515. submitDateForm() {
  516. editData({
  517. id: this.editId,
  518. theTime: this.dateForm.date + ' 00:00:00',
  519. }).then(res => {
  520. this.isShowEditDateDialog = false;
  521. this.getList();
  522. this.$successMsg('修改成功');
  523. })
  524. },
  525. }
  526. }
  527. </script>
  528. <style lang="scss" scoped>
  529. </style>