index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents" :operationColumnWidth="200"
  3. :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
  4. :operation="operation" :exportList="exportList">
  5. <div slot="moreSearch">
  6. <el-radio-group v-model="examineStatus" size="mini" @change="changeType">
  7. <el-radio-button label="">全部</el-radio-button>
  8. <el-radio-button label="WAIT">待审核</el-radio-button>
  9. <el-radio-button label="OK">审核通过</el-radio-button>
  10. <el-radio-button label="FAIL">驳回</el-radio-button>
  11. </el-radio-group>
  12. <br><br>
  13. </div>
  14. <el-dialog title="" width="800px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
  15. :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
  16. <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
  17. <zj-form-module :title="formDialogTitles[formDialogType]" label-width="100px" :showPackUp="false"
  18. :form-data="formData" :form-items="formItems">
  19. </zj-form-module>
  20. </zj-form-container>
  21. <div slot="footer" class="dialog-footer">
  22. <el-button v-if="formData.examineStatus == 'WAIT'" size="mini" type="primary" @click="audit('OK')">审核通过</el-button>
  23. <el-button v-if="formData.examineStatus == 'WAIT'" size="mini" type="danger" @click="audit('FAIL')">审核驳回</el-button>
  24. <el-button size="mini" @click="formCancel">取 消</el-button>
  25. </div>
  26. </el-dialog>
  27. <!-- 入驻网点 -->
  28. <el-dialog title="设为工程师" :visible.sync="dialogVisible" @close="websitList = []" width="50%" :close-on-click-modal="false" :modal-append-to-body="false">
  29. <el-form ref="workerForm" :model="workerForm" label-width="110px" size="small" label-position="left">
  30. <el-row :gutter="20">
  31. <el-col :span="24">
  32. <el-form-item label="入驻网点" :required="true">
  33. <el-select v-model="workerForm.websitId" placeholder="请选择" style="width: 100%;">
  34. <el-option
  35. v-for="item in websitList"
  36. :key="item.websitId"
  37. :label="item.name"
  38. :value="item.websitId">
  39. </el-option>
  40. </el-select>
  41. </el-form-item>
  42. </el-col>
  43. </el-row>
  44. </el-form>
  45. <div slot="footer" class="dialog-footer">
  46. <el-button @click="dialogVisible = false">取 消</el-button>
  47. <el-button type="primary" @click="memberInner()">确定</el-button>
  48. </div>
  49. </el-dialog>
  50. </template-page>
  51. </template>
  52. <script>
  53. import TemplatePage from '@/components/template/template-page-1.vue'
  54. import import_mixin from '@/components/template/import_mixin.js'
  55. import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
  56. import { memberListService2,memberPageExport, getMemberDetail, memberAudit, memberInner, getWebsit } from "@/api/distributorManagement";
  57. export default {
  58. components: { TemplatePage },
  59. mixins: [import_mixin],
  60. data() {
  61. return {
  62. // 事件组合
  63. optionsEvensGroup: [],
  64. // 表格属性
  65. tableAttributes: {
  66. // 启用勾选列
  67. selectColumn: false,
  68. },
  69. // 表格事件
  70. tableEvents: {
  71. 'selection-change': this.selectionChange
  72. },
  73. // 勾选选中行
  74. recordSelected: [],
  75. /** 表单变量 */
  76. formDialogType: 0,
  77. formDialogTitles: ["审核", "详情"],
  78. formDialog: false,
  79. dialogVisible: false,
  80. formData: {
  81. type: '工程师',
  82. examineRemark: ''
  83. },
  84. examineStatus: '',
  85. websitList: [],
  86. workerForm: {
  87. websitId: '',
  88. userId: '',
  89. }
  90. }
  91. },
  92. computed: {
  93. // 更多参数
  94. moreParameters() {
  95. return []
  96. },
  97. formItems() {
  98. return [{
  99. md: 12,
  100. isShow: true,
  101. name: 'el-select',
  102. options: [{label: '待审核', value: 'WAIT'},{label: '驳回', value: 'FAIL'},{label: '通过', value: 'OK'}],
  103. attributes: { placeholder: '请输入', disabled: true },
  104. formItemAttributes: {
  105. label: '审核状态',
  106. prop: 'examineStatus',
  107. rules: []
  108. },
  109. }, {
  110. md: 12,
  111. isShow: true,
  112. name: 'el-select',
  113. options: [{label: '业务员', value: 'SERVICE'},{label: '师傅', value: 'WORKER'},{label: '普通用户', value: 'GENERAL'}],
  114. attributes: { disabled: true },
  115. formItemAttributes: {
  116. label: '用户类型',
  117. prop: 'type',
  118. rules: []
  119. }
  120. }, {
  121. md: 12,
  122. isShow: true,
  123. name: 'el-input',
  124. attributes: { placeholder: '请输入', disabled: true },
  125. formItemAttributes: {
  126. label: '用户名称',
  127. prop: 'nickName',
  128. rules: []
  129. }
  130. }, {
  131. md: 12,
  132. isShow: true,
  133. name: 'el-input',
  134. attributes: { placeholder: '请输入', disabled: true },
  135. formItemAttributes: {
  136. label: '联系电话',
  137. prop: 'mobile',
  138. rules: []
  139. }
  140. }, {
  141. md: 12,
  142. isShow: true,
  143. name: 'el-input',
  144. attributes: { placeholder: '请输入', disabled: true },
  145. formItemAttributes: {
  146. label: '身份证号码',
  147. prop: 'idCard',
  148. rules: []
  149. }
  150. }, {
  151. md: 12,
  152. isShow: true,
  153. name: 'el-image',
  154. attributes: { src: this.formData.idCardImg },
  155. formItemAttributes: {
  156. label: '身份证',
  157. prop: 'idCardImg',
  158. rules: []
  159. },
  160. }, {
  161. md: 12,
  162. isShow: true,
  163. name: 'el-input',
  164. attributes: { placeholder: '请输入', disabled: true },
  165. formItemAttributes: {
  166. label: '所属商户',
  167. prop: 'companyName',
  168. rules: []
  169. }
  170. }, {
  171. md: 24,
  172. isShow: true,
  173. name: 'el-input',
  174. attributes: { placeholder: '请输入',type: "textarea", disabled: this.formData.examineStatus == 'WAIT' ? false:true },
  175. formItemAttributes: {
  176. label: '备注',
  177. prop: 'examineRemark',
  178. rules: []
  179. }
  180. }]
  181. }
  182. },
  183. methods: {
  184. // 切换状态
  185. changeType(val) {
  186. this.$refs.pageRef.refreshList()
  187. },
  188. // 列表请求函数
  189. getList(p) {
  190. try {
  191. var pam = JSON.parse(JSON.stringify(p))
  192. if (this.examineStatus) {
  193. pam.params.push({ "param": "a.examine_status", "compare": "=", "value": this.examineStatus })
  194. }
  195. return memberListService2(pam)
  196. } catch (error) {
  197. console.log(error)
  198. }
  199. },
  200. // 列表导出函数
  201. exportList: memberPageExport,
  202. // 表格列解析渲染数据更改
  203. columnParsing(item, defaultData) {
  204. return defaultData
  205. },
  206. // 监听勾选变化
  207. selectionChange(data) {
  208. this.recordSelected = data
  209. },
  210. // 表格操作列
  211. operation(h, { row, index, column }) {
  212. return (
  213. <div class='operation-btns'>
  214. {row.examineStatus == 'WAIT' ? <el-button type="text" onClick={() => {
  215. getMemberDetail({ userId: row.userId }).then(res => {
  216. Object.assign(this.formData, res.data)
  217. this.formDialogType = 0
  218. this.openForm()
  219. })
  220. }}>审核</el-button> : null}
  221. <el-button type="text" onClick={() => {
  222. getMemberDetail({ userId: row.userId }).then(res => {
  223. Object.assign(this.formData, res.data)
  224. this.formDialogType = 1
  225. this.openForm()
  226. })
  227. }}>详情</el-button>
  228. {row.examineStatus != 'WAIT' ?<el-button type="text" onClick={() => {
  229. this.workerForm.userId = row.userId
  230. getWebsit().then(res => {
  231. this.websitList = res.data
  232. this.dialogVisible = true
  233. })
  234. }}>设为工程师</el-button>:null}
  235. {row.examineStatus != 'WAIT' ?<el-button type="text" onClick={() => {
  236. this.$confirm('请确认是否设为客户, 是否继续?', '提示', {
  237. confirmButtonText: '确定',
  238. cancelButtonText: '取消',
  239. type: 'warning'
  240. }).then(() => {
  241. memberInner({
  242. type: 'GENERAL',
  243. userIds: row.userId
  244. }).then(res => {
  245. if (res.code == 1) {
  246. this.$message({ type: 'success', message: '设为客户成功!' })
  247. this.$refs.pageRef.refreshList()
  248. } else {
  249. this.$message.error(res.msg);
  250. }
  251. })
  252. });
  253. }}>设为客户</el-button>:null}
  254. </div>
  255. )
  256. },
  257. addData() {
  258. this.formDialogType = 0
  259. this.openForm()
  260. },
  261. openForm() {
  262. this.formDialog = true;
  263. },
  264. formCancel() {
  265. this.$refs.formRef.$refs.inlineForm.clearValidate()
  266. this.$data.formData = this.$options.data().formData
  267. this.formDialog = false
  268. },
  269. audit(examineStatusEnum){
  270. memberAudit({
  271. examineStatusEnum,
  272. examineRemark: this.formData.examineRemark,
  273. id: this.formData.id
  274. }).then(res => {
  275. this.$message({ type: 'success', message: '审核成功!' })
  276. this.formCancel()
  277. this.$refs.pageRef.refreshList()
  278. })
  279. },
  280. memberInner(){
  281. if(!this.workerForm.websitId){
  282. return this.$message({ type: 'danger', message: '请选择入驻网点!' })
  283. }
  284. memberInner({
  285. type: 'WORKER',
  286. userIds: this.workerForm.userId,
  287. websitId: this.workerForm.websitId
  288. }).then(res => {
  289. this.dialogVisible = false
  290. this.$message({ type: 'success', message: '设置工程师成功!' })
  291. this.$refs.pageRef.refreshList()
  292. })
  293. },
  294. formConfirm() {
  295. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  296. if (valid) {
  297. ([memberAudit][this.formDialogType])(this.formData).then(res => {
  298. this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
  299. this.formCancel()
  300. this.$refs.pageRef.refreshList()
  301. })
  302. }
  303. })
  304. }
  305. }
  306. }
  307. </script>
  308. <style lang="scss" scoped></style>