Commit d4b88ad6 by wangql
2 parents eb27aea0 4f64e075
......@@ -17,6 +17,7 @@
"dayjs": "^1.8.12",
"default-passive-events": "^2.0.0",
"element-ui": "^2.11.1",
"file-saver": "^2.0.2",
"flex.css": "^1.1.7",
"fuse.js": "^3.4.4",
"hotkeys-js": "^3.6.2",
......@@ -33,7 +34,8 @@
"vue": "^2.6.10",
"vue-i18n": "^8.14.0",
"vue-router": "^3.0.3",
"vuex": "^3.0.1"
"vuex": "^3.0.1",
"xlsx": "^0.16.8"
},
"devDependencies": {
"@kazupon/vue-i18n-loader": "^0.4.1",
......@@ -50,6 +52,7 @@
"eslint-plugin-vue": "^5.0.0",
"sass": "^1.18.0",
"sass-loader": "^7.1.0",
"script-loader": "^0.7.2",
"svg-sprite-loader": "^4.1.3",
"vue-template-compiler": "^2.5.21",
"webpack-bundle-analyzer": "^3.4.1",
......
......@@ -42,3 +42,9 @@ export function baseGoodsUpdate(data) {
data.method = `${path}basegoods.update`
return request(data, 'post')
}
// 导出
export function exportBaseList(data) {
data.method = `${path}basegoods.export`
return request(data, 'post')
}
......@@ -28,7 +28,7 @@ export function getCarType(data) {
/**根据门店商户号获取基础商品列表 */
export function getGoods(data) {
data.method = `${path}basegoods.list.byServiceMerchantId`
data.method = `${path}basegoods.list`
return request(data)
}
......
......@@ -11,3 +11,14 @@ export function getType(data) {
data.method = `${path}goods.type.list`
return request(data)
}
// 添加产品
export function addGoods(data) {
data.method = `${path}goodsinfo.add`
return request(data, 'post')
}
// 编辑产品
export function editGoods(data) {
data.method = `${path}goodsinfo.update`
return request(data, 'post')
}
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @Last Modified by: chenwq
* @Last Modified time: 2020-11-05 17:39:39
* @Last Modified time: 2020-11-12 20:49:55
*/
import request from './request'
......@@ -32,8 +32,8 @@ export function AccountLogin(data) {
// loginName: 'foutouren',
// authes: []
// // authes: [{
// // authId: '101',
// // parentId: '0'
// // authId: '10101',
// // parentId: '101'
// // }, {
// // authId: '102',
// // parentId: '0'
......@@ -42,6 +42,12 @@ export function AccountLogin(data) {
// })
}
// 权限
export function getAuths(data) {
data.method = `${USER_PATH}userauth.getUserAuth`
return request(data)
}
/**
* 注册
* @param {*} data 参数
......
......@@ -2,11 +2,11 @@
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @Last Modified by: chenwq
* @Last Modified time: 2020-11-11 17:42:10
* @Last Modified time: 2020-11-12 14:56:05
*/
import request from './request'
// import RequestMethods from './request.methods'
import RequestMethods from './request.methods'
export const BASE_DATA_URL = 'fims.configuration.from.conftype'
......@@ -23,3 +23,9 @@ export function getChannelType(data) {
data.method = `${path}channel.type.list`
return request(data)
}
// 图片上传
export function uploadImg(data) {
data.method = `${path}common.uploadImg`
return request(data, RequestMethods.POST, ['file'])
}
/* eslint-disable */
/* Blob.js
* A Blob implementation.
* 2014-05-27
*
* By Eli Grey, http://eligrey.com
* By Devin Samarin, https://github.com/eboyjr
* License: X11/MIT
* See LICENSE.md
*/
/*global self, unescape */
/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
plusplus: true */
/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
(function (view) {
"use strict";
view.URL = view.URL || view.webkitURL;
if (view.Blob && view.URL) {
try {
new Blob;
return;
} catch (e) {}
}
// Internally we use a BlobBuilder implementation to base Blob off of
// in order to support older browsers that only have BlobBuilder
var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function(view) {
var
get_class = function(object) {
return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
}
, FakeBlobBuilder = function BlobBuilder() {
this.data = [];
}
, FakeBlob = function Blob(data, type, encoding) {
this.data = data;
this.size = data.length;
this.type = type;
this.encoding = encoding;
}
, FBB_proto = FakeBlobBuilder.prototype
, FB_proto = FakeBlob.prototype
, FileReaderSync = view.FileReaderSync
, FileException = function(type) {
this.code = this[this.name = type];
}
, file_ex_codes = (
"NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
+ "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
).split(" ")
, file_ex_code = file_ex_codes.length
, real_URL = view.URL || view.webkitURL || view
, real_create_object_URL = real_URL.createObjectURL
, real_revoke_object_URL = real_URL.revokeObjectURL
, URL = real_URL
, btoa = view.btoa
, atob = view.atob
, ArrayBuffer = view.ArrayBuffer
, Uint8Array = view.Uint8Array
;
FakeBlob.fake = FB_proto.fake = true;
while (file_ex_code--) {
FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
}
if (!real_URL.createObjectURL) {
URL = view.URL = {};
}
URL.createObjectURL = function(blob) {
var
type = blob.type
, data_URI_header
;
if (type === null) {
type = "application/octet-stream";
}
if (blob instanceof FakeBlob) {
data_URI_header = "data:" + type;
if (blob.encoding === "base64") {
return data_URI_header + ";base64," + blob.data;
} else if (blob.encoding === "URI") {
return data_URI_header + "," + decodeURIComponent(blob.data);
} if (btoa) {
return data_URI_header + ";base64," + btoa(blob.data);
} else {
return data_URI_header + "," + encodeURIComponent(blob.data);
}
} else if (real_create_object_URL) {
return real_create_object_URL.call(real_URL, blob);
}
};
URL.revokeObjectURL = function(object_URL) {
if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
real_revoke_object_URL.call(real_URL, object_URL);
}
};
FBB_proto.append = function(data/*, endings*/) {
var bb = this.data;
// decode data to a binary string
if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
var
str = ""
, buf = new Uint8Array(data)
, i = 0
, buf_len = buf.length
;
for (; i < buf_len; i++) {
str += String.fromCharCode(buf[i]);
}
bb.push(str);
} else if (get_class(data) === "Blob" || get_class(data) === "File") {
if (FileReaderSync) {
var fr = new FileReaderSync;
bb.push(fr.readAsBinaryString(data));
} else {
// async FileReader won't work as BlobBuilder is sync
throw new FileException("NOT_READABLE_ERR");
}
} else if (data instanceof FakeBlob) {
if (data.encoding === "base64" && atob) {
bb.push(atob(data.data));
} else if (data.encoding === "URI") {
bb.push(decodeURIComponent(data.data));
} else if (data.encoding === "raw") {
bb.push(data.data);
}
} else {
if (typeof data !== "string") {
data += ""; // convert unsupported types to strings
}
// decode UTF-16 to binary string
bb.push(unescape(encodeURIComponent(data)));
}
};
FBB_proto.getBlob = function(type) {
if (!arguments.length) {
type = null;
}
return new FakeBlob(this.data.join(""), type, "raw");
};
FBB_proto.toString = function() {
return "[object BlobBuilder]";
};
FB_proto.slice = function(start, end, type) {
var args = arguments.length;
if (args < 3) {
type = null;
}
return new FakeBlob(
this.data.slice(start, args > 1 ? end : this.data.length)
, type
, this.encoding
);
};
FB_proto.toString = function() {
return "[object Blob]";
};
FB_proto.close = function() {
this.size = this.data.length = 0;
};
return FakeBlobBuilder;
}(view));
view.Blob = function Blob(blobParts, options) {
var type = options ? (options.type || "") : "";
var builder = new BlobBuilder();
if (blobParts) {
for (var i = 0, len = blobParts.length; i < len; i++) {
builder.append(blobParts[i]);
}
}
return builder.getBlob(type);
};
}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));
/* eslint-disable */
require('script-loader!file-saver');
require('./Blob');
require('script-loader!xlsx/dist/xlsx.core.min');
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({s: {r: R, c: outRow.length}, e: {r: R + rowspan - 1, c: outRow.length + colspan - 1}});
}
;
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan) for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {v: data[R][C]};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({c: C, r: R});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
}
else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
console.log('a')
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
console.log(data);
var wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx")
}
function formatJson(jsonData) {
console.log(jsonData)
}
export function export_json_to_excel(th, jsonData, defaultTitle) {
/* original data */
var data = jsonData;
data.unshift(th);
var ws_name = "SheetJS";
var wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
var title = defaultTitle || '列表'
saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), title + ".xlsx")
}
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-09-01 19:06:01
* @Last Modified by: chenwq
* @Last Modified time: 2020-11-11 17:38:18
* @Last Modified time: 2020-11-12 19:10:13
*/
// import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account'
......@@ -73,3 +73,36 @@ export const ghUserType = {
5: '总部',
6: '供应商'
}
// 品牌商
export const brandMerchantList = [{
confId: 1,
confValue: '3M/福膜'
}, {
confId: 2,
confValue: '强生/福膜'
}, {
confId: 3,
confValue: '强生/斯帝飞'
}, {
confId: 4,
confValue: '3M/斯帝飞'
}, {
confId: 5,
confValue: '3M/今蓝'
}, {
confId: 6,
confValue: '量子/今蓝'
}, {
confId: 7,
confValue: '强生'
}, {
confId: 8,
confValue: '今蓝'
}, {
confId: 9,
confValue: '琥珀'
}, {
confId: 10,
confValue: '嘀嘀虎'
}]
......@@ -153,6 +153,93 @@
</div>
<el-button @click="handleAddPro">新增关联商品</el-button>
</template>
<template v-else-if="item.type === 'photo'">
<p class="photo-top-tips">{{item.topTips}}</p>
<div
class="activity-img"
:class="[disabled ? 'input-bg':'']"
>
<div
class="add"
v-show="!formData[item.name] || (item.maxPhotoNum > 1 && (formData[item.name].length < item.maxPhotoNum))"
>+</div>
<span
class="number"
v-if="!formData[item.name] && item.maxPhotoNum === 1"
>0/{{item.maxPhotoNum}}</span>
<span
class="number"
v-else-if="item.maxPhotoNum > 1 && (formData[item.name].length < item.maxPhotoNum)"
>{{formData[item.name].length}}/{{item.maxPhotoNum}}</span>
<template>
<img
v-if="formData[item.name] && item.maxPhotoNum === 1"
:src="formData[item.name]"
alt=""
>
</template>
<input
type="file"
name='thumbUrl'
:id="item.name + 'file'"
ref="file"
class="activity-img"
accept="image/png, image/jpeg, image/gif, image/jpg"
@click="handleAddClick(item)"
@change="e => handleImgChange(e, item)"
style="opacity: 0;"
>
</div>
<template>
<div v-if="item.maxPhotoNum > 1 && formData[item.name].length">
<img
class="muti-imgs"
v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
:src="subItem.content"
/>
<div
class="close"
@click='delBgimg($index)'
>
<i class="el-icon-delete"></i>
</div>
</div>
</template>
</template>
<template v-else-if="item.type === 'descList'">
<el-row>
<el-button @click="handleAddDesc(2, item)">添加文字</el-button>
<el-button @click="handleAddDesc(1, item)">添加图片</el-button>
</el-row>
<el-row
v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
>
<el-input
v-if="subItem.resType === 2"
type="textarea"
v-model="subItem.content"
:rows="4"
placeholder="请输入详情内容"
></el-input>
<div
class="descList-img"
v-else-if="subItem.resType === 1"
>
<img :src="subItem.content" />
<input
type="file"
class="activity-img"
accept="image/png, image/jpeg, image/gif, image/jpg"
@click="handleAddClick(item)"
@change="e => handleImgChange(e, item, subIndex)"
style="opacity: 0;"
>
</div>
<i class="el-icon-delete"></i>
</el-row>
</template>
<span v-else>{{item.name ? formData[item.name] : item.value}}</span>
</el-form-item>
<span
......@@ -196,6 +283,7 @@ import _ from 'lodash'
import relateProDialog from './relateProDialog'
import relateStoreDialog from './relateStoreDialog'
import { getGoodsList } from '@/api/commodity'
import { uploadImg } from '@/api/sys.base'
export default {
name: 'd2-form',
data() {
......@@ -319,19 +407,62 @@ export default {
var filterArr = this.formData[formDataName].filter(i => i[formItem.optionValue] !== item[formItem.optionValue])
this.formData[formDataName] = filterArr
},
// 图片
handleAddClick(targetItem) {
// console.log(this.$refs.file)
// this.$refs.file.value = null
// document.getElementsByClassName(targetItem.name + 'file')[0].value = null
},
handleImgChange(e, targetItem, subIndex = 0) {
var reader = new FileReader()
var fileInfo = e.srcElement.files[0]
reader.readAsDataURL(fileInfo)
reader.onload = e => {
const imgFile = e.target.result
const base64 = fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1]
// console.log(base64)
uploadImg({ file: base64 }).then(res => {
console.log(res)
// this.formData[targetItem.name].push()
if (!Array.isArray(this.formData[targetItem.name])) {
console.log(targetItem)
this.formData[targetItem.name] = res
} else {
if (targetItem.name === 'goodsImgList') {
this.formData[targetItem.name].push({ content: res })
} else {
this.formData[targetItem.name][subIndex].content = res
}
}
console.log(this.formData[targetItem.name])
})
}
},
// 描述 1-图片;2-文字
handleAddDesc(resType, targetItem) {
// console.log(this.formData[targetItem.name])
const orderNo = this.formData[targetItem.name].length
this.formData[targetItem.name].push({
resType: resType,
orderNo: orderNo,
content: ''
})
},
handleClose() {
this.$emit('handleClose')
},
handleUp() {
// console.log(this.formData)
let flag = true
this.formData.upgradeGoods.forEach(item => {
if (!item.profitValue) {
if (this.formData.hasOwnProperty('upgradeGoods')) {
this.formData.upgradeGoods.forEach(item => {
if (!item.profitValue) {
flag = false
}
})
if (!this.formData.linkMerchantIds.length) {
flag = false
}
})
if (!this.formData.linkMerchantIds.length) {
flag = false
}
if (flag) {
this.$refs.d2FormRuleForm.validate(valid => {
......@@ -352,9 +483,6 @@ export default {
padding-left: 20px;
background-color: #e1e0e0;
}
.d2-form .el-form-item {
/* margin-bottom: 5px; */
}
.d2-form .dis-in-block {
display: inline-block;
}
......@@ -374,6 +502,74 @@ export default {
width: 50px;
display: inline-block;
}
.d2-form .photo-top-tips {
height: 36px;
margin: 0 0;
color: #999999;
}
.d2-form .activity-img,
.d2-form .descList-img {
position: relative;
width: 88px;
height: 74px;
color: #999999;
border: 1px dashed #d9d9d9;
cursor: pointer;
margin-right: 10px;
}
.d2-form .muti-imgs {
width: 88px;
height: 74px;
}
.activity-img img {
width: 100%;
height: 100%;
}
.activity-img .add {
position: absolute;
top: 40%;
font-size: 40px;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.activity-img .number {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.activity-img .close {
display: none;
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 2;
background: rgba(0, 0, 0, 0.5);
opacity: 1;
}
.activity-img .close i {
width: 18px;
height: 18px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.activity-img:hover .close {
display: block;
}
.d2-form .input-bg {
background-color: #eee;
}
.d2-form .pro-item.el-input--medium .el-input__inner,
.d2-form .pro-item .el-input--medium .el-input__inner {
padding: 0 2px;
......
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-27 19:16:26
* @Last Modified by: chenwq
* @Last Modified time: 2020-10-29 18:13:28
* @Last Modified time: 2020-11-13 09:44:00
*/
const permision = {}
/**
......@@ -78,7 +78,7 @@ const _loop = function(res, fnGetMenu) {
if (!__oMenu) { // 不存在 可能是 按钮 直接继续循环
return true
}
if (+(__oMenu.parentId) === 0) { // 取出1级菜单
if (+(__oMenu.parentId) === 1) { // 取出1级菜单
__aParent.push(__oMenu)
} else { // 取出子菜单
__aSub.push(__oMenu)
......
......@@ -29,6 +29,7 @@ Vue.prototype.notice = notice
// Vue.use(D2Crud)
var baseConfig = ''
axios({
// baseURL: process.env.VUE_APP_REPO + '/dj-car-life-system-config-test',
baseURL: process.env.VUE_APP_REPO + '/dj-car-life-system-config',
method: 'get'
}).then(({
......
......@@ -24,8 +24,8 @@ export const home = {
icon: 's-home',
meta: {
title: '预录客户',
authId: '101',
parentId: '0',
authId: '901',
parentId: '1',
cache: true
},
component: _import('flow/editCustomer')
......@@ -57,154 +57,156 @@ export const sys = [
* 106 - 系统设置
*/
export const resources = {
'103': {
'903': {
path: '/goods',
name: 'goods',
icon: 'document',
meta: {
title: '商品库',
authId: '103',
parentId: '0',
authId: '903',
parentId: '1',
cache: true
}
},
'10301': {
'90301': {
path: '/product',
name: 'product',
icon: 'document',
meta: {
title: '产品管理',
authId: '10301',
parentId: '103',
authId: '90301',
parentId: '903',
cache: true
},
auth: [{
authId: '1030101',
parentId: '10301',
authId: '9030101',
parentId: '90301',
label: '新增商品',
category: 'Button',
type: 'primary',
handle: 'handleAdd'
}, {
authId: '1030102',
parentId: '10301',
label: '导出',
category: 'Button',
handle: 'handleExport'
}, {
authId: '1030103',
parentId: '10301',
},
// {
// authId: '1030102',
// parentId: '10301',
// label: '导出',
// category: 'Button',
// handle: 'handleExport'
// },
{
authId: '9030102',
parentId: '90301',
label: '修改',
handle: 'handleEdit'
}],
component: _import('goods/product')
},
'10304': {
'90304': {
path: '/editProduct',
name: 'editProduct',
icon: 'document',
meta: {
title: '产品编辑',
authId: '10304',
parentId: '103',
authId: '90304',
parentId: '903',
cache: true,
sideHidden: true
},
component: _import('goods/editProduct')
},
'10302': {
'90302': {
path: '/commodity',
name: 'commodity',
icon: 'document',
meta: {
title: '商品管理',
authId: '10302',
parentId: '103',
authId: '90302',
parentId: '903',
cache: true
},
auth: [{
authId: '1030201',
parentId: '10302',
authId: '9030201',
parentId: '90302',
label: '新增商品',
category: 'Button',
type: 'primary',
handle: 'handleAdd'
}, {
authId: '1030202',
parentId: '10302',
authId: '9030202',
parentId: '90302',
label: '导出',
category: 'Button',
handle: 'handleExport'
// rule:{0: '上架',}
}, {
authId: '1030203',
parentId: '10302',
authId: '9030203',
parentId: '90302',
label: '编辑',
handle: 'handleEdit'
}, {
authId: '1030204',
parentId: '10302',
authId: '9030204',
parentId: '90302',
label: '查看门店',
handle: 'handleDetail'
}],
component: _import('goods/commodity')
},
'10305': {
'90305': {
path: '/editCommodity',
name: 'editCommodity',
icon: 'document',
meta: {
title: '商品编辑',
authId: '10305',
parentId: '103',
authId: '90305',
parentId: '903',
// cache: true,
sideHidden: true
},
component: _import('goods/editCommodity')
},
'106': {
'906': {
path: '/systemConfig',
name: 'systemConfig',
icon: 'document',
meta: {
title: '系统设置',
authId: '106',
parentId: '0',
authId: '906',
parentId: '1',
cache: true
}
},
'10601': {
'90601': {
path: '/personalInfo',
name: 'personalInfo',
icon: 'document',
meta: {
title: '个人信息',
authId: '10601',
parentId: '106',
authId: '90601',
parentId: '906',
cache: true
},
component: _import('systemConfig/personalInfo')
},
'10602': {
'90602': {
path: '/serviceStore',
name: 'serviceStore',
icon: 'document',
meta: {
title: '服务4s店',
authId: '10602',
parentId: '106',
authId: '90602',
parentId: '906',
cache: true
},
auth: [{
authId: '1060201',
parentId: '10602',
authId: '9060201',
parentId: '90602',
label: '新增服务门店',
category: 'Button',
type: 'primary',
handle: 'handleAdd'
}, {
authId: '1060202',
parentId: '10602',
authId: '9060202',
parentId: '90602',
label: '删除',
handle: 'handleDelete'
}],
......
import util from '@/libs/util.js'
import { AccountLogin } from '@api/sys.account'
import { AccountLogin, getAuths } from '@api/sys.account'
import { SUPPER_ADMIN } from '@/common/constants'
import { localRoutes } from '@/router/routes'
import { baseConfig } from '@/main'
......@@ -25,21 +25,29 @@ export default {
// 如有必要 token 需要定时更新,默认保存一天
// util.cookies.set('uuid', data.loginName)
util.cookies.set('token', data.sessionId)
data.roleType = baseConfig.hasAuth ? data.roleType : SUPPER_ADMIN
const authes = (+data.roleType === SUPPER_ADMIN)
? util.permision.flatten(Object.values(localRoutes))
.map(obj => ({ authId: obj.authId, parentId: obj.parentId }))
: _.cloneDeep(data.authes)
await dispatch('d2admin/auth/set', authes, { root: true })
// // 设置 vuex 用户信息
delete data.authes
await dispatch('d2admin/user/set', data, { root: true })
// 初始化权限
await dispatch('d2admin/auth/init', null, { root: true })
// // 用户登录后从持久化数据加载一系列的设置
await dispatch('load')
// 结束
resolve()
getAuths({}).then(async res => {
// console.log(res)
!res.map(i => i.authId).includes('901') && res.unshift({
authId: '901',
name: '预录客户',
parentId: '1'
})
data.roleType = baseConfig.hasAuth ? data.roleType : SUPPER_ADMIN
const authes = (+data.roleType === SUPPER_ADMIN)
? util.permision.flatten(Object.values(localRoutes))
.map(obj => ({ authId: obj.authId, parentId: obj.parentId }))
: _.cloneDeep(res)
await dispatch('d2admin/auth/set', authes, { root: true })
// // 设置 vuex 用户信息
// delete data.authes
await dispatch('d2admin/user/set', data, { root: true })
// 初始化权限
await dispatch('d2admin/auth/init', null, { root: true })
// // 用户登录后从持久化数据加载一系列的设置
await dispatch('load')
// 结束
resolve()
})
})
.catch(err => {
console.log('err: ', err)
......
......@@ -28,13 +28,14 @@
</el-select>
</el-form-item>
<el-form-item label="销售顾问">
<el-form-item label="销售顾问" required>
<!-- <el-tag>张三</el-tag>&nbsp;<el-tag>李四</el-tag>&nbsp;<el-tag>王五</el-tag> -->
<!-- <el-tag
v-for="item in adviserList"
:key="item.userId"
>{{ item.name }}</el-tag> -->
<el-radio v-for="item in adviserList" :key="item.userId" v-model="form.employee" :label="item" >{{item.name}}</el-radio>
<p class="warningFont" v-if="showChooseCusError">未选择销售顾问</p>
</el-form-item>
<h3 class="h2">客户基本信息</h3>
......@@ -215,6 +216,29 @@
</el-form-item>
<h3 class="h2">装饰内容</h3>
<el-form-item label="基础商品" required>
<el-select
v-model="searchForm.goodsType"
placeholder="请选择产品分类"
>
<el-option value="" label="全部">全部</el-option>
<el-option v-for="item in productTypeList" :key="item.goodsType" :value="item.goodsType" :label="item.goodsTypeName" />
</el-select>&nbsp;
<el-button type="primary" @click="searchGoods">搜索</el-button>&nbsp;&nbsp;
<span class="warningFont" v-if="showChoosePrError">未选择商品</span>
</el-form-item>
<div class="table_box">
<el-table v-loading="tableLoading" :data="goodList" @selection-change="selectChange" stripe style="width: 100%" :height="TB_height" border>
<el-table-column type="selection" width="50" fixed="left" align="center" />
<el-table-column align="center" label="商品缩略图">
<template slot-scope="scope">
<img class="pro-img" :src="scope.row.goodsInfo.thumbUrl"/>
</template>
</el-table-column>
<el-table-column prop="goodsInfo.goodsName" label="商品名称" width="150" />
<el-table-column prop="goodsInfo.goodsTypeName" label="商品类型" width="150" />
</el-table>
</div>
<el-form-item label="客户备注">
<el-input
v-model="form.remark"
......@@ -238,6 +262,8 @@
import { Util } from '@/common/util'
import util from '@/libs/util'
import { getServiceStore, getStaff, getCarInfo, getCarType, getGoods, addOrder } from '@api/editCustomer'
import { BaseData } from '@/common/constants.js'
import { mapActions } from 'vuex'
export default {
name: 'editCustomer',
data() {
......@@ -252,6 +278,9 @@ export default {
form: {
newCarFlag: 'Y'
},
searchForm: {
goodsType: '',
},
storeIdList: [
// {
// id:1,
......@@ -278,6 +307,13 @@ export default {
carSmallBrandOptions: [],
carSeriesOptions: [],
carTypeOptions: [],
goodsType: '',
productTypeList: [],
TB_height: 90,
goodList: [],
selectList: [],
showChooseCusError: false,
showChoosePrError: false,
formRules: {
storeId: [{
required: true,
......@@ -314,7 +350,7 @@ export default {
message: '请输入客户职业',
trigger: 'blur'
}]
}
},
}
},
......@@ -325,9 +361,15 @@ export default {
mounted() {
this.getServiceStore()
this.getAllVehicleBrand()
this.getBaseData()
},
methods: {
...mapActions('d2admin/base', ['get']),
async getBaseData() {
this.productTypeList = await this.get(BaseData.productType)
},
/**
* 获取服务门店
*/
......@@ -354,8 +396,12 @@ export default {
/**根据门店商户号获取基础商品列表 */
let paramsForGood = {'merchantId': merchantId}
getGoods(paramsForGood).then(res => {
// this.adviserList = res || []
console.log(res);
this.goodList = res || []
if(this.goodList.length > 0){
this.TB_height = 300
}else{
this.TB_height = 90
}
});
},
......@@ -447,7 +493,26 @@ export default {
this.form.carTypeName = o.name;
},
searchGoods(){
/**根据门店商户号获取基础商品列表 */
let paramsForGood = {'merchantId': this.form.storeId,'goodsType':this.searchForm.goodsType}
getGoods(paramsForGood).then(res => {
this.goodList = res || []
if(this.goodList.length > 0){
this.TB_height = 300
}else{
this.TB_height = 90
}
});
},
/**
* 复选框操作
*/
selectChange: function(selection){
console.log(selection)
this.selectList = selection
},
/**
* 保存信息
......@@ -459,7 +524,25 @@ export default {
}
let params = {}
let customer = {}
let goods = ['2011051953545051','2011051952253987']
let goods = []
/**判断是否选择销售顾问 */
if(this.form.employee){
this.showChooseCusError = false
}else{
this.showChooseCusError = true
return false
}
/**判断是否选择商品 */
if(this.selectList.length > 0){
this.showChoosePrError = false
for(var key in this.selectList){
goods.push(this.selectList[key].id)
}
}else{
this.showChoosePrError = true
return false
}
params.merchantId = this.form.storeId
params.userId = this.form.employee.userId
params.employeeName = this.form.employee.name
......@@ -526,4 +609,15 @@ export default {
.itd {
width: 400px;
}
.pro-img {
width: 80px;
height: 80px;
}
.warningFont{
font-size:14px;
color:#f00;
font-weight:normal;
}
</style>
......@@ -106,8 +106,10 @@
</template>
<script>
import { getList } from '@api/commodity'
import { getList, exportBaseList } from '@api/commodity'
import { BaseData } from '@/common/constants.js'
import Blob from '@/common/Blob.js'
import Export2Excel from '@/common/Export2Excel.js'
import { mapActions } from 'vuex'
import _ from 'lodash'
import storeDetail from './storeDetail'
......@@ -189,7 +191,6 @@ export default {
mounted() {
this.getBaseData()
console.log(this.$route.params)
// var allOpt = { confId: '', confKey: '全部' }
// this.baseData.goodsType.unshift(allOpt)
// this.baseData.brandList.unshift(allOpt)
......@@ -221,7 +222,14 @@ export default {
}
})
},
handleExport() { },
handleExport() {
const tHeader = ['商品ID', '商品名称', '分类', '品牌商']
const fieldVal = ['goodsCode', 'goodsName', 'goodsTypeName', 'brandMerchantName']
exportBaseList(this.searchForm).then(res => {
console.log(res)
// const exportData = this.
})
},
handleEdit(row) {
this.$router.push({
name: 'editCommodity',
......
......@@ -140,7 +140,6 @@ export default {
} else {
this.editForm[0].formBlock[0].isDisabled = false
this.getGoodsList()
this.$nextTick(() => {
this.show = true
})
......@@ -157,7 +156,8 @@ export default {
})
},
handleAddClose(isRefresh = false) {
this.$router.push({ name: 'commodity', params: isRefresh })
this.close({ tagName: '/commodity' })
this.$router.push({ name: 'commodity' })
this.close({ tagName: '/editCommodity' })
},
handleAddConfirm(data) {
......
......@@ -2,10 +2,11 @@
<template>
<div class="edit-product">
<d2-form
v-if="show"
ref="d2ProductForm"
:formItemWidth="formItemWidth"
:rules="rules"
:addOrEdit="addOrEdit"
addOrEdit="add"
:originData="editData"
:formList="editForm"
@handleAddConfirm="handleAddConfirm"
......@@ -15,8 +16,10 @@
</template>
<script>
import _ from 'lodash'
import { mapActions } from 'vuex'
import { BaseData } from '@/common/constants.js'
import { BaseData, brandMerchantList } from '@/common/constants.js'
import { addGoods, editGoods } from '@/api/product'
export default {
name: 'editProduct',
data() {
......@@ -25,7 +28,9 @@ export default {
addOrEdit: 'add',
rules: {
goodsName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }],
goodsType: [{ required: true, message: '请选择分类', trigger: 'change' }]
goodsType: [{ required: true, message: '请选择分类', trigger: 'blur' }],
thumbUrl: [{ required: true, message: '请选择缩略图', trigger: 'change' }],
goodsImgList: [{ required: true, message: '请选择产品主图', trigger: 'change' }]
},
editData: {
goodsName: '',
......@@ -36,7 +41,11 @@ export default {
brandMerchantName: '',
thumbUrl: '',
goodsImgList: [],
goodsDescList: []
goodsDescList: [{
resType: 2,
orderNo: 0,
content: ''
}]
},
editForm: [{
title: '产品基本信息',
......@@ -66,8 +75,24 @@ export default {
tips: '选择品牌商',
isClear: true,
optionList: [],
optionId: 'goodsType',
optionLabel: 'goodsTypeName'
optionId: 'confId',
optionLabel: 'confValue'
}, {
name: 'thumbUrl',
label: '缩略图',
type: 'photo',
topTips: '用于在小程序主页的商品列表展示',
maxPhotoNum: 1
}, {
name: 'goodsImgList',
label: '产品主图',
type: 'photo',
topTips: '用于在小程序商品详情页的顶部展示',
maxPhotoNum: 10
}, {
name: 'goodsDescList',
label: '产品描述',
type: 'descList'
}]
}],
baseData: {
......@@ -77,18 +102,74 @@ export default {
},
mounted() {
this.addOrEdit = this.$route.params.addOrEdit
if (this.addOrEdit === 'edit') {
this.show = false
this.editData = _.cloneDeep(this.$route.params.form)
console.log(this.editData)
this.$nextTick(() => {
this.show = true
})
} else {
this.show = true
}
this.getBaseData()
this.editForm[0].formBlock[3].optionList = brandMerchantList
},
methods: {
...mapActions({
get: 'd2admin/base/get'
get: 'd2admin/base/get',
close: 'd2admin/page/close'
}),
async getBaseData() {
const temp = await this.get(BaseData.productType)
this.baseData.productType = temp
this.editForm[0].formBlock[1].optionList = temp
console.log(this.baseData.productType)
},
handleAddClose(isRefresh = false) {
this.close({ tagName: '/product' })
this.$router.push({ name: 'product' })
this.close({ tagName: '/editProduct' })
},
handleAddConfirm(data) {
data.goodsDescList = data.goodsDescList.filter(item => item.content)
data.goodsTypeName = this.baseData.productType.find(item => item.goodsType === data.goodsType).goodsTypeName
console.log(data)
data.brandMerchantCode && (data.brandMerchantName = brandMerchantList.find(item => item.confId === data.brandMerchantCode).confValue)
if (this.addOrEdit === 'edit') {
var params = {
id: data.id,
goodsName: data.goodsName,
goodsType: data.goodsType,
goodsTypeName: data.goodsTypeName,
brandMerchantCode: data.brandMerchantCode,
brandMerchantName: data.brandMerchantName,
sapCode: data.sapCode,
thumbUrl: data.thumbUrl,
goodsImgList: data.goodsImgList,
goodsDescList: data.goodsDescList
}
params.goodsImgList.forEach(i => {
delete i.createdDate
delete i.updatedDate
})
params.goodsDescList.forEach(i => {
delete i.createdDate
delete i.updatedDate
})
editGoods(params).then(res => {
console.log(res)
this.notice.okTips()
this.handleAddClose(true)
})
} else {
addGoods(data).then(res => {
this.notice.okTips()
this.handleAddClose(true)
})
}
}
}
}
......
......@@ -29,7 +29,7 @@
<el-option
v-for="item in baseData.brandList"
:key="item.confId"
:label="item.confKey"
:label="item.confValue"
:value="item.confId"
></el-option>
</el-select>
......@@ -75,6 +75,7 @@
import { getList, getType } from '@api/product'
import { BaseData } from '@/common/constants.js'
import { mapActions } from 'vuex'
import { brandMerchantList } from '@/common/constants'
export default {
name: 'product',
data() {
......@@ -137,6 +138,11 @@ export default {
mounted() {
// this.getProductType()
this.getBaseData()
// console.log(storeDetail)
// var allOpt = { confId: '', confKey: '全部' }
// this.baseData.product.unshift(allOpt)
// this.baseData.brandList.unshift(allOpt)
this.baseData.brandList = brandMerchantList
},
methods: {
......@@ -164,12 +170,25 @@ export default {
this.$refs.productTable.refreshTable()
},
handleAdd(form) {
console.log(form)
this.$router.push({ name: 'editProduct' })
// console.log(form)
this.$router.push({
name: 'editProduct',
params: {
addOrEdit: 'add',
form: form
}
})
},
handleExport() { },
// handleExport() { },
handleEdit(row) {
console.log(row)
// console.log(row)
this.$router.push({
name: 'editProduct',
params: {
addOrEdit: 'edit',
form: row
}
})
},
handleDetail(row) {
this.detailData = row
......
......@@ -81,7 +81,7 @@ export default {
const clone = util.deepClone(Object.values(localRoutes))
const { menus } = util.permision.packMenusBtns(clone)
const all = util.permision.flatten(clone)
menus.find(o => o.authId === '101').disabled = true
menus.find(o => o.authId === '901').disabled = true
return { menus, all }
}
},
......
......@@ -50,7 +50,7 @@ export default {
handler(value) {
if (!value) return
const chk = []
const treeChk = ['101']
const treeChk = ['901']
this.$nextTick(() => {
value.forEach(v => {
v.authId += ''
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!