list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <a-card size="small" :bordered="false" class="salesManagementList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline">
  6. <a-row :gutter="15">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="创建时间">
  9. <a-range-picker
  10. style="width:100%"
  11. id="salesManagementList-creatDate"
  12. :disabledDate="disabledDate"
  13. v-model="time"
  14. :format="dateFormat"
  15. :placeholder="['开始时间', '结束时间']" />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  20. <a-select
  21. id="salesManagementList-buyerName"
  22. placeholder="请选择客户"
  23. allowClear
  24. v-model="queryParam.buyerName"
  25. :showSearch="true"
  26. option-filter-prop="children"
  27. :filter-option="filterOption">
  28. <a-select-option v-for="item in customeList" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
  29. </a-select>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :md="6" :sm="24">
  33. <a-form-item label="销售单号">
  34. <a-input id="salesManagementList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  35. </a-form-item>
  36. </a-col>
  37. <template v-if="advanced">
  38. <a-col :md="6" :sm="24">
  39. <a-form-item label="采购单号">
  40. <a-input id="salesManagementList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
  41. </a-form-item>
  42. </a-col>
  43. <a-col :md="6" :sm="24">
  44. <a-form-item label="支付方式">
  45. <v-select
  46. v-model="queryParam.payType"
  47. ref="payType"
  48. id="salesManagementList-payType"
  49. code="PAYMENT_TYPE"
  50. placeholder="请选择支付方式"
  51. allowClear></v-select>
  52. </a-form-item>
  53. </a-col>
  54. <a-col :md="6" :sm="24">
  55. <a-form-item label="收款方式">
  56. <v-select
  57. v-model="queryParam.settleStyle"
  58. ref="settleStyle"
  59. id="salesManagementList-settleStyle"
  60. code="PAYMENT_TYPE"
  61. placeholder="请选择收款方式"
  62. allowClear></v-select>
  63. </a-form-item>
  64. </a-col>
  65. <a-col :md="6" :sm="24">
  66. <a-form-item label="业务状态">
  67. <v-select
  68. v-model="queryParam.auditStatus"
  69. ref="auditStatus"
  70. id="salesManagementList-auditStatus"
  71. code="PAYMENT_TYPE"
  72. placeholder="请选择业务状态"
  73. allowClear></v-select>
  74. </a-form-item>
  75. </a-col>
  76. <a-col :md="6" :sm="24">
  77. <a-form-item label="财务状态">
  78. <v-select
  79. v-model="queryParam.financialStatus"
  80. ref="financialStatus"
  81. id="salesManagementList-financialStatus"
  82. code="PAYMENT_TYPE"
  83. placeholder="请选择财务状态"
  84. allowClear></v-select>
  85. </a-form-item>
  86. </a-col>
  87. </template>
  88. <a-col :md="6" :sm="24">
  89. <span class="table-page-search-submitButtons">
  90. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  91. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  92. <a @click="advanced=!advanced" style="margin-left: 8px">
  93. {{ advanced ? '收起' : '展开' }}
  94. <a-icon :type="advanced ? 'up' : 'down'"/>
  95. </a>
  96. </span>
  97. </a-col>
  98. </a-row>
  99. </a-form>
  100. </div>
  101. <!-- 操作按钮 -->
  102. <div class="table-operator">
  103. <a-button type="primary" @click="handleAdd">新增销售单</a-button>
  104. </div>
  105. <!-- alert -->
  106. <a-alert type="info" showIcon style="margin-bottom:15px">
  107. <div slot="message">总售价:<strong>13.00</strong>元;总单数:<strong>13.00</strong>;总款数:<strong>13.00</strong>;总数量:<strong>13.00</strong>;</div>
  108. </a-alert>
  109. <!-- 列表 -->
  110. <s-table
  111. class="sTable"
  112. ref="table"
  113. size="default"
  114. :rowKey="(record) => record.id"
  115. :columns="columns"
  116. :data="loadData"
  117. :scroll="{ x: 1960 }"
  118. bordered>
  119. <!-- 业务/审核状态 -->
  120. <template slot="auditStatus" slot-scope="text, record">
  121. <a-tag :color="record.state=='FINISH'?'green':'red'" >{{ record.state=='FINISH'? '待备货审核': '待单据审核' }}</a-tag>
  122. </template>
  123. <!-- 财务状态 -->
  124. <template slot="financialStatus" slot-scope="text, record">
  125. <a-tag :color="record.state==1?'green':'red'" >{{ record.state==1? '待提交': '待单据审核' }}</a-tag>
  126. </template>
  127. <!-- 操作 -->
  128. <template slot="action" slot-scope="text, record">
  129. <a-button size="small" type="link" @click="handleEexamine(record)" id="salesManagementList-eexamine-btn">审核</a-button>
  130. <a-divider type="vertical" style="margin: 0;" />
  131. <a-button size="small" type="link" @click="handleSend(record)" id="salesManagementList-send-btn">出库</a-button>
  132. <a-divider type="vertical" style="margin: 0;" />
  133. <a-button size="small" type="link" @click="handleDetail(record)" id="salesManagementList-detail-btn">详情</a-button>
  134. <a-divider type="vertical" style="margin: 0;" />
  135. <a-button size="small" type="link" @click="handleEdit(record)" id="salesManagementList-edit-btn">编辑</a-button>
  136. <a-divider type="vertical" style="margin: 0;" />
  137. <a-button size="small" type="link" @click="handleDel(record)" id="salesManagementList-del-btn">删除</a-button>
  138. </template>
  139. </s-table>
  140. <!-- 选择客户弹框 -->
  141. <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
  142. </a-card>
  143. </template>
  144. <script>
  145. import { STable, VSelect } from '@/components'
  146. import chooseCustomModal from './chooseCustomModal.vue'
  147. import { salesList, salesDel } from '@/api/sales'
  148. export default {
  149. name: 'TableList',
  150. components: { STable, VSelect, chooseCustomModal },
  151. data () {
  152. return {
  153. advanced: false, // 高级搜索 展开/关闭
  154. disabled: false, // 查询、重置按钮是否可操作
  155. dateFormat: 'YYYY-MM-DD',
  156. time: [], // 创建时间
  157. openModal: false, // 选择客户弹框是否显示
  158. customeList: [],
  159. // 查询参数
  160. queryParam: {
  161. buyerName: undefined, // 客户名称
  162. salesBillNo: '', // 销售单号
  163. purchaseBillNo: '', // 采购单号
  164. payType: undefined, // 支付方式
  165. settleStyle: undefined, // 收款方式
  166. auditStatus: undefined, // 业务状态
  167. financialStatus: undefined // 财务状态
  168. },
  169. // 表头
  170. columns: [
  171. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  172. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
  173. { title: '销售单号', dataIndex: 'salesBillNo', width: 140, align: 'center' },
  174. { title: '采购单号', dataIndex: 'purchaseBillNo', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  175. { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  176. { title: '总款数', dataIndex: 'totalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  177. { title: '总数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  178. { title: '总售价', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  179. { title: '支付方式', dataIndex: 'payType', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  180. { title: '收款方式', dataIndex: 'settleStyle', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  181. { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  182. { title: '急件', dataIndex: 'urgentFlag', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  183. { title: '业务状态', scopedSlots: { customRender: 'auditStatus' }, width: 110, align: 'center' },
  184. { title: '财务状态', scopedSlots: { customRender: 'financialStatus' }, width: 110, align: 'center' },
  185. { title: '操作', scopedSlots: { customRender: 'action' }, width: 260, align: 'center', fixed: 'right' }
  186. ],
  187. // 加载数据方法 必须为 Promise 对象
  188. loadData: parameter => {
  189. this.disabled = true
  190. return salesList(Object.assign(parameter, this.queryParam)).then(res => {
  191. const data = res.data
  192. const no = (data.pageNo - 1) * data.pageSize
  193. for (var i = 0; i < data.list.length; i++) {
  194. data.list[i].no = no + i + 1
  195. }
  196. this.disabled = false
  197. return data
  198. })
  199. }
  200. }
  201. },
  202. methods: {
  203. // 不可选日期
  204. disabledDate (date, dateStrings) {
  205. return date && date.valueOf() > Date.now()
  206. },
  207. // 新增
  208. handleAdd () {
  209. this.openModal = true
  210. },
  211. // 选择客户成功
  212. chooseCustomOk (data) {
  213. this.$router.push({ path: '/salesManagement/salesQuery/add' })
  214. },
  215. // 审核
  216. handleEexamine (row) {
  217. const _this = this
  218. this.$confirm({
  219. title: '提示',
  220. content: '确认要审核吗?',
  221. okText: '审核通过',
  222. cancelText: '审核不通过',
  223. centered: true,
  224. onOk () {
  225. // delectRolePower({
  226. // id: row.id
  227. // }).then(res => {
  228. // console.log(res, 'res1111')
  229. // if (res.status == 200) {
  230. // _this.$message.success(res.message)
  231. // _this.$refs.table.refresh()
  232. // }
  233. // })
  234. }
  235. })
  236. },
  237. // 出库
  238. handleSend (row) {
  239. const _this = this
  240. this.$confirm({
  241. title: '提示',
  242. content: '确认要出库吗?',
  243. centered: true,
  244. onOk () {
  245. // delectRolePower({
  246. // id: row.id
  247. // }).then(res => {
  248. // console.log(res, 'res1111')
  249. // if (res.status == 200) {
  250. // _this.$message.success(res.message)
  251. // _this.$refs.table.refresh()
  252. // }
  253. // })
  254. }
  255. })
  256. },
  257. // 详情
  258. handleDetail (row) {
  259. this.$router.push({ path: `/salesManagement/salesQuery/detail/${row.id}/${row.salesBillSn}` })
  260. },
  261. // 编辑
  262. handleEdit (row) {
  263. this.$router.push({ path: `/salesManagement/salesQuery/edit/${row.id}` })
  264. },
  265. // 删除
  266. handleDel (row) {
  267. const _this = this
  268. this.$confirm({
  269. title: '提示',
  270. content: '确认要删除吗?',
  271. centered: true,
  272. onOk () {
  273. salesDel({ id: row.id }).then(res => {
  274. if (res.status == 200) {
  275. _this.$message.success(res.message)
  276. _this.$refs.table.refresh()
  277. }
  278. })
  279. }
  280. })
  281. },
  282. resetSearchForm () {
  283. this.queryParam.buyerName = undefined
  284. this.queryParam.salesBillNo = ''
  285. this.queryParam.purchaseBillNo = ''
  286. this.queryParam.payType = undefined
  287. this.queryParam.settleStyle = undefined
  288. this.queryParam.auditStatus = undefined
  289. this.queryParam.financialStatus = undefined
  290. this.time = []
  291. this.$refs.table.refresh(true)
  292. },
  293. filterOption (input, option) {
  294. return (
  295. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  296. )
  297. }
  298. }
  299. }
  300. </script>
  301. <style lang="less">
  302. .ssalesManagementList-wrap{
  303. .sTable{
  304. margin-top: 15px;
  305. }
  306. }
  307. </style>