list.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <a-card size="small" :bordered="false" class="approveStore-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="联系人手机">
  10. <a-input allowClear placeholder="请输入联系人手机" v-model.tirm="queryParam.contactPhone"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="联系人姓名">
  15. <a-input allowClear placeholder="请输入联系人姓名" v-model.tirm="queryParam.contactName"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="门店名称">
  20. <a-input allowClear placeholder="请输入门店名称" v-model.tirm="queryParam.storeName"/>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="状态">
  25. <v-select
  26. v-model="queryParam.auditStatus"
  27. ref="auditStatus"
  28. id="approveStore-auditStatus"
  29. code="XPRH_STORE_APPLY_STATUS"
  30. placeholder="请选择审核状态"
  31. allowClear></v-select>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="6" :sm="24">
  35. <a-form-item label="关联汽配商">
  36. <storeList ref="storeList" @change="custChange"></storeList>
  37. </a-form-item>
  38. </a-col>
  39. <a-col :md="6" :sm="24">
  40. <div>
  41. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="approveStore-refresh">查询</a-button>
  42. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="approveStore-reset">重置</a-button>
  43. </div>
  44. </a-col>
  45. </a-row>
  46. </a-form>
  47. </div>
  48. <!-- 列表 -->
  49. <s-table
  50. class="sTable fixPagination"
  51. ref="table"
  52. :style="{ height: tableHeight+84.5+'px' }"
  53. size="small"
  54. :rowKey="(record) => record.id"
  55. :columns="columns"
  56. :data="loadData"
  57. :scroll="{ y: tableHeight }"
  58. :defaultLoadData="false"
  59. bordered>
  60. <!-- 图片 -->
  61. <template slot="imageUrl" slot-scope="text, record">
  62. <div v-if="text&&text.length">
  63. <img :src="text" width="30" height="30" class="imageUrl" @click="inited(text)" />
  64. </div>
  65. <span v-else>--</span>
  66. </template>
  67. <!-- 地址 -->
  68. <template slot="addr" slot-scope="text, record">
  69. <div style="word-break:break-all;" v-if="record.addrProvinceName||record.addrDetail">
  70. <div v-if="record.addrProvinceName">{{ record.addrProvinceName +'-'+ record.addrCityName +'-'+ record.addrDistrictName }}</div>
  71. <div v-if="record.addrDetail">{{ record.addrDetail }}</div>
  72. </div>
  73. <div v-else>--</div>
  74. </template>
  75. <!-- 操作 -->
  76. <template slot="action" slot-scope="text, record">
  77. <div v-if="record.auditStatus == 'WAIT'&&!record.inviteCode">
  78. <a-button size="small" type="link" class="button-primary" @click="handleAudit(record,1)">通过</a-button>
  79. <a-button size="small" type="link" class="button-primary" @click="handleAudit(record,0)">不通过</a-button>
  80. </div>
  81. <span v-else>--</span>
  82. </template>
  83. </s-table>
  84. </a-spin>
  85. </a-card>
  86. </template>
  87. <script>
  88. import { STable, VSelect } from '@/components'
  89. import storeList from '@/views/common/storeList.vue'
  90. import { xprhStoreApplyQueryPage, xprhStoreApplyAudit } from '@/api/approveStore'
  91. export default {
  92. components: { STable, VSelect, storeList },
  93. data () {
  94. return {
  95. spinning: false,
  96. tableHeight: 0,
  97. disabled: false, // 查询、重置按钮是否可操作
  98. queryParam: {
  99. contactName: '',
  100. contactPhone: '',
  101. storeName: '',
  102. auditStatus: undefined,
  103. delearSn: undefined
  104. },
  105. columns: [
  106. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  107. { title: '提交时间', dataIndex: 'applyTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  108. { title: '联系人手机', dataIndex: 'contactPhone', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  109. { title: '联系人姓名', dataIndex: 'contactName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  110. { title: '门店名称', dataIndex: 'storeName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  111. { title: '门店地址', dataIndex: 'addrDetail', width: '14%', align: 'center', scopedSlots: { customRender: 'addr' } },
  112. { title: '汽配商邀请码', dataIndex: 'inviteCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  113. { title: '邀请码关联汽配商', dataIndex: 'dealerName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  114. { title: '门头照片', dataIndex: 'storeImage', width: '6%', align: 'center', scopedSlots: { customRender: 'imageUrl' } },
  115. { title: '营业执照', dataIndex: 'licenseImage', width: '6%', align: 'center', scopedSlots: { customRender: 'imageUrl' } },
  116. { title: '状态', dataIndex: 'auditStatusDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  117. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  118. ],
  119. // 加载数据方法 必须为 Promise 对象
  120. loadData: parameter => {
  121. this.disabled = true
  122. this.spinning = true
  123. return xprhStoreApplyQueryPage(Object.assign(parameter, this.queryParam)).then(res => {
  124. let data
  125. if (res.status == 200) {
  126. data = res.data
  127. const no = (data.pageNo - 1) * data.pageSize
  128. for (var i = 0; i < data.list.length; i++) {
  129. data.list[i].no = no + i + 1
  130. }
  131. this.disabled = false
  132. }
  133. this.spinning = false
  134. return data
  135. })
  136. },
  137. openModal: false,
  138. nowData: null
  139. }
  140. },
  141. methods: {
  142. custChange (val) {
  143. console.log(val)
  144. this.queryParam.delearSn = val.key
  145. },
  146. inited (viewer) {
  147. if (viewer && viewer.length) {
  148. this.$info({
  149. title: '图片预览',
  150. okText: '关闭',
  151. width: '600px',
  152. content: (h) => { return h('img', { attrs: { src: viewer }, style: { width: '100%' } }) }
  153. })
  154. }
  155. },
  156. // 审核
  157. handleAudit (row, type) {
  158. // 审核通过
  159. if (type == 1) {
  160. this.$router.push({ name: 'approveStoreAuthPass', params: { sn: row.applySn } })
  161. } else {
  162. const _this = this
  163. this.$confirm({
  164. title: '提示',
  165. content: '确认审核不通过吗?',
  166. centered: true,
  167. closable: true,
  168. onOk () {
  169. _this.spinning = true
  170. xprhStoreApplyAudit({
  171. applySn: row.applySn,
  172. auditStatus: 'REFUSE'
  173. }).then(res => {
  174. if (res.status == 200) {
  175. _this.$message.success(res.message)
  176. _this.$refs.table.refresh()
  177. _this.spinning = false
  178. } else {
  179. _this.spinning = false
  180. }
  181. })
  182. }
  183. })
  184. }
  185. },
  186. // 重置
  187. resetSearchForm () {
  188. this.queryParam.contactName = ''
  189. this.queryParam.contactPhone = ''
  190. this.queryParam.storeName = ''
  191. this.queryParam.auditStatus = undefined
  192. this.queryParam.delearSn = undefined
  193. this.$refs.storeList.resetForm()
  194. this.$refs.table.refresh(true)
  195. },
  196. setTableH () {
  197. const tableSearchH = this.$refs.tableSearch.offsetHeight
  198. this.tableHeight = window.innerHeight - tableSearchH - 245
  199. },
  200. pageInit () {
  201. const _this = this
  202. this.$nextTick(() => { // 页面渲染完成后的回调
  203. _this.setTableH()
  204. _this.resetSearchForm()
  205. })
  206. }
  207. },
  208. mounted () {
  209. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  210. this.pageInit()
  211. }
  212. },
  213. watch: {
  214. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  215. this.setTableH()
  216. }
  217. },
  218. activated () {
  219. // 如果是新页签打开,则重置当前页面
  220. if (this.$store.state.app.isNewTab) {
  221. this.pageInit()
  222. }
  223. // 仅刷新列表,不重置页面
  224. if (this.$store.state.app.updateList) {
  225. this.setTableH()
  226. this.$refs.table.refresh()
  227. }
  228. }
  229. }
  230. </script>