From 9279a7d6cb35c093b6e3d58a4d8fe0acf8efc3d0 Mon Sep 17 00:00:00 2001 From: ch Date: Mon, 4 Jul 2022 16:24:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=94=AF=E4=BB=98=E4=B8=AD=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/pay/merchant.js | 22 +++ src/store/modules/chat/chat.js | 4 +- src/store/modules/goods/comment.js | 8 +- src/store/modules/pay/merchant.js | 60 +++++++ src/views/pay/application/index.vue | 166 +++++++++++++++++++ src/views/pay/merchant/index.vue | 242 ++++++++++++++++++++++++++++ 6 files changed, 494 insertions(+), 8 deletions(-) create mode 100644 src/api/pay/merchant.js create mode 100644 src/store/modules/pay/merchant.js create mode 100644 src/views/pay/application/index.vue create mode 100644 src/views/pay/merchant/index.vue diff --git a/src/api/pay/merchant.js b/src/api/pay/merchant.js new file mode 100644 index 0000000..28c7262 --- /dev/null +++ b/src/api/pay/merchant.js @@ -0,0 +1,22 @@ +/* + * @Author: ch + * @Date: 2022-07-04 15:20:02 + * @LastEditors: ch + * @LastEditTime: 2022-07-04 15:50:39 + * @Description: file content + */ +import request from '@/utils/request.js'; +export const getMerchantList = (params) => { + return request({ + url: '/payCenter/mchInfo/page', + method: 'get', + params, + }); +}; +export const getMerchantPlatform = (params) => { + return request({ + url: '/payCenter/mchInfo/mchCode', + method: 'get', + params, + }); +}; diff --git a/src/store/modules/chat/chat.js b/src/store/modules/chat/chat.js index 8edd291..a8bdfa4 100644 --- a/src/store/modules/chat/chat.js +++ b/src/store/modules/chat/chat.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-06-07 15:41:05 * @LastEditors: ch - * @LastEditTime: 2022-06-14 15:26:44 + * @LastEditTime: 2022-07-04 11:34:14 * @Description: file content */ import * as api from '@/api/chat'; @@ -166,7 +166,7 @@ const actions = { /** * 提交转移会话 */ - submitTransferSession: ({}, data) => { + submitTransferSession: (context, data) => { return api .transferCustomerService({ storeId: 1, diff --git a/src/store/modules/goods/comment.js b/src/store/modules/goods/comment.js index 62c6461..54f8239 100644 --- a/src/store/modules/goods/comment.js +++ b/src/store/modules/goods/comment.js @@ -150,10 +150,6 @@ const actions = { data.commentTimeBegin = data.dateRange[0]; data.commentTimeEnd = data.dateRange[1]; } - if (data.scoreList) { - data.commentScoreList = data.scoreList.join(','); - delete data.scoreList; - } delete data.dateRange; delete data.pagingCode; const res = await api.commentList({ @@ -171,7 +167,7 @@ const actions = { commit('setTotal', res?.total || 0); } }, - async updateShow({}, params) { + async updateShow(context, params) { const res = await api.updateCommentShow(params); if (!res) { ElMessage.error('状态更新失败!'); @@ -188,7 +184,7 @@ const actions = { commit('setDetail', res); return Promise.resolve(res); }, - async add({}, data) { + async add(context, data) { const res = await api.commentAdd(data); if (!res) { ElMessage.error('回复失败'); diff --git a/src/store/modules/pay/merchant.js b/src/store/modules/pay/merchant.js new file mode 100644 index 0000000..9dfa924 --- /dev/null +++ b/src/store/modules/pay/merchant.js @@ -0,0 +1,60 @@ +/* + * @Author: ch + * @Date: 2022-07-04 15:21:30 + * @LastEditors: ch + * @LastEditTime: 2022-07-04 16:22:14 + * @Description: file content + */ +import * as api from '@/api/pay/merchant.js'; +const state = { + list: [], + detail: {}, + total: 0, + opts: { + status: [ + { + value: false, + label: '启用', + }, + { + value: true, + label: '禁用', + }, + ], + platform: [], + }, +}; +const getters = {}; +const mutations = { + setList: (state, data) => (state.list = data), + setPlatform: (state, data) => (state.opts.platform = data), + setTotal: (state, data) => (state.total = data), + setDetail: (state, data) => (state.detail = data), +}; +const actions = { + async search({ rootGetters, commit }, params) { + let data = { ...params }; + let pagingCode = params.pagingCode; + const res = await api.getMerchantList({ + ...rootGetters['local/page'](pagingCode), + ...data, + }); + if (res) { + commit('setList', res?.records || []); + commit('setTotal', res?.total || 0); + } + }, + async getMerchantPlatform({ commit }, params) { + const res = await api.getMerchantPlatform(); + if (res) { + commit('setPlatform', res || []); + } + }, +}; + +export default { + state, + getters, + mutations, + actions, +}; diff --git a/src/views/pay/application/index.vue b/src/views/pay/application/index.vue new file mode 100644 index 0000000..eda6813 --- /dev/null +++ b/src/views/pay/application/index.vue @@ -0,0 +1,166 @@ + + + + diff --git a/src/views/pay/merchant/index.vue b/src/views/pay/merchant/index.vue new file mode 100644 index 0000000..f3ada3b --- /dev/null +++ b/src/views/pay/merchant/index.vue @@ -0,0 +1,242 @@ + + + + From f58303e37f31e3083d248004840d8abb70873396 Mon Sep 17 00:00:00 2001 From: ch Date: Wed, 6 Jul 2022 11:25:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=E5=95=86=E6=88=B7=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/pay/merchant.js | 35 +++- src/store/modules/pay/merchant.js | 57 ++++++- src/views/pay/application/add.vue | 11 ++ src/views/pay/application/detail.vue | 11 ++ src/views/pay/application/index.vue | 28 +--- src/views/pay/merchant/form/ali.vue | 126 ++++++++++++++ src/views/pay/merchant/form/index.vue | 124 ++++++++++++++ src/views/pay/merchant/form/wx.vue | 182 ++++++++++++++++++++ src/views/pay/merchant/index.vue | 229 +++++++++----------------- vite.config.js | 2 +- 10 files changed, 628 insertions(+), 177 deletions(-) create mode 100644 src/views/pay/application/add.vue create mode 100644 src/views/pay/application/detail.vue create mode 100644 src/views/pay/merchant/form/ali.vue create mode 100644 src/views/pay/merchant/form/index.vue create mode 100644 src/views/pay/merchant/form/wx.vue diff --git a/src/api/pay/merchant.js b/src/api/pay/merchant.js index 28c7262..72b140e 100644 --- a/src/api/pay/merchant.js +++ b/src/api/pay/merchant.js @@ -2,10 +2,43 @@ * @Author: ch * @Date: 2022-07-04 15:20:02 * @LastEditors: ch - * @LastEditTime: 2022-07-04 15:50:39 + * @LastEditTime: 2022-07-06 10:09:07 * @Description: file content */ import request from '@/utils/request.js'; +export const create = (data) => { + return request({ + url: '/payCenter/mchInfo', + method: 'post', + data, + }); +}; +export const del = (mchPrimaryId) => { + return request({ + url: `/payCenter/mchInfo/${mchPrimaryId}`, + method: 'delete', + }); +}; +export const detail = (mchPrimaryId) => { + return request({ + url: `/payCenter/mchInfo/${mchPrimaryId}`, + method: 'get', + }); +}; +export const update = (data) => { + return request({ + url: '/payCenter/mchInfo', + method: 'put', + data, + }); +}; +export const updateStatus = (params) => { + return request({ + url: `/payCenter/mchInfo/updateStatus`, + method: 'put', + params, + }); +}; export const getMerchantList = (params) => { return request({ url: '/payCenter/mchInfo/page', diff --git a/src/store/modules/pay/merchant.js b/src/store/modules/pay/merchant.js index 9dfa924..6449959 100644 --- a/src/store/modules/pay/merchant.js +++ b/src/store/modules/pay/merchant.js @@ -2,11 +2,13 @@ * @Author: ch * @Date: 2022-07-04 15:21:30 * @LastEditors: ch - * @LastEditTime: 2022-07-04 16:22:14 + * @LastEditTime: 2022-07-06 11:16:50 * @Description: file content */ import * as api from '@/api/pay/merchant.js'; +import { ElMessage, ElMessageBox } from '@/plugins/element-plus'; const state = { + code: 'PayMerchantManagement', list: [], detail: {}, total: 0, @@ -33,18 +35,59 @@ const mutations = { }; const actions = { async search({ rootGetters, commit }, params) { - let data = { ...params }; - let pagingCode = params.pagingCode; const res = await api.getMerchantList({ - ...rootGetters['local/page'](pagingCode), - ...data, + ...rootGetters['local/page'](state.code), + ...params, }); if (res) { - commit('setList', res?.records || []); + commit('setList', res?.records.map((i) => ({ ...i, isShow: !i.isDisabled })) || []); commit('setTotal', res?.total || 0); } }, - async getMerchantPlatform({ commit }, params) { + async save({ dispatch }, data) { + let save = data.mchPrimaryId ? api.update : api.create; + let res = await save(data); + if (res) { + ElMessage.success('保存成功'); + dispatch('search'); + } else { + ElMessage.error('保存失败'); + } + return res; + }, + detail: async (context, id) => { + let res = await api.detail(id); + if (!res) { + ElMessage.error('加载详情失败'); + } + return res; + }, + del: async ({ dispatch }, id) => { + try { + await ElMessageBox.confirm('数据删除后无法恢复,确定要删除吗?', '危险操作'); + let res = await api.del(id); + if (res) { + ElMessage.success('删除成功'); + dispatch('search'); + } else { + ElMessage.error('删除失败'); + } + return res; + } catch (e) { + console.info('取消删除', e); + } + }, + async updateStatus({ dispatch }, data) { + let res = await api.updateStatus(data); + if (res) { + ElMessage.success('保存成功'); + dispatch('search'); + } else { + ElMessage.error('保存失败'); + } + return res; + }, + async getMerchantPlatform({ commit }) { const res = await api.getMerchantPlatform(); if (res) { commit('setPlatform', res || []); diff --git a/src/views/pay/application/add.vue b/src/views/pay/application/add.vue new file mode 100644 index 0000000..0563eff --- /dev/null +++ b/src/views/pay/application/add.vue @@ -0,0 +1,11 @@ + + + diff --git a/src/views/pay/application/detail.vue b/src/views/pay/application/detail.vue new file mode 100644 index 0000000..d39e58f --- /dev/null +++ b/src/views/pay/application/detail.vue @@ -0,0 +1,11 @@ + + + diff --git a/src/views/pay/application/index.vue b/src/views/pay/application/index.vue index eda6813..c66affc 100644 --- a/src/views/pay/application/index.vue +++ b/src/views/pay/application/index.vue @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-06-15 17:29:32 * @LastEditors: ch - * @LastEditTime: 2022-07-04 16:12:49 + * @LastEditTime: 2022-07-04 16:56:20 * @Description: file content --> diff --git a/src/views/pay/merchant/form/index.vue b/src/views/pay/merchant/form/index.vue new file mode 100644 index 0000000..65e0eb5 --- /dev/null +++ b/src/views/pay/merchant/form/index.vue @@ -0,0 +1,124 @@ + + + + diff --git a/src/views/pay/merchant/form/wx.vue b/src/views/pay/merchant/form/wx.vue new file mode 100644 index 0000000..4211768 --- /dev/null +++ b/src/views/pay/merchant/form/wx.vue @@ -0,0 +1,182 @@ + + + diff --git a/src/views/pay/merchant/index.vue b/src/views/pay/merchant/index.vue index f3ada3b..70dab01 100644 --- a/src/views/pay/merchant/index.vue +++ b/src/views/pay/merchant/index.vue @@ -2,60 +2,53 @@ * @Author: ch * @Date: 2022-06-15 17:29:32 * @LastEditors: ch - * @LastEditTime: 2022-07-04 11:38:11 + * @LastEditTime: 2022-07-06 11:19:31 * @Description: file content -->