diff --git a/src/api/request.js b/src/api/request.js index 6f16eed..c1ef3be 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -15,7 +15,7 @@ const instance = axios.create({ baseURL: SettingMer.https, timeout: 60000 }) -const defaultOpt = {login: true} +const defaultOpt = { login: true } function baseRequest(options) { const token = store.getters.token @@ -28,7 +28,7 @@ function baseRequest(options) { instance(options).then(res => { const data = res.data || {} if (res.status !== 200) { - return reject({message: '请求失败', res, data}) + return reject({ message: '请求失败', res, data }) } if ([410000, 410001, 410002, 40000].indexOf(data.status) !== -1) { @@ -38,9 +38,9 @@ function baseRequest(options) { } else if (data.status === 200) { return resolve(data, res) } else { - return reject({message: data.message, res, data}) + return reject({ message: data.message, res, data }) } - }).catch(message => reject({message})); + }).catch(message => reject({ message })); }) } /** @@ -58,7 +58,7 @@ const request = ['post', 'put', 'patch', 'delete'].reduce((request, method) => { */ request[method] = (url, data = {}, options = {}) => { return baseRequest( - Object.assign({url, data, method}, defaultOpt, options) + Object.assign({ url, data, method }, defaultOpt, options) ) } return request @@ -74,7 +74,7 @@ const request = ['post', 'put', 'patch', 'delete'].reduce((request, method) => { */ request[method] = (url, params = {}, options = {}) => { return baseRequest( - Object.assign({url, params, method}, defaultOpt, options) + Object.assign({ url, params, method }, defaultOpt, options) ) } }) diff --git a/src/api/request_area.js b/src/api/request_area.js new file mode 100644 index 0000000..3a0eae6 --- /dev/null +++ b/src/api/request_area.js @@ -0,0 +1,82 @@ +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team +// +---------------------------------------------------------------------- +import axios from 'axios' +import store from '@/store' +import SettingMer from '@/libs/settingMer' + +const instance = axios.create({ + baseURL: SettingMer.https.replace("sys", ""), + timeout: 60000 +}) +const defaultOpt = { login: true } + +function baseRequest(options) { + const token = store.getters.token + const headers = options.headers || {} + if (token) { + headers['X-Token'] = token + options.headers = headers + } + return new Promise((resolve, reject) => { + instance(options).then(res => { + const data = res.data || {} + if (res.status !== 200) { + return reject({ message: '请求失败', res, data }) + } + + if ([410000, 410001, 410002, 40000].indexOf(data.status) !== -1) { + store.dispatch('user/resetToken').then(() => { + location.reload() + }) + } else if (data.status === 200) { + return resolve(data, res) + } else { + return reject({ message: data.message, res, data }) + } + }).catch(message => reject({ message })); + }) +} +/** + * http 请求基础类 + * 参考文档 https://www.kancloud.cn/yunye/axios/234845 + * + */ +const request = ['post', 'put', 'patch', 'delete'].reduce((request, method) => { + /** + * + * @param url string 接口地址 + * @param data object get参数 + * @param options object axios 配置项 + * @returns {AxiosPromise} + */ + request[method] = (url, data = {}, options = {}) => { + return baseRequest( + Object.assign({ url, data, method }, defaultOpt, options) + ) + } + return request +}, {}); + +['get', 'head'].forEach(method => { + /** + * + * @param url string 接口地址 + * @param params object get参数 + * @param options object axios 配置项 + * @returns {AxiosPromise} + */ + request[method] = (url, params = {}, options = {}) => { + return baseRequest( + Object.assign({ url, params, method }, defaultOpt, options) + ) + } +}) + +export default request diff --git a/src/api/shoplist.js b/src/api/shoplist.js new file mode 100644 index 0000000..db7e0c2 --- /dev/null +++ b/src/api/shoplist.js @@ -0,0 +1,18 @@ +import request from './request_area' + +/* + 获取第一级商圈 +*/ +export const get_area = (data) => request.get('api/city/get_area', data) + +/* + 获取第二级商圈 +*/ +export const get_stree = (data) => request.get('api/city/get_street', data) +/* + 获取第三级级商圈 +*/ +export const get_village = (data) => request.get('api/city/get_village', data) + + +export const get_city = (data) => request.get('api/city/get_city', data) diff --git a/src/views/merchant/application/index.vue b/src/views/merchant/application/index.vue index 73e9e2c..99ff794 100644 --- a/src/views/merchant/application/index.vue +++ b/src/views/merchant/application/index.vue @@ -3,86 +3,39 @@
- - - - - + + + + + - + - - + + - - + + - + 搜索 - 重置 + 重置
- + @@ -93,13 +46,8 @@ @@ -112,42 +60,288 @@ - +
- +
+ + + + + + + + + + + + + + + + + 创建 + 不创建 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ + + +
+ +
+
+
+ + + + + + +
+
+
+ 提交 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ + + +
+ +
+
+
+ + + + + + +
+
+
+ 关闭 +
+
+ @@ -204,11 +398,14 @@ export default { mer_id: this.$route.query.id ? this.$route.query.id : "", autoUpdate: true, timeVal: [], + statusAuditForm: {}, + formShow: false, + statusAuditVisible: false }; }, watch: { mer_id(newName, oldName) { - this.getList(""); + this.getList(""); } }, mounted() { @@ -217,8 +414,26 @@ export default { this.getList(""); }, methods: { + // 如果审核状态为拒绝,就不能创建商户 + statusChange() { + if (this.statusAuditForm.state == 2) { + this.statusAuditForm.create_mer = 2; + } else { + this.statusAuditForm.create_mer = 1; + } + }, + + // 如果创建商户,则同意审核 + createMerChange() { + if (this.statusAuditForm.create_mer == 2) { + this.statusAuditForm.state = 2; + } else { + this.statusAuditForm.state = 1; + } + }, + /**重置 */ - searchReset(){ + searchReset() { this.timeVal = [] this.tableFrom.date = "" this.$refs.searchForm.resetFields() @@ -239,17 +454,17 @@ export default { // 商户分类; getMerCategory() { getMerCateApi().then(res => { - this.merCateList = res.data + this.merCateList = res.data }).catch(res => { - this.$message.error(res.message) + this.$message.error(res.message) }) }, /**获取店铺类型 */ - getStoreType(){ + getStoreType() { getstoreTypeApi().then(res => { - this.storeType = res.data + this.storeType = res.data }).catch(res => { - this.$message.error(res.message) + this.$message.error(res.message) }) }, // 列表 @@ -275,16 +490,37 @@ export default { this.tableFrom.limit = val; this.getList(1); }, + // 修改状态 - onchangeIsShow(id) { - this.$modalForm(intentionStatusApi(id)).then(() => this.getList("")); + onchangeIsShow(item) { + this.statusAuditVisible = true; + if (item.financial_bank) { + let bi = JSON.parse(item.financial_bank); + item.bank_username = bi.bank; + item.bank_code = bi.bank_code; + item.bank_opening = bi.bank_branch; + if (bi.bank_front[0]) { + this.$set(item, 'bank_img', bi.bank_front); + } + } + this.statusAuditForm = item; + this.$set(this.statusAuditForm, 'state', 1); + this.$set(this.statusAuditForm, 'create_mer', 1); }, + // 添加 // 编辑 onEdit(id) { this.$modalForm(auditApi(id)).then(() => this.getList("")); }, + + // 查看 + handleView(row) { + this.statusAuditForm = row; + this.formShow = true; + }, + // 删除 handleDelete(id) { this.$deleteSure().then(() => { @@ -302,9 +538,15 @@ export default { }; - diff --git a/src/views/merchant/list/handle/merDetails.vue b/src/views/merchant/list/handle/merDetails.vue index 74cabf3..2768326 100644 --- a/src/views/merchant/list/handle/merDetails.vue +++ b/src/views/merchant/list/handle/merDetails.vue @@ -1,12 +1,7 @@