From 4e07c0c78024e59e2dd5badf6c26bc45873978a6 Mon Sep 17 00:00:00 2001 From: zx <604444282@qq.com> Date: Wed, 22 Jun 2022 17:46:04 +0800 Subject: [PATCH] zx --- .env.development | 2 +- .env.production | 2 +- src/api/Item/index.js | 37 +++ src/api/public/index.js | 56 +++- src/api/shopChoose/index.js | 10 + src/components/upload/index.vue | 2 +- src/mixins/index.js | 4 +- src/request/index.js | 2 +- src/store/actions.js | 3 + src/store/getters.js | 5 +- src/store/mutations.js | 5 + src/store/state.js | 1 + src/utils/util.js | 10 +- src/views/Basic/Employee/depend/config.js | 2 +- src/views/Basic/Employee/index.vue | 2 +- .../_buildingManage/depend/config.js | 2 +- .../EstateInfo/_buildingManage/index.vue | 2 +- .../EstateInfo/_houseHoldInfo/depend/form.js | 2 +- .../Basic/EstateInfo/_houseHoldInfo/index.vue | 2 +- .../EstateInfo/_houseManage/depend/form.js | 2 +- .../Basic/EstateInfo/_houseManage/index.vue | 2 +- src/views/Basic/WorkOrder/finishDrawer.vue | 2 +- src/views/Basic/WorkOrder/form.js | 2 +- src/views/IntShop/Item/_addItem/index.vue | 92 +++--- .../IntShop/Item/_itemList/depend/config.js | 43 ++- src/views/IntShop/Item/_itemList/index.vue | 107 +++---- .../IntShop/Setting/_certification/index.vue | 266 ++++++++++++++---- src/views/IntShop/Setting/_shopInfo/index.vue | 53 ++-- src/views/IntShop/WorkBench/index.vue | 18 +- .../Operation/Announcement/depend/form.vue | 2 +- .../Facility/_facilityInfo/index.vue | 2 +- src/views/Operation/Vote/depend/editForm.vue | 2 +- src/views/Operation/Vote/depend/form.vue | 2 +- src/views/ShopChoose/index.vue | 99 +++++-- 34 files changed, 604 insertions(+), 241 deletions(-) create mode 100644 src/api/Item/index.js create mode 100644 src/api/shopChoose/index.js diff --git a/.env.development b/.env.development index 4cb1cdc..1e3c5a3 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,3 @@ NODE_ENV = 'development' VUE_APP_URL = 'https://saas.kaidalai.cn/api/merchant' -VUE_APP_STATIC = 'https://saas.kaidalai.cn/resource/admin' \ No newline at end of file +VUE_APP_STATIC = 'https://saas.kaidalai.cn/resource/merchant/' \ No newline at end of file diff --git a/.env.production b/.env.production index 0863502..74783ad 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,3 @@ NODE_ENV = 'production' VUE_APP_URL = 'https://saas.kaidalai.cn/api/merchant' -VUE_APP_STATIC = 'https://saas.kaidalai.cn/resource' \ No newline at end of file +VUE_APP_STATIC = 'https://saas.kaidalai.cn/resource/merchant/' \ No newline at end of file diff --git a/src/api/Item/index.js b/src/api/Item/index.js new file mode 100644 index 0000000..917803c --- /dev/null +++ b/src/api/Item/index.js @@ -0,0 +1,37 @@ +import httpService from "@/request" + +// 账号-查询所有商品 +export function getGoodsList(params) { + return httpService({ + url: `/user/goods/list`, + method: 'get', + params: params, + }) +} + +// 账号-添加商品 +export function addGood(params) { + return httpService({ + url: `/user/goods/insert`, + method: 'post', + data: params, + }) +} + +// 批量删除物品 +export function delGoods(params) { + return httpService({ + url: `/user/goods/delete`, + method: 'post', + data: params, + }) +} + +// 上下架 +export function isShelf(params) { + return httpService({ + url: `/user/goods/isShelf`, + method: 'get', + params: params, + }) +} \ No newline at end of file diff --git a/src/api/public/index.js b/src/api/public/index.js index dbbff2b..13e9a16 100644 --- a/src/api/public/index.js +++ b/src/api/public/index.js @@ -25,4 +25,58 @@ export function getCityList(params) { method: 'get', params: params, }) -} \ No newline at end of file +} + +// 添加店铺 +export function addShop(params) { + return httpService({ + url: `/user/authentication/subjectAuthenticationPre`, + method: 'post', + data: params, + }) +} + +// 根据店铺主键id查询店铺信息 +export function getShopDetail(params) { + return httpService({ + url: `/user/shop/detail`, + method: 'get', + params: params, + }) +} + +// 根据店铺主键id查询主体信息 +export function getCertiDetail(params) { + return httpService({ + url: `/user/authentication/authenticationFBI`, + method: 'get', + params: params, + }) +} + +// 修改主体认证 +export function updateCertification(params) { + return httpService({ + url: `/user/authentication/updateSubjectAuthentication`, + method: 'post', + data: params, + }) +} + +// 查询所有的商品分类(级联) +export function getItemCategory(params) { + return httpService({ + url: `/user/goods/findAllGoodsCategory`, + method: 'get', + params: params, + }) +} + +// 店铺认证(已废弃) +// export function subjectAuthentication(params) { +// return httpService({ +// url: `/user/authentication/subjectAuthentication`, +// method: 'post', +// data: params, +// }) +// } \ No newline at end of file diff --git a/src/api/shopChoose/index.js b/src/api/shopChoose/index.js new file mode 100644 index 0000000..4c37c25 --- /dev/null +++ b/src/api/shopChoose/index.js @@ -0,0 +1,10 @@ +import httpService from "@/request" + +// 账号-查询所有店铺 +export function getAllShop(params) { + return httpService({ + url: `/user/shop/list`, + method: 'get', + params: params, + }) +} diff --git a/src/components/upload/index.vue b/src/components/upload/index.vue index 4818f41..92c606d 100644 --- a/src/components/upload/index.vue +++ b/src/components/upload/index.vue @@ -50,7 +50,7 @@ export default { previewVisible: false, previewImage: "", uploadHeaders: { - "manage-login-token": store.getters.getToken, + "merchant-login-token": store.getters.getToken, }, }; }, diff --git a/src/mixins/index.js b/src/mixins/index.js index fa5b6c3..c632c18 100644 --- a/src/mixins/index.js +++ b/src/mixins/index.js @@ -12,10 +12,10 @@ export default { install(Vue) { Vue.mixin({ computed: { - ...mapGetters(['getToken','getCommunityCode','getSelectedKeys', 'getOpenKeys','getCity','getUserInfo']) + ...mapGetters(['getToken','getCommunityCode','getSelectedKeys', 'getOpenKeys','getCity','getUserInfo','getShopInfo']) }, methods: { - ...mapActions(['setToken','setCommunityCode','setSelectedKeys', 'setOpenKeys','setCity','setUserInfo']) + ...mapActions(['setToken','setCommunityCode','setSelectedKeys', 'setOpenKeys','setCity','setUserInfo','setShopInfo']) } }) } diff --git a/src/request/index.js b/src/request/index.js index c3681ba..75a9f8d 100644 --- a/src/request/index.js +++ b/src/request/index.js @@ -26,7 +26,7 @@ function filterRequestData(obj) { //创建axios的实例 const httpService = axios.create({ baseURL: process.env.VUE_APP_URL ,// TODO:具体的配置可以根据项目情况而来 - timeout: 5000 + timeout: 10000 }) //axios的拦截--request diff --git a/src/store/actions.js b/src/store/actions.js index c6e2697..f3e1524 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -25,6 +25,9 @@ const actions = { setUserInfo: ({commit}, log) => { commit('setUserInfo', log) }, + setShopInfo: ({commit}, log) => { + commit('setShopInfo', log) + }, } export default actions \ No newline at end of file diff --git a/src/store/getters.js b/src/store/getters.js index 0d574ce..0e113a6 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -24,7 +24,10 @@ const getters = { }, getUserInfo(state) { return state.userInfo - } + }, + getShopInfo(state) { + return state.shopInfo + }, } export default getters \ No newline at end of file diff --git a/src/store/mutations.js b/src/store/mutations.js index 5d7afb4..1b057ef 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -32,6 +32,11 @@ const mutations = { state.userInfo = log let str = JSON.stringify(log); sessionStorage.setItem('userInfo', str); + }, + setShopInfo (state, log) { + state.shopInfo = log + let str = JSON.stringify(log); + sessionStorage.setItem('shopInfo', str); } } diff --git a/src/store/state.js b/src/store/state.js index 13b4db6..4076c7b 100644 --- a/src/store/state.js +++ b/src/store/state.js @@ -13,5 +13,6 @@ const state = { communityCode: sessionStorage.getItem('communityCode') || "", cityList:[], userInfo: JSON.parse(sessionStorage.getItem('userInfo')) || {}, + shopInfo: JSON.parse(sessionStorage.getItem('shopInfo')) || {}, } export default state \ No newline at end of file diff --git a/src/utils/util.js b/src/utils/util.js index cfe91b1..0c05a36 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -7,16 +7,10 @@ export default { Vue.prototype.$axios = axios Vue.prototype.qs = qs // 上传 - // Vue.prototype.$upload = process.env.VUE_APP_URL + store.getters.getCommunityCode + '/manage/user/upload/uploadImg' - // 上传员工/房屋/住户/单元/楼栋EXCEL - // Vue.prototype.$excelUpload = process.env.VUE_APP_URL + store.getters.getCommunityCode + '/manage/user/importExcel/importManageUserExcel' - // Vue.prototype.$houseUpload = process.env.VUE_APP_URL + store.getters.getCommunityCode + '/manage/user/importExcel/importEstateExcel' - // Vue.prototype.$residentUpload = process.env.VUE_APP_URL + store.getters.getCommunityCode + '/manage/user/importExcel/importResidentExcel' - // Vue.prototype.$unitUpload = process.env.VUE_APP_URL + store.getters.getCommunityCode + '/manage/user/importExcel/importUnitExcel' - // Vue.prototype.$buildingUpload = process.env.VUE_APP_URL + store.getters.getCommunityCode + '/manage/user/importExcel/importBuildingExcel' + Vue.prototype.$upload = process.env.VUE_APP_URL + '/user/upload/uploadImg' // 静态地址 Vue.prototype.$ImgUrl = (src) => { - return process.env.VUE_APP_STATIC + store.getters.getCommunityCode + '/' + src + return process.env.VUE_APP_STATIC + '/' + src } // 时间格式化 Vue.prototype.formatDate = (time, fmt) => { diff --git a/src/views/Basic/Employee/depend/config.js b/src/views/Basic/Employee/depend/config.js index bdc2146..c1d2e05 100644 --- a/src/views/Basic/Employee/depend/config.js +++ b/src/views/Basic/Employee/depend/config.js @@ -213,5 +213,5 @@ export const options = { }; import store from "@/store"; export const uploadHeaders = { - "manage-login-token": store.getters.getToken, + "merchant-login-token": store.getters.getToken, }; diff --git a/src/views/Basic/Employee/index.vue b/src/views/Basic/Employee/index.vue index 48a3f4b..3d058d0 100644 --- a/src/views/Basic/Employee/index.vue +++ b/src/views/Basic/Employee/index.vue @@ -284,7 +284,7 @@ export default { type: "add", // 文件上传 uploadHeaders: { - "manage-login-token": store.getters.getToken, + "merchant-login-token": store.getters.getToken, } }; }, diff --git a/src/views/Basic/EstateInfo/_buildingManage/depend/config.js b/src/views/Basic/EstateInfo/_buildingManage/depend/config.js index 29c5c0d..c4f0678 100644 --- a/src/views/Basic/EstateInfo/_buildingManage/depend/config.js +++ b/src/views/Basic/EstateInfo/_buildingManage/depend/config.js @@ -140,5 +140,5 @@ export const unitColumns = [ ] import store from "@/store"; export const uploadHeaders = { - "manage-login-token": store.getters.getToken, + "merchant-login-token": store.getters.getToken, } \ No newline at end of file diff --git a/src/views/Basic/EstateInfo/_buildingManage/index.vue b/src/views/Basic/EstateInfo/_buildingManage/index.vue index 0ee19be..0dc0616 100644 --- a/src/views/Basic/EstateInfo/_buildingManage/index.vue +++ b/src/views/Basic/EstateInfo/_buildingManage/index.vue @@ -88,7 +88,7 @@ export default { editId:undefined, // 上传 uploadHeaders: { - "manage-login-token": store.getters.getToken, + "merchant-login-token": store.getters.getToken, } }; }, diff --git a/src/views/Basic/EstateInfo/_houseHoldInfo/depend/form.js b/src/views/Basic/EstateInfo/_houseHoldInfo/depend/form.js index 14d99eb..c6b6476 100644 --- a/src/views/Basic/EstateInfo/_houseHoldInfo/depend/form.js +++ b/src/views/Basic/EstateInfo/_houseHoldInfo/depend/form.js @@ -95,5 +95,5 @@ export const options = { // 请求头 import store from "@/store"; export const uploadHeaders = { - "manage-login-token": store.getters.getToken, + "merchant-login-token": store.getters.getToken, } \ No newline at end of file diff --git a/src/views/Basic/EstateInfo/_houseHoldInfo/index.vue b/src/views/Basic/EstateInfo/_houseHoldInfo/index.vue index 5b5fa6b..bb32ab2 100644 --- a/src/views/Basic/EstateInfo/_houseHoldInfo/index.vue +++ b/src/views/Basic/EstateInfo/_houseHoldInfo/index.vue @@ -309,7 +309,7 @@ export default { }, // 上传 uploadHeaders: { - "manage-login-token": store.getters.getToken, + "merchant-login-token": store.getters.getToken, } }; }, diff --git a/src/views/Basic/EstateInfo/_houseManage/depend/form.js b/src/views/Basic/EstateInfo/_houseManage/depend/form.js index fe04a53..2e0e5aa 100644 --- a/src/views/Basic/EstateInfo/_houseManage/depend/form.js +++ b/src/views/Basic/EstateInfo/_houseManage/depend/form.js @@ -65,5 +65,5 @@ export const rules = { // 请求头 import store from "@/store"; export const uploadHeaders = { - "manage-login-token": store.getters.getToken, + "merchant-login-token": store.getters.getToken, } \ No newline at end of file diff --git a/src/views/Basic/EstateInfo/_houseManage/index.vue b/src/views/Basic/EstateInfo/_houseManage/index.vue index 9bde90a..994ac22 100644 --- a/src/views/Basic/EstateInfo/_houseManage/index.vue +++ b/src/views/Basic/EstateInfo/_houseManage/index.vue @@ -234,7 +234,7 @@ export default { }, // 上传 uploadHeaders: { - "manage-login-token": store.getters.getToken, + "merchant-login-token": store.getters.getToken, }, fileList: [] }; diff --git a/src/views/Basic/WorkOrder/finishDrawer.vue b/src/views/Basic/WorkOrder/finishDrawer.vue index f2beb4b..e7094e7 100644 --- a/src/views/Basic/WorkOrder/finishDrawer.vue +++ b/src/views/Basic/WorkOrder/finishDrawer.vue @@ -80,7 +80,7 @@ import store from "@/store"; import {finish} from "@/api/basic/Workorder"; const uploadHeaders = { - "manage-login-token": store.getters.getToken, + "merchant-login-token": store.getters.getToken, } function getBase64(file) { return new Promise((resolve, reject) => { diff --git a/src/views/Basic/WorkOrder/form.js b/src/views/Basic/WorkOrder/form.js index d6c8f07..26ef1c1 100644 --- a/src/views/Basic/WorkOrder/form.js +++ b/src/views/Basic/WorkOrder/form.js @@ -94,5 +94,5 @@ export const options = { // 请求头 import store from "@/store"; export const uploadHeaders = { - "manage-login-token": store.getters.getToken, + "merchant-login-token": store.getters.getToken, } \ No newline at end of file diff --git a/src/views/IntShop/Item/_addItem/index.vue b/src/views/IntShop/Item/_addItem/index.vue index 00636cb..22231d2 100644 --- a/src/views/IntShop/Item/_addItem/index.vue +++ b/src/views/IntShop/Item/_addItem/index.vue @@ -14,40 +14,35 @@ > - + - -
准确选择商品类目有助于完善商品信息
+ +

价格信息

- - - - + ¥ - - - - + ¥ 付款减库存 - +

物流信息

- - 快递发货 - 到店自提 + + + 到店自提 @@ -56,7 +51,7 @@ > - + @@ -71,7 +66,7 @@ /> import { Editor, Toolbar } from '@wangeditor/editor-for-vue' -import { getCityList } from "@/api/public" +import { getCityList, getItemCategory } from "@/api/public" +import { addGood } from "@/api/Item" import { columns1,tableData1,tableData2,tableData3 } from "./depend/config" export default { name: 'certification', @@ -103,21 +99,22 @@ export default { tableData1: tableData1, tableData2: tableData2, tableData3: tableData3, - zOption: [{label:'食品流通许可证',value:1},{label:'食品经营许可证',value:2}, - {label:'食品生产许可证',value:3},{label:'食品小作坊登记证',value:4}, - {label:'国境口岸卫生许可证',value:5},{label:'预包装食品备案凭证',value:6},], fileList: [], cityList: [], + typeData: [], form: { - type: 1, - isLongtime: 0, - isIdCardLongtime: 0, - sellTimeStart: 1, - shipWay: 1, - shipFeeType: 1, - unsell: 1, - zList: [], - content: '

请输入内容

' + shopId: undefined, + goodsImgUrls: [], + name: '', + categoryId: undefined, + sellPrice: 0.0, + discountPrice: 0.0, + stockType: 1, + stock: 0, + distributionType: 1, + selfLiftingCity: undefined, + selfLiftingAddress: '', + details: '

请输入内容

' }, //富文本框 editor: null, @@ -126,6 +123,7 @@ export default { } }, created() { + this.form.shopId = this.getShopInfo.id; this.getApi(); }, beforeDestroy() { @@ -138,24 +136,36 @@ export default { getCityList().then(res => { let data = res.data; this.cityList = data; - }) + }); + getItemCategory().then(res => { + this.typeData = res.data; + }) }, onCreated(editor) { this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错 }, submit() { - this.$message.success('上传成功') - this.$router.push({name:'ItemList'}); + addGood(this.form).then(res => { + if(res.code == 200) { + this.$message.success(res.msg) + this.$router.push({name:'ItemList'}); + } else { + this.$message.error(res.msg) + } + }) }, handleChange(data) { - // this.fileList = data; - // this.form.imgList = []; - // data.forEach(ele => { - // if(ele.status == 'done') { - // this.form.imgList.push(ele.response.data) - // } - // }) - } + this.fileList = data; + this.form.goodsImgUrls = []; + data.forEach(ele => { + if(ele.status == 'done') { + this.form.goodsImgUrls.push(ele.response.data) + } + }) + }, + typeChange(value) { + this.form.categoryId = value[2]; + }, } } diff --git a/src/views/IntShop/Item/_itemList/depend/config.js b/src/views/IntShop/Item/_itemList/depend/config.js index a3470de..aaf9c97 100644 --- a/src/views/IntShop/Item/_itemList/depend/config.js +++ b/src/views/IntShop/Item/_itemList/depend/config.js @@ -5,9 +5,9 @@ export const columns = [ dataIndex: "status", customRender: function (status) { switch (status) { - case false: + case 2: return '已下架' - case true: + case 1: return '上架中' default: break; @@ -17,56 +17,47 @@ export const columns = [ { title: "商品编号", width: "11%", - dataIndex: "skuNumber", + dataIndex: "code", }, { title: "商品图片", width: "8%", - dataIndex: "mainPhoto", + dataIndex: "imgList", scopedSlots: { customRender: "mainPhoto"} }, { title: "商品名称", - width: "11%", - dataIndex: "skuName", + width: "9%", + dataIndex: "name", }, { title: "所属分类", - width: "6%", - dataIndex: "mallType", - customRender: function (mallType) { - switch (mallType) { - case 1: - return 'Jcook' - default: - return '' - } - } + width: "14%", + dataIndex: "categoryNamePath", }, { - title: "店铺名称", - width: "10%", - dataIndex: "shopName", - }, - { - title: "售货价", + title: "售卖价(元)", width: "8%", - dataIndex: "price", + dataIndex: "sellPrice", }, { title: "库存", width: "8%", - dataIndex: "discountPrice", + dataIndex: "stock", }, { title: "销量", width: "7%", - dataIndex: "viewsNum", + dataIndex: "salesVolume", }, { title: "创建时间", width: "10%", - dataIndex: "creatTime", + dataIndex: "createDate", + customRender: function (createDate) { + let date = new Date(createDate).toLocaleString(); + return date + } }, { title: "操作", diff --git a/src/views/IntShop/Item/_itemList/index.vue b/src/views/IntShop/Item/_itemList/index.vue index 565dfcf..d91413f 100644 --- a/src/views/IntShop/Item/_itemList/index.vue +++ b/src/views/IntShop/Item/_itemList/index.vue @@ -3,7 +3,6 @@
商品列表
- - + 全部 上架中 - 已售罄 - 已下架 + 已下架
添加商品 @@ -49,7 +51,7 @@ :columns="columns" :data-source="tableData" :pagination="pagination" - :scroll="{ x: 2400 }" + :scroll="{ x: 2000 }" @change="handleTableChange" :loading="loading" :row-selection="{ @@ -62,30 +64,23 @@ } " > - - 上架 - 下架 + 上架 + 下架 修改商品信息 - +
- 批量上架 - 批量下架 + + 批量删除 批量操作 @@ -99,26 +94,29 @@