Commit a85b6041 by chenwq

商品库

1 parent 66cc0c66
Showing 76 changed files with 6305 additions and 0 deletions
NODE_ENV='development'
# must start with VUE_APP_
VUE_APP_ENV = 'development'
VUE_APP_PORT = 6652
NODE_ENV='production'
# must start with VUE_APP_
VUE_APP_ENV = 'production'
\ No newline at end of file
{
"root": true,
"env": {
"node": true
},
"extends": ["plugin:vue/essential", "@vue/prettier"],
"rules": {
"no-console": "off",
"no-unused-vars":"off",
"prettier.endOfLine": "crlf",
"endOfLine":"auto"
},
"parserOptions": {
"parser": "babel-eslint"
}
}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
{
"printWidth": 800,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"semi": false,
"wrap_line_length": 820,
"wrap_attributes": "auto",
"proseWrap": "always",
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "ignore",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"jsxBracketSameLine": true,
"files.insertFinalNewline": true,
"useTabs": false,
"eslintIntegration": true,
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
}
],
"endOfLine": "auto"
}
# subapp-blog
微前端博客子应用
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
plugins: [
[
"component",
{
libraryName: "element-ui",
styleLibraryName: "theme-chalk"
}
]
]
};
This diff could not be displayed because it is too large.
{
"name": "purchase",
"version": "1.0.0",
"description": "A Vue.js project",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"bignumber.js": "^9.1.1",
"core-js": "^3.4.4",
"dayjs": "^1.10.7",
"el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5",
"glsx-common": "^2.0.8",
"glsx-components": "^1.5.4",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.0",
"@vue/cli-plugin-vuex": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"@vue/eslint-config-prettier": "^5.0.0",
"babel-eslint": "^10.0.3",
"babel-plugin-component": "^1.1.1",
"eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^5.0.0",
"node-sass": "^4.14.1",
"prettier": "^1.19.1",
"sass-loader": "^8.0.0",
"vue-cli-plugin-element": "^1.0.1",
"vue-template-compiler": "^2.6.10"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
No preview for this file type
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="referrer" content="never">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<!-- 使用CDN的CSS文件 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
<% } %>
<!-- 使用CDN的JS文件 预加载 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
<% } %>
<title>微前端子应用:博客</title>
</head>
<body>
<noscript>
<strong>We're sorry but module-report doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
</body>
</html>
\ No newline at end of file
var express = require('express')
// var history = require('connect-history-api-fallback')
var cors = require('cors')
var app = express()
// app.use(history())
app.use(cors())
app.use(express.static('./dist'))
app.get('/', function(req, res) {
res.send('Hello jq')
})
const port = 6652
app.listen(port)
console.log(`服务已运行:\r\n http://127.0.0.1:${port}`)
<template>
<div id="app">
<!-- <h2>
报表子应用
<span class="right"></span>
</h2>
<div id="nav">
<span>切换路由:</span>
<el-button-group class="right">
<el-button type="primary" size="medium" @click="routerChange('/')">报表</el-button>
<el-button type="primary" size="medium" @click="routerChange('/about')">穿梭框</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-1')">表格</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-2')">日历</el-button>
<el-button type="primary" size="medium" @click="toAppReport('3-1')">aaaa</el-button>
</el-button-group>
</div>
<div class="parent-child-communication">
<h3>父子应用通信:</h3>
<div style="margin-bottom: 20px;">
<span>rxjs通信方案:</span>
<el-button class="right" type="primary" size="medium" @click="callParentChange('rxjs')">通知父应用变天了</el-button>
</div>
<div>
<span>官方通信方案:</span>
<el-button class="right" type="primary" size="medium" @click="callParentChange('default')">通知父应用收到</el-button>
</div>
<img src="./assets/logo.png" alt="" srcset="" />
</div>-->
<router-view />
</div>
</template>
<script>
export default {
name: 'report-app',
props: {
msg: String,
message: String
},
data() {
return {
myMsg: '',
gs: ''
}
},
created() {
this.myMsg = this.msg
this.myMessage = this.message
}
}
</script>
<style lang="scss">
.parent-child-communication {
padding: 20px 0;
line-height: 36px;
}
#app {
padding: 0px 20px 20px 40px;
// overflow-y: auto;
height: 100%;
}
</style>
>
/*
所有模块都定义在 modules
|-modules
|----demo.js
|----demo1.js
|----...
|-index.js ---动态对外暴露所有模块 无须手动添加
参考demo.js 用法 : this.$apis.demo.GETLISTDEVICEFILEUNSTOCK(...)
*/
const modulesFiles = require.context('./modules', true, /\.js$/)
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
modules[moduleName] = value.default
return modules
}, {})
export default modules
import { http } from '@/main'
const path = 'dj.api.'
const path2 = 'dj.smartcarlife.api.'
const getListApi = params => {
params.method = `scrm.api.shopmall.goods.page.curMerchant`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
const getSimpleMerchantList = params => {
params.method = 'scrm.api.carlife.merchant.listWithPageSimpleByCurMerchant'
return http({
url: 'rop-scrm-carlife/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getListApi, getSimpleMerchantList }
import { http } from '@/main'
const path = 'dj.api.smartcarlife.'
const path2 = 'dj.api.'
const path3 = 'dj.smartcarlife.api.'
const path4 = 'dj.api.goodsCategoryConfiguration.'
// 获取当前登录账号可见的园区店列表
const getyqMerchantList = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}permission.yqMerchant.list`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 入库管理列表
const getGoodsWarehousingList = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path2}life.GoodsWarehousingInfo.list`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 库存记录分页查询
const getMerchantGoodsStockMonthReport = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}MerchantGoodsStockMonthReport.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 月度的库存结算单
const getReportByGoods = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}MerchantGoodsStockMonthReport.listByGoods`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 出库记录查询
const getMerchantGoodsStockReduceRecord = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}MerchantGoodsStockReduceRecord.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 分页查询盘点单列表
const stockCheckPage = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path3}stock.check.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// // 分页查询盘点详细信息
const stockCheckDetailPage = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path3}stock.check.detail.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 商品库存列表(创建盘点、调拨时展示)
const stockRemainPage = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path3}stock.remain.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 保存盘点确认单
const saveStockCheck = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path3}stock.check.save`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// // 根据场景类型查询对应所有类目
// const queryGoodsCategoryBySceneId=(data)=> {
// data.method = `${path4}queryGoodsCategoryBySceneId`
// return http({
// url: 'rop-scrm-boutiquecoupon/router',
// method: 'POST',
// data: params,
// sign: true
// })
// }
// 分页查询调拨单列表
const stockAllocatePage = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path3}stock.allocate.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 分页查询调拨详细信息
const stockAllocateDetailPage = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path3}stock.allocate.detail.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
//导出
const exportExcel = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.life.GoodsWarehousingInfo.exportExcel`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
//导出
const exportMerchantExcel = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.smartcarlife.MerchantGoodsStockMonthReport.export`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
//导出
const exportReduceExcel = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.smartcarlife.MerchantGoodsStockReduceRecord.export`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
//导出
const exportCheckExcel = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.smartcarlife.api.stock.check.export`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
//导出
const exportaAllocateExcel = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.smartcarlife.api.stock.allocate.export.async`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
const exportaInventExcel = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.life.InventoryWarningInfo.exportExcel`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 保存调拨单
const saveStockAllocate = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path3}stock.allocate.save`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 调入门店
const yqRelatedList = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path3}yqRelated.yqMerchant.list`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// // 库存预警列表查询
export function inventoryWarningList(params) {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path2}life.InventoryWarning.list`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
const getListApi = params => {
params.method = `scrm.api.shopmall.goods.page.curMerchant`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
export default { inventoryWarningList, exportaInventExcel, exportaAllocateExcel, exportCheckExcel, exportReduceExcel, exportMerchantExcel, exportExcel, saveStockAllocate, stockAllocateDetailPage, stockAllocatePage, yqRelatedList, saveStockCheck, stockRemainPage, stockCheckDetailPage, stockCheckPage, getMerchantGoodsStockReduceRecord, getReportByGoods, getyqMerchantList, getGoodsWarehousingList, getMerchantGoodsStockMonthReport, getListApi }
import { http,http_common } from '@/main'
const path = "dj.api."
const defaultPath = 'scrm.api.carlife.'
// 获取不同场景的商品分类
const getGoodsCategoryConfiguration = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.currentPage = 1
params.pageSize = 999999
params.routerMethod = `${path}goodsCategoryConfiguration.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 视频上传
const uploadVideo = params => {
params.method = `${defaultPath}common.uploadVideo`
return http({
url: 'rop-scrm-carlife/router',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file']
})
}
const uploadImg = params => {
params.method = 'glsx.accounts.biz.common.pictureUpload'
return http_common({
url: '/router?method=glsx.accounts.biz.common.pictureUpload',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file']
})
}
export default { getGoodsCategoryConfiguration, uploadImg, uploadVideo }
.left {
float: left;
}
.right {
float: right;
}
.align-right {
text-align: right;
}
.left{float:left}.right{float:right}.align-right{text-align:right}
$color-yellow:#fdb757;
$color-green:#2cca74;
$color-gray:#999;
//背景图片 100%
@mixin bkgMaxSize($url) {
background-image: url($url);
background-repeat: no-repeat;
background-size: 100% 100%;
}
@mixin font-setting-group($font-size,$font-family,$font-weight,$color,$line-height){
font-size: $font-size;
font-family: $font-family;
font-weight: $font-weight;
color: $color;
line-height: $line-height;
}
//边框圆角
@mixin borderRadius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
-o-border-radius: $radius;
border-radius: $radius;
}
//定位上下左右居中
@mixin positionCenter {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
//定位上下居中
@mixin ct {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
//定位左右居中
@mixin cl {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
//定位全屏
@mixin allcover {
position: absolute;
top: 0;
right: 0;
}
//相对定位
@mixin my-absolute($left, $top,$z) {
position: absolute;
z-index: $z;
margin-left: $left;
margin-top: $top;
}
//宽高-不同
@mixin widthHeightN($width, $height){
width: $width;
height: $height;
}
//宽高-相同
@mixin widthHeightY($number){
width: $number;
height: $number;
}
//字体大小,颜色
@mixin sizeColor($size, $color){
font-size: $size;
color: $color;
}
//flex布局
@mixin center_none{
display: flex;
justify-content: center;
align-items: center;
}
@mixin center_center{
display: flex;
justify-content: center;
align-items: center;
}
@mixin flex-start_center{
display: flex;
justify-content: flex-start;
align-items: center;
}
@mixin space-between_center{
display: flex;
justify-content: space-between;
align-items: center;
}
@mixin space-around_center{
display: flex;
justify-content: space-around;
align-items: center;
}
@mixin flex-end_center{
display: flex;
justify-content: flex-end;
align-items: center;
}
@mixin wrap_flex-start{
display: flex;
flex-wrap:wrap;
align-content:flex-start;
}
@mixin flex-start_column{
display: flex;
justify-content: flex-start;
flex-direction: column;
}
@mixin none_center_column{
display: flex;
align-items: center;
flex-direction: column;
}
@mixin center_center_column{
display: flex;
align-items: center;
justify-content: flex-start;
flex-direction: column;
}
//圆点
@mixin dot{
width: 6px;
height: 6px;
border-radius: 50%;
display: inline-block;
vertical-align: middle;
margin-right: 8px;
}
body,
html {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #f4f5fa;
}
.container {
background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 20px;
}
.commodity .table-title {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
}
.commodity .edit-container {
margin-bottom: 32px;
}
// form-start
.commodity.edit-box .container {
padding: 0 0 20px;
}
.commodity .edit-form-container {
margin-top: 20px;
}
.commodity .edit-title {
font-size: 16px;
font-weight: 600;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
padding: 0 0 0 20px;
}
// form-end
.m-b-20 {
margin-bottom: 20px;
}
.p-t-20 {
padding-top: 20px;
}
.commodity .p-0 {
padding: 0;
}
.pointer {
cursor: pointer;
}
.img-36 {
width: 36px;
height: 36px;
}
.carIcon {
display: inline-block;
width: 22px;
height: 22px;
background: url(../../images/shoppingCarIcon.webp) no-repeat;
background-size: 100% 100%;
margin-right: 4px;
}
/**
* 根据路由匹配地址
* @param {*} data 路由数据
* @param {*} base 路由前缀
* @param {*} options 粗略的配置项
*/
function routeMatch(data, base, options = { url: 'url', name: 'name', id: 'id', permissions: 'permissions' }) {
if (!Array.isArray(data)) return []
// 主视图路由 正式项目需要区分登陆注册等
/* let userRouter = {
path: "/layout",
name: "layout",
component: () => import('@/views/layout/index.vue'),
redirect: '/index',
children: []
}; */
// 创建路由盒子
let routerBox = []
// 将菜单数据处理为一维函数 如果有多级菜单
// let menu = flattenDeep(data, 'children');
let menu = data
// 遍历处理路由
menu.forEach(item => {
if (!item[options.url]) return
let _url = item[options.url].replace(base, '')
try {
let routerItem = {
path: _url, // 路由路径名
name: item[options.name] || item[options.id], // 命名路由 用于配合菜单简洁跳转
meta: {
purview: item[options.permissions]
}, // 路由元信息 定义路由时即可携带的参数,可用来管理每个路由的按钮操作权限
component: () => import(`@/views${_url}/index.vue`) // 路由映射真实视图路径
}
routerBox.push(routerItem)
} catch (err) {
item[options.url] = '/err-404'
}
})
// 推入需要授权后等异步加载的,非服务端获取的功能性页面
// routerBox.push(...nextRouter);
let errorBox = {
path: '*',
redirect: '/err-404'
}
routerBox.push(errorBox)
return routerBox
}
export default routeMatch
// 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则
function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, maxValue, regRule) {
/* eslint-disable */
var reg = {
priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/,
zNumReg: /^\d*$/
}
/* eslint-enable */
regRule = regRule || 'priceReg'
if (newValue && ((minValue && newValue < minValue) || (maxValue && newValue > maxValue))) {
return oldValue || ''
}
if (newValue && reg[regRule].test(newValue + '')) {
if (/\./.test(newValue)) {
newValue = newValue + ''
var interger = newValue.split('.')[0]
var point = newValue.split('.')[1]
var intergerNum = interger.length > intergerDigit ? oldValue.split('.')[0] : interger
var pointNum = point.length > pointDigit ? point.slice(0, pointDigit) : point
newValue = pointDigit ? intergerNum + '.' + pointNum : newValue.split('.')[0]
} else {
newValue = newValue.length > intergerDigit ? oldValue.slice(0, intergerDigit) : newValue
if (regRule == 'zNumReg') {
newValue = newValue.split('')[0] == '0' ? '0' : newValue
}
}
return newValue
} else {
return newValue ? oldValue : ''
}
}
const orderManageStatusList = [
{ confId: '1', confName: '未支付' },
{ confId: '2', confName: '已支付' },
{ confId: '3', confName: '已失效' },
{ confId: '4', confName: '已发货' },
{ confId: '5', confName: '已收货' },
{ confId: '6', confName: '待审核' },
{ confId: '7', confName: '审核成功' },
{ confId: '8', confName: '审核失败' },
{ confId: '9', confName: '待确认' },
{ confId: '10', confName: '退款中' },
{ confId: '11', confName: '已退款' },
{ confId: '12', confName: '退款失败' },
{ confId: '13', confName: '待发货' },
{ confId: '14', confName: '待安装' },
{ confId: '15', confName: '已安装' }
]
const orderSourceList = [
{ confId: '1', confName: '商城订单' },
{ confId: '2', confName: '直播订单' },
{ confId: '3', confName: '活动订单' }
]
const deliveryTypeList = [
{ confId: '1', confName: '到店核销' },
{ confId: '2', confName: '快递到家' }
]
//会员中心得状态list
const statusList = [
// {
// confId: '',
// confName: '全部'
// },
{
confId: 1,
confName: '生效中'
},
{
confId: 2,
confName: '已失效'
}
]
//会员订单类型字典
const orderTypesList = [{
confId: 1,
confName: '套餐'
},
{
confId: 2,
confName: '会员卡'
}
]
const orderStatusList = [
// 2: '待收货',
// 3: '已完成',
// 4: '售后中',
// 5: '退款失败',
// 6: '已经退款',
{
confId: 2,
confName: '待收货'
},
{
confId: 3,
confName: '已完成'
},
{
confId: 4,
confName: '售后中'
},
{
confId: 5,
confName: '退款失败'
},
{
confId: 6,
confName: '已退款'
},
]
const serviceStatusList = [{
confId: 1,
confName: '未生效'
},
{
confId: 2,
confName: '生效中'
},
{
confId: 3,
confName: '已失效'
}
]
const memberTypeList = [{
confId: 1,
confName: '正式会员'
},
{
confId: 2,
confName: '试用会员'
}
]
const stateList = [{
confId: 0,
confName: '待上架'
},
{
confId: 1,
confName: '在售中'
},
{
confId: 2,
confName: '已下架'
},
]
export {
limitPrice,
orderManageStatusList,
orderSourceList,
deliveryTypeList,
statusList,
serviceStatusList,
memberTypeList,
stateList,
orderTypesList,
orderStatusList
}
\ No newline at end of file
// 获取最近n个月,默认6个月
export function getCurrentSixMonth(n = 5) {
return [new Date(new Date().setMonth(new Date().getMonth() - n)), new Date()]
}
// 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则
export function limitPrice(
newValue,
oldValue,
intergerDigit,
pointDigit,
minValue,
maxValue,
regRule
) {
var reg = {
priceReg: /^\d[\d\.]*$/, // eslint-disable-line
numReg: /^[1-9]\d*$/
}
regRule = regRule || "priceReg"
if (
newValue &&
((minValue && newValue < minValue) || (maxValue && newValue > maxValue))
) {
return oldValue || ""
}
if (newValue && reg[regRule].test(newValue + "")) {
if (/\./.test(newValue)) {
newValue = newValue + ""
var interger = newValue.split(".")[0]
var point = newValue.split(".")[1]
var intergerNum =
interger.length > intergerDigit ? oldValue.split(".")[0] : interger
var pointNum =
point.length > pointDigit ? point.slice(0, pointDigit) : point
newValue = pointDigit
? intergerNum + "." + pointNum
: newValue.split(".")[0]
} else {
newValue =
newValue.length > intergerDigit
? oldValue.slice(0, intergerDigit)
: newValue
}
return newValue
} else {
return newValue ? oldValue : ""
}
}
/**
* 时间控件-限制月份
*/
export const rangePickerOptions = {
disabledDate(date) {
console.log(date)
console.log(new Date())
if (date > new Date()) {
return true
}
return false
}
}
/**
* 时间控件-(0-30天内的日期)
*/
export const appointDays = 35
export const afterTodayOptions = {
disabledDate(date) {
if (
date < new Date(new Date().toLocaleDateString()) ||
date >
new Date(new Date().setDate(new Date().getDate() + (appointDays - 1)))
) {
return true
}
return false
}
}
/**
* 时间控件-单年份选择时限制年份
*/
export const rangePickerOptions_year_2023 = {
disabledDate(date) {
// console.log(date)
// console.log(date.getFullYear())
// console.log(new Date())
if (
date.getFullYear() > new Date().getFullYear() ||
date.getFullYear() < 2023
) {
return true
}
return false
}
}
/**
* 时间控件-限制月份
*/
export const beforeRangePickerOptions = {
disabledDate(date) {
if (date > new Date()) {
return true
}
return false
}
}
export const afterRangePickerOptions = {
disabledDate(date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
if (date < yesterday) {
return true
}
return false
}
}
<!-- 搜索 -->
<template>
<div :class="['glsx-combi-form', isEdit ? 'gl-form-page' : '']">
<el-form :ref="formRef" :inline="true" :model="formObj" :rules="formRules" size="small" class="glsx-combi-form-block">
<template v-for="(item, index) in formData">
<el-form-item v-if="!item.isHide" :key="index" :id="item.name" :label-width="isEdit ? '154px' : labelWidth" :class="[{ 'no-label': !item.label, isBlock: isBlock }, { 'textBox': item.type == 'textBox' }]" :style="{ 'margin-bottom': isEdit ? '24px' : '', 'margin-right': isEdit ? '0px' : '30px', ...item.style }" :label="item.label" :prop="item.name">
<span v-if="!item.isHide && item.tips" class="tips-block" slot="label">
<span class="tips-label">{{ item.label }}</span>
<el-popover placement="top" width="200" trigger="hover" :content="item.tips">
<img slot="reference" class="tips-icon" src="./images/icon-tip.png" />
</el-popover>
:
</span>
<span v-else-if="!item.isHide && item.label && !item.tips" slot="label">
<span class="combi-form-label" :style="{ width: item.labelWidth || labelWidth }">{{ item.label }}:</span>
</span>
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<span v-else-if="item.type === 'showTxt'">{{ formObj[item.name] }}</span>
<div v-else-if="item.type === 'input'">
<el-input :placeholder="item.placeholder || '请输入' + item.label" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :prefix-icon="item.prefixIcon" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :autosize="item.inputType == 'textarea'" :rows="item.rows || 2" :style="{ width: item.width || defaultWidth }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)">
<span v-if="item.prepend" slot="prepend">{{ item.prepend }}</span>
<span v-if="item.append" slot="suffix">{{ item.append }}</span>
</el-input>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<!-- 选择框 -->
<div v-else-if="item.type === 'select'">
<el-select :style="{ width: item.width || defaultWidth }" v-model="formObj[item.name]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :clearable="item.isClear || false" :placeholder="item.placeholder || '请选择' + item.label" :filterable="!item.noFilter" :disabled="item.isDisabled" :no-data-text="item.noDataText || '无数据'" :multiple="item.multiple || false" :collapse-tags="item.collapseTags || true" @change="selectAddAttr($event, item)">
<el-option v-for="subItem in item.optionList" :key="subItem[item.optionId]" :label="subItem[item.optionLabel]" :value="subItem[item.optionId]" :disabled="subItem.isDisabled || false"></el-option>
</el-select>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<!-- radio -->
<div v-else-if="item.type === 'radio'">
<el-radio-group v-model="formObj[item.name]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :disabled="item.isDisabled" @change="item.handleRadioChange">
<el-radio v-for="subItem in item.optionList" :key="subItem[item.optionId]" :disabled="subItem.isDisabled" :label="subItem[item.optionId]">
{{ subItem[item.optionLabel] }}
<slot :name="subItem.suffixSonSlot" :scope="subItem"></slot>
</el-radio>
</el-radio-group>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<el-date-picker v-else-if="item.type === 'datePicker'" v-model="formObj[item.name]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :type="item.dateType || 'daterange'" :disabled="item.isDisabled" :value-format="item.valueFormat" :style="{ width: item.width || defaultWidth }" :clearable="item.isClear || false" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="item.customPickerOptions || pickerOption[item.pickerOptions]">
</el-date-picker>
<template v-else-if="item.type === 'upload'">
<p class="photo-top-tips">{{ item.topTips }}</p>
<slot :name="item.prefixSlot" :scope="item"></slot>
<div v-if="!item.isDisabled" :style="{ width: item.width || defaultWidth }">
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length < item.maxPhotoNum : !formObj[item.name]" class="activity-img img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<div class="add" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('addStyle') ? item.uploadStyle.addStyle : ''">
+</div>
<!-- <span v-if="item.maxPhotoNum > 1" class="number">{{ formObj[item.name].length }}/{{ item.maxPhotoNum }}</span> -->
<span class="number" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('fontSize') ? item.uploadStyle.fontSize : ''">上传{{
item.uploadType == 'video' ? '视频' : '图片' }}</span>
<input v-if="item.uploadType == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" accept="video/mp4" @change="e => handleUploadChange(e, item)" />
<input v-else type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleUploadChange(e, item)" />
</div>
</div>
<template>
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length : formObj[item.name]">
<span v-if="Array.isArray(formObj[item.name])">
<span v-for="(subItem, subIndex) in formObj[item.name]" :key="subIndex" class="muti-imgs img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<video v-if="item.uploadType == 'video'" class="img-w-h activity-img" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="typeof subItem == 'object' ? subItem.content : subItem"></video>
<img v-else class="img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="typeof subItem == 'object' ? subItem.content : subItem" />
<span class="img-btns" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<span class="btn-item">
<i v-show="!item.isDisabled" class="el-icon-delete" @click="handleImgDelete(item, subIndex)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(typeof subItem == 'object' ? subItem.content : subItem, item)"></i>
</span>
</span>
</span>
</span>
<span v-else class="muti-imgs">
<video v-if="item.uploadType == 'video'" class="img-w-h activity-img" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="formObj[item.name]"></video>
<img v-else class="img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="formObj[item.name]" />
<span class="img-btns" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<span class="btn-item">
<i v-show="!item.isDisabled" class="el-icon-delete" @click="handleImgDelete(item)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(formObj[item.name], item)"></i>
</span>
</span>
</span>
</div>
</template>
<slot :name="item.suffixSlot" :scope="item"></slot>
</template>
<!-- 图文编辑器 -->
<!-- <textBox v-else-if="item.type === 'textBox'" :ref="item.name + 'TextBox'" :excludeMenus="item.excludeMenus || ['code']" @change="e => handleTextBoxChange(e, item)" @focus="handleTextBoxFocus(item)" :boxHeight="item.boxHeight"></textBox> -->
<!-- 地图 -->
<div v-else-if="item.type === 'map'" class="flex">
<Province ref="provinceForm" :subdistrict="subdistrict" :is-disabled="item.isDisabled" @selectProvince="e => handleSelectProvince(e, item)" @selectCity="e => handleSelectCity(e, item)" :province-view="item.provinceView"></Province>
<el-input style="flex: 1;" v-model="formObj[item.name]" placeholder="请选择商户地址" :readonly="item.isReadonly"></el-input>
<el-button class="m-l-10" v-show="!item.isDisabled" @click="handleSelectMap(item)" type="primary">选择地址</el-button>
</div>
</el-form-item>
</template>
<slot name="footer"></slot>
</el-form>
<GLDialog v-if="isImgVisible" big-title="查看" mode="big" :visible.sync="isImgVisible" :close-on-click-modal="false" @onOk="isImgVisible = false" @onCancel="isImgVisible = false">
<div class="dialog-look">
<video v-if="dialogObj.uploadType == 'video'" class="dialog-video" controls>
<source :src="dialogObj.url" type="video/mp4" />
</video>
<img v-else class="dialog-img" width="100%" :src="dialogObj.url" alt="" />
</div>
</GLDialog>
<GLDialog big-title="选择地址" mode="big" :visible.sync="dialogMapVisible" @onOk="getAddress" @onCancel="dialogMapVisible = false">
<map-view v-if="dialogMapVisible" ref="mapForm"></map-view>
<!-- <span slot="footer" class="dialog-footer">
<el-button @click="">取 消</el-button>
<el-button type="primary" @click="getAddress">确 定</el-button>
</span> -->
</GLDialog>
</div>
</template>
<script>
// import textBox from '@/views/material/components/textBox'
import Province from './provinceCity.vue'
// import mapView from './mapView.vue'
import GLDialog from '../glsx-dialog/index.vue'
import { beforeRangePickerOptions, afterRangePickerOptions } from './common'
export default {
name: 'GlsxCombiForm',
components: {
// textBox,
Province,
// mapView,
GLDialog
},
data() {
return {
pickerOption: {
beforeRangePickerOptions: beforeRangePickerOptions,
afterRangePickerOptions: afterRangePickerOptions
},
subdistrict: 2,
dialogMapVisible: false,
targetItem: {},
isImgVisible: false,
dialogObj: {
url: '',
uploadType: 'img'
}
}
},
props: {
isBlock: {
type: Boolean,
default: false
},
defaultWidth: {
type: String,
default: '432px'
},
formRef: {
type: String,
default: 'formRef'
},
isEdit: {
type: Boolean,
default: false
},
labelWidth: {
type: String,
// 默认是四个字符长度
default: '154px'
},
formData: {
type: Array,
default: () => []
},
formObj: {
type: Object,
default: () => { }
},
hasTitle: {
type: Boolean,
default: true
},
formRules: {
type: Object,
default: () => { }
},
// 搜索+输入框/搜索组合组件,搜索栏绑值
searchSelectObj: {
type: Object,
default: () => { }
},
pageThat: {
type: Object,
default: () => { }
}
},
mounted() { },
methods: {
// 选择框-添加其他属性
selectAddAttr(value, targetItem) {
targetItem.changeAttr && targetItem.changeAttr(value, targetItem, this.pageThat)
},
handleInputDown(e, item) {
if (e.keyCode === 13 && item.hasOwnProperty('keyFn')) {
item.keyFn()
}
},
handleInputBlur(e, item) {
item.inputBlur && item.inputBlur(e, item)
},
// 图片
handleUploadChange(e, targetItem) {
var reader = new FileReader()
var file = e.srcElement.files[0]
var uploadType = targetItem.uploadType || 'img'
var IMGTYPE = ['image/jpeg', 'image/png', 'image/jpg']
if (targetItem.supportGif) IMGTYPE.push('image/gif')
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
const isType = uploadType == 'img' ? IMGTYPE.includes(file.type) : ['video/mp4'].includes(file.type)
const maxPhotoNum = targetItem.maxPhotoNum || 1
const wdithLt = targetItem.wdithLt || 300
const heightLt = targetItem.heightLt || 300
if (Array.isArray(this.formObj[targetItem.name]) && maxPhotoNum == this.formObj[targetItem.name].length) {
this.$message.error('只能上传' + maxPhotoNum + (uploadType == 'img' ? '张图片' : '个视频'))
document.getElementById(targetItem.name + 'file').value = ''
return true
}
if (!isType) {
this.$message.error(uploadType == 'img' ? '上传图片不是jpg、jpeg或png的格式!' : '上传视频不是MP4的格式!')
document.getElementById(targetItem.name + 'file').value = ''
return true
}
if (!isLt) {
this.$message.error('上传' + (uploadType == 'img' ? '图片' : '视频') + '大小不能超过' + limitSize + 'MB!')
document.getElementById(targetItem.name + 'file').value = ''
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
if (uploadType == 'img') {
var image = new Image()
image.src = e.target.result
image.onload = () => {
var imgWidth = image.width
var imgHeight = image.height
if (targetItem.hasPixel && (imgWidth > wdithLt || imgHeight > heightLt)) {
this.$message.error('图片尺寸最大为' + wdithLt + '像素*' + heightLt + '像素')
} else {
targetItem.handleUpload(e, file, targetItem, this.formObj)
}
}
} else {
targetItem.handleUpload(e, file, targetItem, this.formObj)
}
}
document.getElementById(targetItem.name + 'file').value = ''
},
// 图片删除
handleImgDelete(targetItem, subIndex = -1) {
Array.isArray(this.formObj[targetItem.name]) ? this.formObj[targetItem.name].splice(subIndex, 1) : (this.formObj[targetItem.name] = '')
targetItem.handleDelete && targetItem.handleDelete(subIndex)
// this.$emit('handleImgDelete', targetItem)
},
// 图片查看
handleImgLook(src, targetItem) {
this.isImgVisible = true
this.dialogObj = {
url: src,
uploadType: targetItem.uploadType || 'img'
}
},
// 获取富文本框内容
handleTextBoxChange(val, targetItem) {
this.formObj[targetItem.name] = val
},
handleTextBoxFocus(targetItem) {
this.$refs[targetItem.name + 'TextBox'][0].setEdit(this.formObj[targetItem.name])
},
// 禁用富文本
forbidEdit() {
this.$refs.textBox.forbidEdit()
},
// 地图
handleSelectMap(targetItem) {
this.targetItem = targetItem
this.dialogMapVisible = true
this.$nextTick(() => {
if (this.formObj[targetItem.attrObj.fullAddress] && !this.$refs.mapForm.address) {
this.$refs.mapForm.address = this.formObj[targetItem.attrObj.fullAddress]
this.$refs.mapForm.lnglat = this.formObj[targetItem.attrObj.lng] ? [this.formObj[targetItem.attrObj.lng], this.formObj[targetItem.attrObj.lat]] : []
// this.$refs.mapForm.addMarker([this.formObj[targetItem.attrObj.lng], this.formObj[targetItem.attrObj.lat]])
}
})
},
getAddress() {
const mapInfo = this.$refs.mapForm
if (!mapInfo.address) {
this.$message({
message: '请选择地址',
type: 'error',
customClass: 'message-Z-zinde'
})
return
}
this.formObj[this.targetItem.attrObj.fullAddress] = mapInfo.address
this.formObj[this.targetItem.attrObj.lat] = mapInfo.lnglat[1]
this.formObj[this.targetItem.attrObj.lng] = mapInfo.lnglat[0]
// var fullAddress = mapInfo.geocoderAddress.addressComponent || this.formObj[this.targetItem.attrObj.fullAddress]
var fullAddress = mapInfo.geocoderAddress.addressComponent
// if (!fullAddress) {
// this.dialogMapVisible = false
// return
// }
var provincecode = mapInfo.geocoderAddress.adcode || this.formObj[this.targetItem.attrObj.provinceCode]
this.formObj[this.targetItem.attrObj.provinceCode] = provincecode
// 获取省市
var province = ''
var city = ''
province = fullAddress.province
city = fullAddress.city ? fullAddress.city : fullAddress.district
const municipalities = ['北京市', '天津市', '上海市', '重庆市']
var municipality = municipalities.find(item => item == province)
if (municipality) {
city = city.slice(0, 2) + '城区'
if (municipality === '重庆市') {
provincecode = provincecode.slice(0, 4)
provincecode == 5001 ? (city = city.slice(0, 2) + '城区') : (city = city.slice(0, 2) + '郊县')
}
}
// 判断省市是否匹配
if (this.formObj[this.targetItem.attrObj.provinceName]) {
if (this.formObj[this.targetItem.attrObj.provinceName] !== province && this.formObj[this.targetItem.attrObj.cityName] !== city) {
this.$message({
message: '您选择的地址错误,请重新选择',
type: 'error',
customClass: 'message-Z-zinde'
})
this.formObj[this.formObj[this.targetItem.attrObj.fullAddress]] = ''
return
}
}
this.dialogMapVisible = false
this.formObj[this.targetItem.attrObj.provinceName] = province
this.formObj[this.targetItem.attrObj.cityName] = city
// 当直接点击选择地址时,获取省市ID
this.$refs.provinceForm[0].init(province, city)
},
// 获取省
handleSelectProvince(val, targetItem) {
this.formObj[targetItem.attrObj.fullAddress] = ''
this.formObj[targetItem.attrObj.cityName] = ''
this.formObj[targetItem.attrObj.provinceName] = val.provinceName
this.formObj[targetItem.attrObj.provinceCode] = val.provinceCode
},
// 获取市
handleSelectCity(val, targetItem) {
if (val.cityName) {
this.formObj[targetItem.attrObj.cityName] = val.cityName
this.formObj[targetItem.attrObj.cityCode] = val.cityCode
} else {
this.formObj[targetItem.attrObj.cityName] = ''
this.formObj[targetItem.attrObj.cityCode] = ''
}
this.formObj[targetItem.attrObj.fullAddress] = ''
}
}
}
</script>
<style>
/* .glsx-combi-form {
min-width: 922px;
} */
/* .glsx-combi-form .glsx-combi-form-block {
padding: 16px 40px 0;
} */
.glsx-combi-form .isBlock {
display: block !important;
}
/* .glsx-combi-form .el-form-item {
width: 65%;
} */
.glsx-combi-form .no-label.el-form-item--small .el-form-item__content {
width: 100%;
}
.glsx-combi-form .el-form-item--small.el-form-item {
margin: 0 30px 20px 0;
}
.glsx-combi-form .el-form-item--small .el-form-item__label {
padding: 0;
}
/* .glsx-combi-form .el-form-item--small .el-form-item__content {
width: calc(100% - 85px);
} */
.glsx-combi-form .el-col {
margin-bottom: 10px;
}
.glsx-combi-form .el-select {
width: 100%;
}
.glsx-combi-form .item-height {
height: 37px;
}
.glsx-combi-form input::-webkit-outer-spin-button,
.glsx-combi-form input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
.glsx-combi-form input[type='number'] {
-moz-appearance: textfield !important;
}
.glsx-combi-form .input-with-select .el-input-group__prepend {
background-color: #fff;
}
/* 提示图标 */
/* .glsx-combi-form .tips-block {
position: relative;
} */
.glsx-combi-form .tips-label {
margin-right: 2px;
}
.glsx-combi-form .tips-icon {
display: inline-block;
width: 14px;
height: 14px;
margin-right: 0px !important;
vertical-align: middle;
cursor: pointer;
}
.glsx-combi-form .combi-form-label {
/* display: inline-block; */
box-sizing: border-box;
}
/* 图片上传 */
.glsx-combi-form .photo-top-tips {
/* height: 36px; */
margin: 0 0;
color: #999999;
}
.glsx-combi-form .img-w-h {
width: 80px;
height: 80px;
}
.glsx-combi-form .activity-img {
position: relative;
color: #999999;
background-color: #f7f7f7;
border: 1px dotted #d9d9d9;
cursor: pointer;
margin-top: 10px;
}
.glsx-combi-form .activity-Input {
position: absolute;
top: 0;
left: 0;
}
.glsx-combi-form .muti-imgs {
display: inline-block;
position: relative;
margin: 10px 8px 0 0;
}
.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%);
font-size: 14px;
width: 100%;
text-align: center;
}
.muti-imgs .img-btns {
display: none;
height: 100%;
position: absolute;
width: 80px;
height: 80px;
left: 0;
top: 0;
z-index: 2;
color: #fff;
background: rgba(0, 0, 0, 0.5);
}
.glsx-combi-form .el-icon-delete,
.glsx-combi-form .el-icon-zoom-in {
cursor: pointer;
}
.muti-imgs .img-btns .btn-item {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.muti-imgs .img-btns .btn-item {
display: flex;
width: 70%;
justify-content: space-around;
}
.muti-imgs:hover .img-btns {
display: block;
}
.glsx-combi-form .dialog-img {
width: 100%;
height: 100%;
}
.glsx-combi-form .dialog-look {
text-align: center;
}
.glsx-combi-form .dialog-video {
width: 50%;
height: 50%;
}
/* 图片上传 */
.glsx-combi-form .el-tag.el-tag--info .el-tag__close {
color: #e8e8ea;
background-color: #5850ff !important;
}
.glsx-combi-form .el-tag.el-tag--info {
border-color: #5850ff;
}
.glsx-combi-form .el-tag--plain.el-tag--info .el-tag__close:hover {
background-color: #e8e8ea;
}
.glsx-combi-form .el-tag.el-tag--info .el-tag__close:hover {
background-color: #e8e8ea;
}
.textBox .el-form-item__content {
width: 62%;
/* background: #096; */
}
</style>
<template>
<div class="map-box" :style="{ height: mapHeight + 'px', width: mapWidth + 'xp' }">
<div id="container">
<el-select v-model="input" class="map-input" filterable remote reserve-keyword placeholder="请输入" :remote-method="remoteMethod" @change="handleChangeAdr" :loading="loading">
<el-option v-for="item in adrList" :key="item.id" :label="item.address" :value="item.id"></el-option>
</el-select>
</div>
<div class="map-address">
<img class="icon-map" src="./images/icon-map.png" />
{{ address }}
</div>
</div>
</template>
<script>
let map, marker, placeSearch
export default {
name: 'map',
props: {
mapHeight: {
type: Number,
default: 460
},
mapWidth: {
type: Number,
default: 740
}
},
data() {
return {
input: [],
address: '',
adrList: [],
lnglat: [],
geocoderAddress: {}
}
},
mounted() {
this.mapInit()
},
methods: {
// initMap() {
// console.log(document.getElementsByTagName('head'))
// var script = document.createElement('script')
// script.type = 'text/javascript'
// script.src = 'https://webapi.amap.com/loader.js'
// document.getElementsByTagName('head')[0].appendChild(script)
// },
mapInit() {
/* eslint-disable */
AMapLoader.load({
/* eslint-enable */
key: '44cc16e43ad7ed3358df507bd0618181', // 申请好的Web端开发者Key,首次调用 load 时必填
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
// 需要使用的的插件列表
plugins: ['AMap.ToolBar', 'AMap.Scale', 'AMap.Geocoder'],
AMapUI: {
// 是否加载 AMapUI,缺省不加载
version: '1.1', // AMapUI 版本
plugins: ['overlay/SimpleMarker'] // 需要加载的 AMapUI ui插件
},
Loca: {
// 是否加载 Loca, 缺省不加载
version: '2.0' // Loca 版本
}
})
.then(AMap => {
map = new AMap.Map('container', {
zoom: 20,
autoFitView: true,
resizeEnable: true,
cursor: 'move'
})
if (this.lnglat.length) {
this.addMarker(this.lnglat)
}
map.addControl(new AMap.Scale())
map.addControl(new AMap.ToolBar())
this.geocoder = new AMap.Geocoder()
map.setDefaultCursor('pointer')
AMap.plugin(['AMap.PlaceSearch'], function () {
//构造地点查询类
placeSearch = new AMap.PlaceSearch({
pageSize: 8, // 单页显示结果条数
pageIndex: 1, // 页码
citylimit: false, //是否强制限制在设置的城市内搜索
// panel: "panel", // 结果列表将在此容器中进行展示。
autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
renderStyle: 'default'
})
})
map.on('click', this.getAddress)
})
.catch(e => {
console.error(e) //加载错误提示
})
},
remoteMethod(query) {
if (query == '') {
return true
}
let _this = this
placeSearch.search(query, function (status, result) {
if (status === 'complete' && result.poiList.pois.length) {
_this.adrList = result.poiList.pois
}
})
},
addMarker(lnglat) {
let position
if (lnglat.lng) {
position = [lnglat.lng, lnglat.lat]
} else {
position = lnglat
}
this.lnglat = position
marker = new AMap.Marker({
map: map,
icon: new AMap.Icon({
image: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
size: new AMap.Size(27, 34), //图标大小
imageSize: new AMap.Size(27, 34)
}),
// draggable: true,
position: position,
offset: new AMap.Pixel(-10, -10)
})
map.setCenter(position)
map.add(marker)
marker.setMap(map)
// this.map.setFitView()
},
getAddress(e) {
let self = this
let position
if (e.type == 'click') {
position = e.lnglat
} else {
let { lng, lat } = e
position = [lng, lat]
}
if (marker) {
map.remove(marker)
marker.setMap(null)
marker = null
}
self.addMarker(position)
AMap.plugin('AMap.Geocoder', () => {
const geocoder = new AMap.Geocoder()
geocoder.getAddress(position, (status, result) => {
self.address = result.regeocode.formattedAddress
geocoder.getLocation(self.address, (status, result) => {
if (status === 'complete' && result.info === 'OK') {
self.geocoderAddress = result.geocodes[0]
}
})
})
})
},
handleChangeAdr(val) {
if (val) {
var location = this.adrList.find(item => item.id == val)
this.getAddress(location.location)
this.input = ''
this.adrList = []
}
}
}
}
</script>
<style scoped lang="scss">
.map-box {
display: flex;
#container {
position: relative;
width: calc(100% - 284px - 16px);
height: 100%;
}
.map-input {
position: absolute;
top: 32px;
width: 60%;
left: 25%;
z-index: 2;
}
}
#panel {
position: absolute;
max-height: 90%;
overflow-y: auto;
top: 80px;
right: 10px;
width: 280px;
}
.map-address {
display: flex;
box-sizing: border-box;
width: 284px;
height: 100%;
background-color: #f9f9f9;
padding: 20px;
margin-left: 16px;
line-height: 20px;
.icon-map {
width: 16px;
height: 16px;
margin-right: 6px;
}
}
</style>
\ No newline at end of file
<template>
<div v-if="provinceView">
<el-form ref="provinceForm" :model="provinceForm" inline="true" class="province" style="padding-left: 0;">
<el-select size="small" v-model="provinceForm.provinceName" clearable :disabled="isDisabled" placeholder="选择省份" :style="{ width: defaultWidth }" @change="selectProvince" class="select-padding">
<el-option v-for="item in AllData" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectProvince(item)"></el-option>
</el-select>
<el-select size="small" v-model="provinceForm.cityName" clearable :disabled="isDisabled" placeholder="选择市" :style="{ width: defaultWidth }" @change="selectCity" class="select-padding">
<el-option v-for="item in cityList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectCity(item)"></el-option>
</el-select>
<el-select v-if="subdistrict == 3" size="small" v-model="provinceForm.townName" clearable :disabled="isDisabled" placeholder="选择区" :style="{ width: defaultWidth }" @change="selectTown" class="select-padding">
<el-option v-for="item in townList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectTown(item)"></el-option>
</el-select>
</el-form>
</div>
</template>
<script>
export default {
name: 'GLProvince',
props: {
// 省市级别,2--只显示省市,3--显示省市区,默认只显示省市
subdistrict: {
type: Number,
default: 2
},
// 省市下拉组件宽度
defaultWidth: {
type: String,
default: '150px'
},
// 组件是否展示,默认展示
provinceView: {
type: Boolean,
default: true
},
isDisabled: {
type: Boolean,
default: false
}
},
data() {
return {
// 所有数据
AllData: [],
// 城市列表
cityList: [],
// 地区列表
townList: [],
provinceForm: {
// 省份名称
provinceName: '',
// 城市名称
cityName: '',
// 地区名称
townName: '',
// 省份代码
provinceCode: '',
// 城市代码
cityCode: '',
// 地区代码
townCode: ''
}
}
},
mounted() {
this.provinceList()
},
methods: {
/*
* @params:传入的为一个key-value的对象
1、keywords --查询关键字,只支持单个关键词语搜索关键词支持:行政区名称、citycode、adcode
列如:this.provinceList({keywords: '山东省'}),这样就可以筛选出山东省下的市、区信息
2、subdistrict --设置显示下级行政区级数,0:不返回下级行政区;1:返回下一级行政区;2:返回下两级行政区;3:返回下三级行政区;
不传的话默认为2,可以在组件中穿,也可以在调用方法的时候传,如果需要展示省市组件,传值最小为2
3、page --最外层的districts最多会返回20个数据,若超过限制,请用page请求下一页数据。
例如page=2;page=3。默认page=1
4、extensions --控制行政区信息中返回行政区边界坐标点; 可选值:base、all;
base:不返回行政区边界坐标点;(默认)
all:只返回当前查询district的边界值,不返回子节点的边界值;目前不能返回乡镇/街道级别的边界值
5、filter -- 按照指定行政区划进行过滤,填入后则只返回该省/直辖市信息,需填入adcode,为了保证数据的正确,强烈建议填入此参数
6、callback -- callback值是用户定义的函数名称,此参数只在output=JSON时有效
7、output --返回数据格式类型,可选值:JSON,XML(默认JSON)
* @return:返回的是一个promise对象,如果不需要展示组件,只需要获取值,可以直接调用方法,异步获取返回值
列如:
const p = this.$refs.provinceForm.provinceList({xxxx(可传值,传值可参考上文params描述) })
p.then(r => {
// r 为返回结果
console.log(r)
})
**/
// 获取省市信息
provinceList(params = {}) {
params ? (params.subdistrict ? '' : (params.subdistrict = this.subdistrict)) : (params.subdistrict = this.subdistrict)
let data = ''
for (let key in params) {
data += '&' + key + '=' + params[key]
}
let path = `https://restapi.amap.com/v3/config/district?key=d22348363c34c266f772ae9b635eef2a`
path = path + data
const pro = fetch(path).then(res => {
return res.json()
})
if (this.provinceView) {
pro.then(r => {
this.AllData = r.districts[0].districts
})
}
return pro
},
// 省市回显
init(province, city, town) {
this.provinceForm = {
provinceName: province,
cityName: city,
townName: town
}
if (province) {
this.AllData.map(item => {
if (item.name.indexOf(province) != -1) {
this.provinceForm.provinceName = item.name
this.cityList = item.districts
this.provinceForm.provinceCode = item.adcode
if (city) {
this.cityList.map(itm => {
if (itm.name.indexOf(city) != -1) {
this.provinceForm.cityCode = itm.adcode
this.provinceForm.cityName = itm.name
this.townList = itm.districts
if (town) {
this.townList.map(itmx => {
if (itmx.name.indexOf(town) != -1) {
this.provinceForm.townCode = itmx.adcode
this.provinceForm.townName = itmx.name
}
})
}
}
})
}
}
})
}
},
// 选择省
selectProvince(val) {
this.provinceForm.cityName = ''
this.provinceForm.townName = ''
this.cityList = val.districts
this.$emit('selectProvince', { provinceName: val.name, provinceCode: val.adcode })
},
// 选择市
selectCity(val) {
this.provinceForm.townName = ''
this.townList = val.districts
this.$emit('selectCity', { cityName: val.name, cityCode: val.adcode })
},
// 选择区
selectTown(val) {
this.$emit('selectTown', { townName: val.name, townCode: val.adcode })
}
}
}
</script>
<style lang="scss">
.province {
display: inline-flex;
.el-select .el-input {
width: auto !important;
}
}
.select-padding {
margin-right: 10px;
}
</style>
<template>
<div>
<div id="div-demo"></div>
</div>
</template>
<script>
import E from 'wangeditor'
export default {
name: 'textBox',
data() {
return {
editor: '',
content: '',
editorOption: {}
}
},
props: {
excludeMenus: {
type: Array,
default: () => ['code']
},
boxHeight: {
type: Number,
default: 240
}
},
mounted() {
this.getEdit()
},
methods: {
getEdit() {
const _this = this
this.editor = new E('#div-demo')
this.editor.config.uploadImgShowBase64 = true
this.editor.config.showMenuTooltips = true
this.editor.config.menuTooltipPosition = 'down'
this.editor.config.height = this.boxHeight
this.editor.config.width = 500
this.editor.config.excludeMenus = this.excludeMenus
this.editor.config.onchange = html => {
// console.log(html);
this.content = html // 绑定当前逐渐地值
this.$emit('change', this.content) // 将内容同步到父组件中
}
this.editor.config.onfocus = () => {
this.$emit('focus')
}
// 上传图片
this.editor.config.customUploadImg = function(resultFiles, insertImgFn) {
var file = resultFiles[0]
var reader = new FileReader()
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
_this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
_this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
// console.log(res)
insertImgFn(res)
}
})
// resultFiles 是 input 中选中的文件列表
// insertImgFn 是获取图片 url 后,插入到编辑器的方法
// 上传图片,返回结果,将图片插入到编辑器中
}
}
// 上传视频
this.editor.config.customUploadVideo = function(resultFiles, insertVideoFn) {
var file = resultFiles[0]
var reader = new FileReader()
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
_this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const videoFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + videoFile.split(',')[1]
_this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
// console.log(res)
insertVideoFn(res)
}
})
// resultFiles 是 input 中选中的文件列表
// insertImgFn 是获取图片 url 后,插入到编辑器的方法
// 上传图片,返回结果,将图片插入到编辑器中
}
}
this.editor.config.onchangeTimeout = 5000
this.editor.create()
},
setEdit(html) {
this.$nextTick(() => {
this.editor.txt.html(html)
})
},
forbidEdit() {
// this.editor.$textElem.attr('contenteditable', false)
this.editor.disable()
}
}
}
</script>
<style lang="scss" scoped>
#div-demo {
// margin: 16px 300px 0 0;
}
.el-form .editor {
margin-top: 20px;
}
.myQuillEditor {
background-color: #fff;
height: 200px;
}
</style>
<style>
.w-e-text-container {
z-index: 1 !important;
}
.w-e-toolbar {
z-index: 2 !important;
}
</style>
<!-- 弹窗 -->
<template>
<div>
<el-dialog
:title="title"
:visible.sync="isVisible"
:show-close="showClose"
:before-close="handleClose"
:close-on-click-modal="false"
:modal-append-to-body="false"
:width="width"
class="app-dialog"
>
<el-scrollbar v-if="hasScroll">
<span slot="title">
<span class="main-title"></span>
<span class="dialog-sub-title">
<slot name="sub-title"></slot>
</span>
</span>
<slot></slot>
</el-scrollbar>
<template v-if="!hasScroll">
<span slot="title">
<span class="main-title"></span>
<span class="dialog-sub-title">
<slot name="sub-title"></slot>
</span>
</span>
<slot></slot>
</template>
<div slot="footer">
<slot name="btn-start"></slot>
<el-button
:type="typeName"
v-if="!noClose"
:size="btnSize"
@click="handleClose"
></el-button>
<el-button
type="default"
v-if="!noCancel"
:size="btnSize"
@click="handleClose"
></el-button>
<el-button
type="primary"
v-if="!noBtnOk"
:size="btnSize"
@click="handleConfirm"
></el-button>
<slot name="btn-middle"></slot>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'glsx-dialog',
data() {
return {}
},
props: {
hasScroll: {
type: Boolean,
default: true
},
title: {
type: String,
default: ''
},
isVisible: {
type: Boolean,
default: false
},
showClose: {
type: Boolean,
default: false
},
btnCloseLabel: {
type: String,
default: '关闭'
},
btnOkLabel: {
type: String,
default: '确定'
},
btnCancelLabel: {
type: String,
default: '取消'
},
noBtnOk: {
type: Boolean,
default: false
},
noCancel: {
type: Boolean,
default: false
},
noClose: {
type: Boolean,
default: true
},
typeName: {
type: String,
default: 'default'
},
width: {
type: String,
default: '580px'
},
btnSize: {
type: String,
default: 'small'
}
},
methods: {
handleClose() {
this.$emit('closeDialog')
},
handleConfirm() {
this.$emit('confirmDialog')
}
}
}
</script>
<style lang="scss">
.dialog-sub-title {
font-size: 12px;
color: #666666;
}
</style>
<!-- 表单 -->
<template>
<div class="d2-form d2-container-content">
<el-form :model="formData"
:rules="rules"
:ref="formRef + 'd2FormRuleForm'">
<slot name="title" />
<div v-for="(i, idx) in formList"
:key="idx"
class="d2-form-block">
<p v-show="i.title"
class="edit-sub-title">
{{ i.title }}
</p>
<span v-if="i.headImg">
<img v-show="formData[i.headImg.attr]"
class="commodity-img"
:src="formData[i.headImg.attr]"
alt="图片">
<span v-show="!formData[i.headImg.attr]">
<img class="commodity-img"
src="./image/no-choice.png">
</span>
</span>
<div
:style="{'width': i.headImg ? 'calc(100% - 220px)' : '100%', 'display': 'inline-block'}">
<div v-for="(item, index) in i.formBlock"
:key="index"
:style="{'width': i.width || '100%', 'display': 'inline-block'}">
<el-form-item :prop="item.name"
:label="item.label ? item.label + ':' : ''"
:id="item.name"
:label-width="item.label ? '120px' : '0px'"
class="dis-in-block"
:style="{'margin-bottom': !item.type ? '0px' : '22px'}">
<el-input v-if="item.type === 'input'"
v-model.trim="formData[item.name]"
:placeholder="item.label"
:maxlength="item.maxlength"
:style="{'width': item.width || formItemWidth}"
:disabled="item.isDisabled"
clearable
@input="input($event,item)"
@blur="blur(item)">
<!-- @blur="item.handleBlur" -->
<i slot="suffix"
class="suffix">{{ item.unit }}</i>
</el-input>
<el-input class="desc-input"
v-if="item.type === 'textarea'"
type="textarea"
v-model.trim="formData[item.name]"
:placeholder="item.label"
:rows="4"
:maxlength="item.maxlength"
show-word-limit />
<!-- 选择框 -->
<el-select v-else-if="item.type === 'select'"
v-model="formData[item.name]"
:clearable="item.isClear"
:placeholder="'请选择' + item.label"
@change="selectAddAttr($event, item)"
:style="{'width': item.width || formItemWidth}"
filterable
:disabled="item.isDisabled">
<el-option v-for="subItem in item.optionList"
:key="subItem[item.optionId]"
:label="subItem[item.optionLabel]"
:value="subItem[item.optionId]" />
</el-select>
<!-- 可添加选项选择框 -->
<el-select v-else-if="item.type === 'special-select'"
v-model="formData[item.name]"
:clearable="item.isClear"
:placeholder="'请选择' + item.label"
:style="{'width': item.width || formItemWidth}"
@change="selectAddAttr($event, item)"
@blur="selectBlur"
@focus="selectFocus"
filterable
:disabled="item.isDisabled">
<el-option v-for="(subItem, subIndex) in item.optionList"
:key="subItem[item.optionId]"
:label="subItem[item.optionLabel]"
:value="subItem[item.optionId]">
<!-- 供应方 -->
<div class="flex-option"
v-if="item.partitionFlag == 1">
<el-input v-show="editOptionIndex == subIndex"
:maxlength="10"
class="add-option-input"
:autofocus="true"
@click.stop.native="editOptionFocus"
v-model.trim="editOptionValue"
size="small"
placeholder="请输入" />
<span v-show="editOptionIndex == -1 || editOptionIndex != subIndex"
class="add-option-input">{{ subItem[item.optionLabel] }}</span>
<div>
<i v-show="item.optionList.length > 1 && (editOptionIndex != subIndex)"
class="el-icon-edit edit_icon"
@click.stop="editOption(subIndex, subItem[item.optionLabel], item.partitionFlag)" />
<i v-show="item.optionList.length > 1 && editOptionIndex == subIndex"
class="el-icon-check option_icon add_icon"
@click.stop="editOptionConfirm(subItem[item.optionId], index, item.partitionFlag)" />
<i v-if="item.optionList.length > 1"
class="el-icon-close del_icon"
@click.stop="delOption(subItem[item.optionId], index, item.partitionFlag, item)" />
</div>
</div>
<!-- 服务方 -->
<div class="flex-option"
v-else>
<el-input v-show="editOptionIndex == subIndex"
:maxlength="10"
class="add-option-input"
:autofocus="true"
@click.stop.native="editOptionFocus"
v-model.trim="editOptionValue"
size="small"
placeholder="请输入" />
<span v-show="editOptionIndex == -1 || editOptionIndex != subIndex"
class="add-option-input">{{ subItem[item.optionLabel] }}</span>
<div>
<i v-show="subItem[item.optionId] !== 12 && subItem[item.optionId] !== 13 && (editOptionIndex != subIndex)"
class="el-icon-edit edit_icon"
@click.stop="editOption(subIndex, subItem[item.optionLabel], item.partitionFlag)" />
<i v-show="subItem[item.optionId] !== 12 && subItem[item.optionId] !== 13 && editOptionIndex == subIndex"
class="el-icon-check option_icon add_icon"
@click.stop="editOptionConfirm(subItem[item.optionId], index, item.partitionFlag)" />
<i v-if="subItem[item.optionId] !== 12 && subItem[item.optionId] !== 13"
class="el-icon-close del_icon"
@click.stop="delOption(subItem[item.optionId], index, item.partitionFlag, item)" />
</div>
</div>
</el-option>
<div class="add-option">
<div v-if="showOptionInput"
class="flex-option">
<el-input class="add-option-input"
:maxlength="10"
v-model.trim="addOptionValue"
size="small"
placeholder="请输入" />
<div>
<i v-if="addOptionValue"
class="el-icon-check option_icon add_icon"
@click.stop="addOptionConfirm(item.partitionFlag)" />
<i class="el-icon-close option_icon del_icon"
@click.stop="delOption(undefined)" />
</div>
</div>
<div style="display: flex;align-items: center;">
<i class="el-icon-circle-plus-outline"
style="color: #2A58AD;font-size: 20px;margin-right: 3px;" />
<el-button type="text"
@click.stop="addOption">新增一项</el-button>
</div>
</div>
</el-select>
<template v-else-if="item.type === 'button'">
<div v-if="item.name === 'linkMerchants'">
<div class="add-btns">
<el-button type="primary"
@click="handleClick(item.handleName)">
{{ item.btnTxt }}
</el-button>
<span>已为该商品组合分配<span
class="relate-btn-txt">{{ formData[item.name] ? formData[item.name].length : 0 }}</span>家可见店铺</span>
</div>
<el-table :data="formData[item.name]"
style="width: 690px"
border
class="store-table">
<el-table-column label="序号"
align="center"
type="index"
width="64px" />
<el-table-column prop="yqMerchantName"
label="园区店名称"
align="center" />
<el-table-column prop="merchantName"
label="4s店名称"
align="center" />
<el-table-column prop="merchantId"
label="商户编号"
align="center" />
<el-table-column prop="userType"
label="商户类型"
align="center">
<template slot-scope="scope">
<span>{{ baseData[scope.row.channelType === 2 ? 'ghUserTypeList' : 'userTypeList'][scope.row.userType] }}</span>
</template>
</el-table-column>
<el-table-column label="删除"
align="center">
<template slot-scope="scope">
<el-button class="el-icon-delete"
@click="handleDelete(item, scope.row)"
type="text" />
</template>
</el-table-column>
</el-table>
</div>
</template>
<template v-else-if="item.type === 'relatePro'">
<div class="add-btns">
<el-button type="primary"
:disabled="!formData.goodsCode"
@click="handleAddPro(item)">
添加绑定
</el-button>
<span>已将基础商品绑定<span
class="relate-btn-txt">{{ formData[item.name] ? formData[item.name].length : 0 }}</span>件升级商品</span>
</div>
<div v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
style="margin-bottom: 30px;">
<p class="pro-block">
<span class="el-icon-delete pro-delete"
@click="handleDelete(item, subItem, subIndex)" />
<span class="el-icon-edit-outline pro-edit"
@click="handleProChange(item, subItem, subIndex)" />
<img :src="subItem.thumbUrl">
<span class="pro-detail pro-detail-txt">
<p class="pro-name"
:title="subItem.goodsName">{{ subItem.goodsName }}</p>
<div class="pro-type">
<span>{{ subItem.goodsTypeName }}</span>
<span class="pro-sap">{{ subItem.sapCode }}</span>
<div class="pro-price-block">
<p>建议升级价格:<span class="pro-price">{{ subItem.upgradePrice }}</span>元</p>
<p v-show="warrantyProList.includes(subItem.goodsType)">质保年限:<span
class="pro-price">{{ subItem.warrantyPeriod ? (subItem.warrantyPeriod + '年') : '无' }}</span>
</p>
</div>
</div>
</span>
</p>
</div>
</template>
<template v-else-if="item.type === 'photo'">
<p class="photo-top-tips">
{{ item.topTips }}
</p>
<div v-if="(formData[item.name] && formData[item.name].length) < item.maxPhotoNum"
class="activity-img img-w-h">
<div class="add">
+
</div>
<span
class="number">{{ formData[item.name].length }}/{{ item.maxPhotoNum }}</span>
<input type="file"
name="thumbUrl"
:id="item.name + 'file'"
ref="file"
class="activity-img img-w-h"
accept="image/png, image/jpeg, image/gif, image/jpg"
@change="e => handleImgChange(e, item)"
style="opacity: 0;">
</div>
<template>
<div v-if="formData[item.name] && formData[item.name].length">
<span v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
class="muti-imgs img-w-h">
<img class="img-w-h"
:src="subItem.content">
<span class="img-btns">
<span class="btn-item">
<i @click="handleImgDelete(item, subIndex)"
class="el-icon-delete" />
<i @click="handleImgLook(subItem.content, item)"
class="el-icon-zoom-in" />
</span>
</span>
</span>
</div>
</template>
</template>
<template v-else-if="item.type === 'video'">
<p class="photo-top-tips">
{{ item.topTips }}
</p>
<div v-if="(formData[item.name] && formData[item.name].length) < item.maxPhotoNum"
class="activity-img img-w-h">
<div class="add">
+
</div>
<span
class="number">{{ formData[item.name].length }}/{{ item.maxPhotoNum }}</span>
<input type="file"
style="opacity: 0"
:id="item.name + 'file'"
ref="file"
class="activity-img img-w-h"
:style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''"
accept="video/mp4"
@change="e => handleVideoChange(e, item)">
</div>
<template>
<div v-if="formData[item.name] && formData[item.name].length">
<span v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
class="muti-imgs img-w-h">
<video class="img-w-h activity-img"
:style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''"
:src="typeof subItem == 'object' ? subItem.content : subItem" />
<span class="img-btns">
<span class="btn-item">
<i @click="handleImgDelete(item, subIndex)"
class="el-icon-delete" />
<i @click="handleImgLook(subItem.content, item)"
class="el-icon-zoom-in" />
</span>
</span>
</span>
</div>
</template>
</template>
<template v-else-if="item.type === 'descList'">
<el-row class="desc-btns">
<el-button size="small"
@click="handleAddDesc(2, item)">
添加文字
</el-button>
<el-button size="small"
@click="handleAddDesc(1, item)">
添加图片
</el-button>
</el-row>
<el-row v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex">
<div style="position: relative;"
v-if="subItem.resType === 2">
<el-input class="desc-input"
type="textarea"
v-model.trim="subItem.content"
:rows="4"
maxlength="256"
placeholder="请输入详情内容" />
<i class="el-icon-delete desc-txt-delete"
@click="handleImgDelete(item, subIndex)" />
</div>
<div class="activity-img muti-imgs img-w-h"
v-else-if="subItem.resType === 1">
<div v-show="!subItem.content"
class="add">
+
</div>
<img v-show="subItem.content"
class="img-w-h"
:src="subItem.content">
<span class="img-btns"
v-show="subItem.content">
<span class="btn-item">
<i @click="handleImgDelete(item, subIndex)"
class="el-icon-delete" />
<i @click="handleImgLook(subItem.content)"
class="el-icon-zoom-in" />
</span>
</span>
<input type="file"
class="activity-Input img-w-h"
accept="image/png, image/jpeg, image/gif, image/jpg"
@change="e => handleImgChange(e, item, subIndex)"
style="opacity: 0;">
</div>
</el-row>
</template>
<span v-else>{{ item.name ? formData[item.name] : item.value }}</span>
</el-form-item>
<div v-show="item.tips"
class="item-tips">
<template v-if="Array.isArray(item.tips)">
<p v-for="(x, y) in item.tips"
:key="y">
{{ x }}
</p>
</template>
<span v-else>{{ item.tips }}</span>
</div>
</div>
</div>
</div>
<el-form-item style="margin-top: 40px;text-align: center;">
<el-button type="primary"
@click="handleUp"
class="ok-btn">
提交
</el-button>
<el-button class="cancel-btn"
@click="handleClose">
取消
</el-button>
</el-form-item>
</el-form>
<relate-pro-dialog v-if="relateProVisible"
:relate-pro-visible="relateProVisible"
:pro-list="proList"
:origin-pro-info="originProInfo"
@handleRelateProConfirm="handleRelateProConfirm"
@handleRelateProClose="handleRelateProClose" />
<relate-store-dialog v-if="relateStoreVisible"
ref="formRelateStore"
:relate-store-visible="relateStoreVisible"
:source-page="sourcePage"
:store-api="storeApi"
:store-search-form="storeSearchForm"
:store-selected="storeSelected"
@handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose">
<el-row slot>
<el-form :model="storeSearchForm"
:rules="rules"
ref="relate"
:inline="true">
<el-form-item label="园区店:">
<el-input v-model.trim="storeSearchForm.yqMerchantName"
placeholder="园区店名称"
@keydown.native="handleStoreInput"
clearable />
</el-form-item>
<el-form-item label="4S店:">
<el-input v-model.trim="storeSearchForm.merchantName"
placeholder="4S店名称"
@keydown.native="handleStoreInput"
clearable />
</el-form-item>
<el-button type="primary"
@click="handleSearchStore">
搜索
</el-button>
</el-form>
</el-row>
</relate-store-dialog>
<el-dialog :visible.sync="lookImgVisible">
<video v-if="dialogObj.uploadType == 'video'"
class="dialog-video"
style="width: 100%;height: 100%;"
controls>
<source :src="dialogObj.url"
type="video/mp4">
</video>
<img v-else
width="100%"
:src="dialogObj.url"
alt="图片">
</el-dialog>
</div>
</template>
<script>
import relateProDialog from './relateProDialog'
import relateStoreDialog from './relateStoreDialog'
import { userType, ghUserType, warrantyProList } from '@/utils/constants'
import { limitPrice } from '@/common/format'
const SESSION_NAME = `${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_APP_VERSION}-info`
export default {
name: 'D2Form',
data() {
return {
userInfo:{detail:{}},
warrantyProList,
merchantDisable: false,
storeSearchForm: {
yqMerchantName: '',
merchantName: ''
},
// 关联商品弹窗
relateProVisible: false,
relateStoreVisible: false,
lookImgVisible: false,
imageUrl: '',
storeSelected: [],
sourcePage: 'editProduct',
proIndex: -1,
proList: [],
formData: {},
separateOpt: [{
confId: 1,
confLabel: '毛利'
}, {
confId: 2,
confLabel: '收入'
}],
profitOldVal: [],
// parkServiceList: [],
baseData: {
userTypeList: userType,
ghUserTypeList: ghUserType
},
showOptionInput: false,
addOptionValue: '',
editOptionValue: '',
editOptionIndex: -1,
selectedValue: '',
dialogObj: {
url: '',
uploadType: ''
}
}
},
props: {
// add - 新增;edit - 编辑
addOrEdit: {
type: String,
default: 'add'
},
headImg: {
type: Object,
default: () => {
return {
isHas: false,
attr: ''
}
}
},
formItemWidth: {
type: String,
default: '100%'
},
rules: {
type: Object,
default: () => { }
},
formRef: {
type: String,
default: ''
},
originData: {
type: Object,
default: () => {
return {}
}
},
formList: {
type: Array,
default: () => { }
},
storeApi: {
type: Function,
default: () => { }
},
formName: {
type: String,
default: () => { }
}
},
components: {
relateProDialog,
relateStoreDialog
},
watch: {
originData: {
handler(newVal) {
if (newVal) {
this.formData = this.$common.utils.deepClone(this.originData)
}
},
deep: true
}
},
mounted() {
this.formData = this.$common.utils.deepClone(this.originData)
// if (this.userInfo.beSuper) {
// getParkStore({}).then(res => {
// this.parkServiceList = res
// })
// } else {
this.formData.merchantId = this.userInfo.detail.merchantId
// }
if (this.formData.hasOwnProperty('upgradeGoods')) {
this.merchantDisable = this.addOrEdit === 'edit'
this.profitOldVal = this.formData.upgradeGoods.map(item => item.profitValue)
// this.getGoodsList()
}
this.$nextTick(() => {
this.$refs[this.formRef + 'd2FormRuleForm'].clearValidate()
})
},
methods: {
selectBlur() {
this.editOptionIndex = -1
this.showOptionInput = false
},
selectFocus() {
this.editOptionIndex = -1
this.showOptionInput = false
},
addOption() {
this.showOptionInput = true
this.addOptionValue = ''
},
addOptionConfirm(partitionFlag) {
const data = {
relatedPartyName: this.addOptionValue,
partitionFlag: partitionFlag,
createdBy: JSON.parse(unescape(sessionStorage.getItem(SESSION_NAME))).loginAccount.userName,
updatedBy: JSON.parse(unescape(sessionStorage.getItem(SESSION_NAME))).loginAccount.userName
}
this.$emit('handleAddBrandSupplyConfirm', data)
this.addOptionValue = ''
this.showOptionInput = false
},
editOption(e, value) {
this.editOptionValue = value
this.editOptionIndex = e
},
editOptionFocus(event) {
event.stopPropagation()
},
editOptionConfirm(e, index, partitionFlag) {
const data = {
relatedPartyName: this.editOptionValue,
id: e,
partitionFlag: partitionFlag
}
this.$emit('handleEditBrandSupplyConfirm', data)
this.editOptionIndex = -1
this.editOptionValue = ''
},
delOption(e, index, partitionFlag, item) {
if (e) {
const data = {
relatedPartyName: this.editOptionValue,
id: e,
partitionFlag: partitionFlag,
deletedFlag: 'Y'
}
this.formData[item.name] = ''
this.$emit('handleEditBrandSupplyConfirm', data)
} else {
this.showOptionInput = false
this.addOptionValue = ''
}
},
// 修复直接调用可以会因为没有对应方法报错的问题
input(event, item) {
// console.log(event)
// console.log(item)
item.handleInput && item.handleInput(event)
// item.handleInput()
},
blur(item) {
item.handleBlur && item.handleBlur()
},
getGoodsList() {
return new Promise(resolve => {
this.$apis.product.getGoodsList({}).then(res => {
this.proList = res
resolve()
})
})
},
clearGoodsType(item) {
this.formData[item.name] = ''
},
// 选择框-添加其他属性
selectAddAttr(value, targetItem) {
if (targetItem.name === 'goodsCode') {
var tempVal = targetItem.optionList.find(item => item.goodsCode === value)
this.formData.goodsTypeName = tempVal.goodsTypeName
this.formData.thumbUrl = tempVal.thumbUrl
this.formData.sapCode = tempVal.sapCode
}
this.selectedValue = value
this.editOptionIndex = -1
if (targetItem.name == 'sceneType') {
this.$emit('handleChangeSelect', value)
}
},
handleAddPro(targetItem) {
this.getGoodsList().then(res => {
if (!this.formData[targetItem.relateAttr]) {
this.$message({
message: '请选择基础商品',
type: 'warning',
showClose: true
})
this.jumpScroll(targetItem.relateAttr)
return true
}
this.markTarget = targetItem
var proSelectedIds = this.formData.upgradeGoods.map(item => item.goodsCode)
proSelectedIds.push(this.formData[targetItem.relateAttr])
this.proList.forEach(item => {
item.disabled = proSelectedIds.includes(item.goodsCode)
})
this.relateProVisible = true
})
},
handleProChange(item, targetItem, targetIndex) {
this.getGoodsList().then(res => {
var proSelectedIds = this.formData.upgradeGoods.map(item => item.goodsCode)
proSelectedIds.push(this.formData[item.relateAttr])
this.proList.forEach(item => {
if (proSelectedIds.includes(item.goodsCode) && (item.goodsCode !== targetItem.goodsCode)) {
item.disabled = true
} else {
item.disabled = false
}
})
this.proIndex = targetIndex
this.originProInfo = targetItem
this.relateProVisible = true
})
},
judgeIsDisable() {
if (this.addOrEdit === 'add') {
this.formList[0].formBlock[0].isDisabled = this.formData[this.markTarget.name].length
this.merchantDisable = this.formData[this.markTarget.name].length
}
},
handleRelateProConfirm(proInfo) {
if (this.proIndex !== -1) {
this.formData.upgradeGoods[this.proIndex] = proInfo
} else {
this.profitOldVal.push('0')
this.formData.upgradeGoods.push(proInfo)
this.judgeIsDisable()
}
this.handleRelateProClose()
},
handleRelateProClose() {
this.originProInfo = ''
this.proIndex = -1
this.relateProVisible = false
},
handleStoreInput(e) {
(e.keyCode === 13) && this.handleSearchStore()
},
// 门店搜索
handleSearchStore() {
this.$refs.formRelateStore.handleCurrentChange(1)
},
handleRelateStoreConfirm(selectedData) {
if (!selectedData.length) {
this.$message({
message: '请选择关联门店',
type: 'warning',
showClose: true
})
return true
}
this.$refs[this.formRef + 'd2FormRuleForm'].clearValidate('linkMerchants')
this.relateStoreVisible = false
this.formData.linkMerchants = selectedData
},
handleRelateStoreClose() {
this.relateStoreVisible = false
},
handleClick(handleName) {
switch (handleName) {
case 'relateStore':
this.storeSelected = this.$common.utils.deepClone(this.formData.linkMerchants)
// this.storeSearchForm = {
// yqMerchantId: this.formData.yqMerchantId
// }
this.relateStoreVisible = true
break
}
},
handleDelete(formItem, item, index) {
this.$confirm('是否确认解绑该关联商品?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
var formDataName = formItem.name
var filterArr = this.formData[formDataName].filter(i => i[formItem.optionValue] !== item[formItem.optionValue])
this.formData[formDataName] = filterArr
if (formItem.name === 'upgradeGoods') {
this.profitOldVal.splice(index, 1)
}
this.judgeIsDisable()
})
},
// 图片
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]
this.$apis.sysBase.uploadImg({ file: base64 }).then(res => {
this.$refs[this.formRef + 'd2FormRuleForm'].clearValidate(targetItem.name)
if (targetItem.maxPhotoNum === 1) {
this.formData[targetItem.name] = [{
content: res
}]
return true
}
if (targetItem.name === 'goodsImgList') {
this.formData[targetItem.name].push({ content: res })
} else {
this.formData[targetItem.name][subIndex].content = res
}
})
}
},
// 图片删除
handleImgDelete(targetItem, subIndex = -1) {
Array.isArray(this.formData[targetItem.name]) ? this.formData[targetItem.name].splice(subIndex, 1) : (this.formData[targetItem.name] = '')
},
// 图片查看
handleImgLook(src, targetItem) {
this.lookImgVisible = true
this.dialogObj = {
url: src,
uploadType: targetItem.type || 'photo'
}
},
// 视频
handleVideoChange(e, targetItem) {
var reader = new FileReader()
var fileInfo = e.srcElement.files[0]
reader.readAsDataURL(fileInfo)
reader.onload = e => {
if ((e.total / 1024 / 1024) > 20) {
return this.$message({
message: '视频内容大于20M',
type: 'error'
})
}
const imgFile = e.target.result
const base64 = fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.sysBase.uploadVideo({ file: base64 }).then(res => {
this.formData[targetItem.name] = [{
content: res
}]
})
}
},
// 园区店更改
handleMerchantChange(value) {
if (this.formName === 'commodity') {
this.$emit('ydMerchantChange', value)
this.formData.goodsCode && (this.formData.goodsCode = '')
this.formData.upgradeGoods = []
this.formData.linkMerchants = []
}
},
// 验证分账比例
handleProfitInput(value, index) {
this.formData.upgradeGoods[index].profitValue = limitPrice(value, this.profitOldVal[index], 3, 0, 0, 100)
this.profitOldVal[index] = this.formData.upgradeGoods[index].profitValue
},
// 描述 1-图片;2-文字
handleAddDesc(resType, targetItem) {
const orderNo = this.formData[targetItem.name].length
this.formData[targetItem.name].push({
resType: resType,
orderNo: orderNo,
content: ''
})
},
handleClose() {
this.$emit('handleClose')
},
jumpScroll(idName) {
document.getElementById(idName).scrollIntoView()
},
handleUp() {
if (this.formData.sapCode && (!/^[0-9A-Za-z]+$/.test(this.formData.sapCode))) {
this.jumpScroll('sapCode')
return true
}
this.$refs[this.formRef + 'd2FormRuleForm'].validate((valid, options) => {
if (valid) {
// const flag = true
if (this.formData.hasOwnProperty('upgradeGoods')) {
// for (var i in this.formData.upgradeGoods) {
// const item = this.formData.upgradeGoods[i]
// if (!item.profitValue) {
// return true
// }
// }
if (!this.formData.linkMerchants.length) {
// flag = false
return true
}
}
this.$emit('handleAddConfirm', this.formData)
} else {
var needRuleList = Object.keys(options)
this.jumpScroll(needRuleList[0])
return true
}
})
}
}
}
</script>
<style>
.d2-form .d2-form-block {
border-bottom: 1px solid #e7eaec;
padding: 20px 0px;
}
.d2-form .dis-in-block {
display: inline-block;
}
.d2-form .item-tips {
position: absolute;
left: 252px;
display: inline-block;
font-size: 12px;
color: #999999;
margin-left: 10px;
vertical-align: top;
}
.d2-form .item-tips p {
margin: 0 0;
}
.d2-form .icon-delete {
margin-left: 10px;
cursor: pointer;
}
.d2-form .pro-item {
width: 30px;
display: inline-block;
margin: 0 6px;
}
.d2-form .photo-top-tips {
/* height: 36px; */
margin: 0 0;
color: #999999;
}
.d2-form .img-w-h {
width: 88px;
height: 88px;
}
.d2-form .activity-img {
position: relative;
/* width: 88px;
height: 74px; */
color: #999999;
border: 1px dashed #d9d9d9;
cursor: pointer;
/* margin-right: 10px; */
}
.d2-form .activity-Input {
position: absolute;
top: 0;
left: 0;
}
.d2-form .muti-imgs {
display: inline-block;
position: relative;
}
.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%);
}
.muti-imgs .img-btns {
display: none;
height: 100%;
position: absolute;
width: 88px;
height: 74px;
left: 0;
top: 0;
z-index: 2;
color: #fff;
background: rgba(0, 0, 0, 0.5);
}
.d2-form .el-icon-delete,
.d2-form .el-icon-zoom-in {
cursor: pointer;
}
.muti-imgs .img-btns .btn-item {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.muti-imgs .img-btns .btn-item {
display: flex;
width: 70%;
justify-content: space-around;
}
.muti-imgs:hover .img-btns {
display: block;
}
.d2-form .input-bg {
/* background-color: #eee; */
}
.d2-form .desc-btns {
margin-bottom: 15px;
}
.d2-form .desc-input {
width: 155%;
margin-bottom: 15px;
}
.d2-form .desc-txt-delete {
position: absolute;
left: 160%;
bottom: 15px;
}
.d2-form .add-btns .el-button {
width: 140px;
margin: 0 40px 30px 0;
}
.d2-form .add-btns .relate-btn-txt {
font-weight: bold;
color: #0947c6;
padding: 0 8px;
}
.d2-form .pro-block {
position: relative;
display: flex;
height: 160px;
width: 100%;
border: 1px solid #999999;
}
.d2-form .pro-block .pro-detail-txt {
font-size: 12px;
line-height: 30px;
color: #6c6f71;
}
.d2-form .pro-block .pro-detail {
width: 346px;
padding: 0px 40px;
margin: 20px 0;
/* border-right: 1px solid #999999; */
box-sizing: border-box;
}
.d2-form .pro-block .pro-detail .pro-type {
padding-left: 40px;
}
.d2-form .pro-block .pro-detail .pro-type .pro-sap {
display: inline-block;
padding-left: 20px;
}
.d2-form .pro-block .pro-allocate .el-input.is-disabled .el-input__inner {
text-align: center;
}
.d2-form .pro-block p {
margin: 0 0;
}
.d2-form .pro-block .pro-allocate {
width: 372px;
padding: 40px 0 0 84px;
}
.d2-form .pro-block img {
width: 160px;
height: 160px;
}
.d2-form .pro-name {
width: 256px;
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: bold;
}
.d2-form .pro-price-block {
text-align: right;
}
.d2-form .pro-price {
display: inline-block;
width: 62px;
text-align: center;
border-bottom: 1px solid #999999;
height: 23px;
padding-right: 2px;
color: #999999;
}
.d2-form .pro-delete {
position: absolute;
left: 0;
top: 0;
width: 16px;
height: 16px;
background-color: #ffffff;
}
.d2-form .pro-edit {
position: absolute;
right: 0;
top: 0;
width: 16px;
height: 16px;
cursor: pointer;
background-color: #ffffff;
}
.d2-form .pro-item.el-input--medium .el-input__inner,
.d2-form .pro-item .el-input--medium .el-input__inner {
padding: 0 2px;
border-width: 0 0 1px;
height: 16px;
line-height: 16px;
}
.d2-form .error {
color: red;
}
.d2-form .el-table--medium th {
background-color: #f7f7f7;
}
.d2-form .el-table--medium td {
padding: 20px 10px !important;
}
.d2-form .commodity-img {
width: 160px;
height: 160px;
margin-right: 60px;
vertical-align: top;
}
.d2-form .seat-img {
display: inline-block;
background: #f3f3f3;
border: 1px solid #e5e6e7;
box-sizing: border-box;
}
.flex-option {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
.add-option {
padding: 0 20px;
display: flex;
flex-flow: column;
align-items: flex-start;
}
.add-option-input {
width: 285px;
display: inline-block;
}
.add-option-input .el-input__inner {
border: none;
padding: 0;
}
.option_icon {
font-size: 14px;
cursor: pointer;
}
.del_icon {
margin-left: 15px;
color: #eb4e4e;
}
.add_icon {
color: #3fcf77;
}
</style>
<!-- 编辑商品弹窗 -->
<template>
<GLDialog title="添加绑定升级商品" mode="mid" :visible.sync="relateProVisible" okText="关联" @onOk="handleRelateProConfirm" @onCancel="handleRelateProClose" class="relatePro">
<div class="relateProDialog flex">
<img v-show="proInfo.thumbUrl" :src="proInfo.thumbUrl" />
<img v-show="!proInfo.thumbUrl" src="./image/no-choice.png" />
<el-form :model="proInfo" :rules="rules" label-width="110px" ref="proRuleForm1" style="width: calc(100% - 180px)">
<div class="w-50">
<el-form-item label="选择产品" prop="goodsCode">
<el-select style="width: 98%" v-model="proInfo.goodsCode" placeholder="请选择一款作为升级商品" value-key="goodsCode" filterable @change="handleChangeGood">
<el-option v-for="item in proList" :key="item.goodsCode" :label="item.goodsName" :value="item.goodsCode" :disabled="item.disabled" />
</el-select>
</el-form-item>
</div>
<div class="w-50">
<el-form-item label="分类">
<el-input disabled placeholder="分类" :value="proInfo.goodsTypeName" class="dis-in-block" />
</el-form-item>
</div>
<div class="w-50" />
<div class="w-50">
<el-form-item label="编号">
<el-input disabled placeholder="编号" :value="proInfo.sapCode" class="dis-in-block" />
</el-form-item>
</div>
<div class="w-50">
<el-form-item label="产品成本" prop="shopPrice">
<el-input v-model="proInfo.shopPrice" placeholder="请输入建议产品成本" class="dis-in-block" @input="handleShopPrice" @blur="handleShopPriceBlur">
<i slot="suffix" class="suffix">元</i>
</el-input>
</el-form-item>
</div>
<div class="w-50">
<el-form-item label="建议升级价格" prop="upgradePrice">
<el-input v-model="proInfo.upgradePrice" placeholder="请输入建议升级价格" class="dis-in-block" @input="handleUpgradePrice">
<i slot="suffix" class="suffix">元</i>
</el-input>
</el-form-item>
</div>
<div class="w-50">
<el-form-item label="商品最低价" prop="shopMinPrice">
<el-input v-model="proInfo.shopMinPrice" placeholder="请输入商品最低价" class="dis-in-block" @input="handleShopMinPrice">
<i slot="suffix" class="suffix">元</i>
</el-input>
</el-form-item>
</div>
<div class="w-50" v-show="warrantyProList.includes(proInfo.goodsType)">
<el-form-item label="质保年限" prop="warrantyPeriod">
<el-select style="width: 98%" :class="{ 'select-suffix': !!proInfo.warrantyPeriod }" v-model="proInfo.warrantyPeriod">
<el-option v-for="item in warrantyPeriodList" :key="item.confId" :label="item.confLabel" :value="item.confId" />
</el-select>
</el-form-item>
</div>
</el-form>
</div>
</GLDialog>
</template>
<script>
// import _ from 'lodash'
import { warrantyProList } from '@/utils/constants'
import { limitPrice } from '@/common/format'
export default {
name: 'RelateProDialog',
data() {
return {
goodVal: {},
warrantyProList,
proInfo: {
thumbUrl: '',
goodsCode: '',
goodsName: '',
goodsType: '',
goodsTypeName: '',
type: '',
upgradePrice: '',
shopPrice: '',
incentiveType: 1,
shopMinPrice: '',
warrantyPeriod: ''
},
rules: {
goodsCode: [{ required: true, message: '请选择关联升级商品', trigger: 'change' }],
upgradePrice: [
{ required: true, message: '请输入建议升级价', trigger: 'blur' },
{
required: true,
trigger: 'blur',
validator: (rule, value, callback) => {
;+value < +this.proInfo.shopPrice ? callback(new Error('建议升级价需要大于或等于产品成本')) : callback()
}
}
],
shopPrice: [{ required: true, message: '请输入产品成本', trigger: 'blur' }],
shopMinPrice: [
{ required: true, message: '请输入商品最低价', trigger: 'blur' },
{
required: true,
trigger: 'blur',
validator: (rule, value, callback) => {
;+value < +this.proInfo.shopPrice ? callback(new Error('商品最低价数值小于产品成本')) : callback()
}
}
]
},
oldVal: {
upgradePrice: '',
shopPrice: '',
shopMinPrice: ''
},
separateOpt: [
{
confId: 1,
confLabel: '毛利'
},
{
confId: 2,
confLabel: '收入'
}
],
incentiveTypeList: [
{
confId: 1,
confLabel: '比例'
},
{
confId: 2,
confLabel: '金额'
}
],
warrantyPeriodList: [
{
confId: '',
confLabel: '无'
}
]
}
},
props: {
relateProVisible: {
type: Boolean,
default: false
},
proList: {
type: Array,
default: () => []
},
originProInfo: {
type: Object,
default: () => {}
}
},
mounted() {
for (var i = 1; i <= 10; i++) {
this.warrantyPeriodList.push({
confId: i,
confLabel: i
})
}
this.proInfo = this.originProInfo ? this.$common.utils.deepClone(this.originProInfo) : this.$common.utils.deepClone(this.proInfo)
!this.proInfo.incentiveType && (this.proInfo.incentiveType = 1)
},
methods: {
handleChangeGood(value) {
var targetItem = this.proList.find(item => item.goodsCode === value)
this.proInfo.goodsName = targetItem.goodsName
this.proInfo.goodsCode = targetItem.goodsCode
this.proInfo.sapCode = targetItem.sapCode
this.proInfo.thumbUrl = targetItem.thumbUrl
this.proInfo.goodsType = targetItem.goodsType
this.proInfo.goodsTypeName = targetItem.goodsTypeName
this.proInfo.warrantyPeriod = this.warrantyProList.includes(targetItem.goodsType) ? '5' : ''
},
handleRelateProConfirm() {
this.$refs.proRuleForm1.validate(valid1 => {
if (valid1) {
this.$emit('handleRelateProConfirm', this.proInfo)
}
})
},
handleRelateProClose() {
this.$emit('handleRelateProClose')
},
handleUpgradePrice(newVal) {
this.proInfo.upgradePrice = limitPrice(newVal, this.oldVal.upgradePrice, 8, 2)
this.oldVal.upgradePrice = this.proInfo.upgradePrice
},
handleShopPrice(newVal) {
this.proInfo.shopPrice = limitPrice(newVal, this.oldVal.shopPrice, 6, 2)
this.oldVal.shopPrice = this.proInfo.shopPrice
},
handleShopMinPrice(newVal) {
this.proInfo.shopMinPrice = limitPrice(newVal, this.oldVal.shopMinPrice, 6, 2)
this.oldVal.shopMinPrice = this.proInfo.shopMinPrice
},
handleShopPriceBlur() {
if (this.proInfo.upgradePrice) {
var validateObj = this.proInfo.shopPrice <= this.proInfo.upgradePrice ? 'clearValidate' : 'validateField'
this.$refs.proRuleForm1[validateObj]('upgradePrice')
}
}
}
}
</script>
<style scoped>
.relateProDialog.flex {
display: flex;
}
.relateProDialog .sub-title {
display: inline-block;
height: 52px;
line-height: 36px;
margin-right: 40px;
}
.relateProDialog .w-50 {
display: inline-block;
width: 50%;
}
.relateProDialog img {
width: 160px;
height: 160px;
margin-right: 20px;
}
.relateProDialog .dis-in-block {
/* display: inline-block; */
width: 98%;
/* margin-right: 6px; */
}
.relatePro .btn-txt {
display: inline-block;
font-size: 14px;
margin-right: 209px;
color: #606266;
}
.relatePro .select-suffix {
position: relative;
}
.relatePro .select-suffix::after {
display: inline-block;
content: '年';
position: absolute;
right: 30px;
top: 0px;
}
</style>
<!-- 关联门店弹窗 -->
<template>
<GLDialog title="关联门店"
:visible.sync="relateStoreVisible"
okText="关联"
@onOk="handleRelateStoreConfirm"
@onCancel="handleRelateStoreClose"
class="relateStore">
<slot />
<el-row class="tableCon">
<!-- <el-col :span="12"> -->
<div class="tableBox">
<el-table ref="seletingTable"
:data="selectingData"
height="464px"
class="table"
border
@select="handleChange"
@select-all="handleAll">
<el-table-column type="selection"
width="55"
align="center"
:selectable="selectable" />
<el-table-column v-if="sourcePage != 'serviceStore'"
prop="yqMerchantName"
label="园区店名称"
align="center">
<template slot-scope="scope">
<span
:class="{'red': !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)}">{{ scope.row.yqMerchantName }}</span>
</template>
</el-table-column>
<el-table-column prop="merchantName"
label="4S店名称"
align="center">
<template slot-scope="scope">
<span
:class="{'red': !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)}">{{ scope.row.merchantName }}</span>
<el-tooltip v-if="!scope.row.isSetUpgradeSettleRule"
popper-class="tooltip-class"
effect="dark"
content="该门店无配置财务分润规则,无法关联!"
placement="top">
<span v-if="!scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)"
class="tip-icon">?</span>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<el-pagination small
background
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-size="pageSize"
layout="total, prev, pager, next"
:total="total" />
</div>
<!-- </el-col> -->
<!-- <el-col :span="12"> -->
<el-table :data="selectedData"
class="table tableBox"
border
height="464px">
<el-table-column v-if="sourcePage != 'serviceStore'"
prop="yqMerchantName"
label="园区店名称"
align="center" />
<el-table-column prop="merchantName"
label="4S店名称"
align="center" />
<el-table-column label="删除"
align="center"
width="50px">
<template slot-scope="scope">
<el-button class="el-icon-delete"
@click="handleDelete(scope.row)"
type="text" />
</template>
</el-table-column>
</el-table>
<!-- </el-col> -->
</el-row>
</GLDialog>
</template>
<script>
export default {
name: 'RelateStoreDialog',
data() {
return {
selectedData: [],
selectingData: [],
needTip: ['editProduct'],
// 分页
total: 0,
currentPage: 1,
pageSize: 20
}
},
props: {
relateStoreVisible: {
type: Boolean,
default: false
},
// 页面来源
sourcePage: {
type: String,
default: ''
},
storeApi: {
type: Function,
default: () => { }
},
storeSelected: {
type: Array,
default: () => []
},
storeSearchForm: {
type: Object,
default: () => { }
}
// 去掉表格中某些字段
// noTableField: {
// type: Array,
// default: () => []
// }
},
mounted() {
this.selectedData = this.storeSelected
this.getSelectingList()
},
methods: {
selectable(row, index) {
var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true
if (this.sourcePage === 'editProduct') {
// 不能选的判断
// console.log('??')
isSelect = row.isSetUpgradeSettleRule
}
return isSelect
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantId)
this.selectingData.forEach(item => {
exitIds.includes(item.merchantId) && this.$refs.seletingTable.toggleRowSelection(item, true)
})
},
getSelectingList() {
this.storeApi({
...this.storeSearchForm,
currentPage: this.currentPage,
pageSize: this.pageSize
}).then(res => {
this.selectingData = res.list
this.total = res.total
this.$nextTick(() => {
this.recoverySelection()
})
})
},
handleChange(selection, row) {
var addOrDelete = !!selection.find(item => item.merchantId === row.merchantId)
addOrDelete
? this.selectedData.push(row)
: (this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId))
},
handleAll(selection) {
this.selectingData.forEach(item => {
var isExit = this.selectedData.findIndex(subItem => subItem.merchantId === item.merchantId)
var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
if (selection.length && (isExit === -1) && !isServed) {
this.selectedData.push(item)
} else if (!selection.length && (isExit !== -1)) {
this.selectedData.splice(isExit, 1)
}
})
},
handleDelete(row) {
this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId)
this.$refs.seletingTable.toggleRowSelection(row)
},
handleCurrentChange(val) {
this.currentPage = val
this.getSelectingList()
},
handleRelateStoreConfirm() {
this.$emit('handleRelateStoreConfirm', this.selectedData)
},
handleRelateStoreClose() {
this.$emit('handleRelateStoreClose')
}
}
}
</script>
<style lang="scss">
.relateStore .table {
margin: 0 auto 20px !important;
width: 98%;
}
.relateStore .tableCon {
display: flex;
.tableBox {
flex: 1;
}
}
.service-store .relateStore .el-table .cell,
.d2-form .relateStore .el-table .cell {
line-height: 26px !important;
}
.service-store .relateStore .el-table--medium td,
.d2-form .relateStore .el-table--medium td {
padding: 6px 8px !important;
}
.relateStore .red {
color: red;
}
.relateStore .tip-icon {
position: absolute;
display: inline-block;
height: 10px;
width: 10px;
line-height: 10px;
color: #ffffff;
background-color: red;
border: 1px solid red;
border-radius: 50%;
cursor: pointer;
font-size: 6px;
margin-left: 2px;
}
</style>
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-06 10:10:44
* @LastEditors: limin
* @LastEditTime: 2021-09-06 10:11:49
* @FilePath: \scrm\scrm-sub-blog\src\components\index.js
*/
import Vue from 'vue'
import glsxDialog from '@/components/glsx-dialog/index.vue'
import GlsxCombiForm from '@/components/glsx-combi-form/index.vue'
import GlsxForm from '@/components/glsx-form/index.vue'
import relateStoreDialog from '@/components/relate-store-dialog'
Vue.component('glsx-dialog', glsxDialog)
Vue.component('GlsxCombiForm', GlsxCombiForm)
Vue.component('GlsxForm', GlsxForm)
Vue.component('relate-store-dialog', relateStoreDialog)
<!-- 关联门店弹窗 -->
<template>
<GLDialog bigTitle="关联门店" mode="big" :visible.sync="relateStoreVisible" okText="关联" :before-close="handleRelateStoreClose" @onOk="handleRelateStoreConfirm" @onCancel="handleRelateStoreClose" class="relateStore">
<slot></slot>
<el-row>
<el-col :span="12">
<el-table ref="seletingTable" class="table hightline" :data="selectingData" height="464px" @select="handleChange" @select-all="handleAll">
<el-table-column fixed="left" width="5">
<template slot-scope="scope">
<span :scope="scope"></span>
</template>
</el-table-column>
<el-table-column type="selection" width="55" align="center" :selectable="selectable"></el-table-column>
<el-table-column prop="merchantName" label="商户名称" align="center"></el-table-column>
</el-table>
<el-pagination v-if="hasPage" small background @current-change="handleCurrentChange" :current-page.sync="pageNum" :page-size="pageSize" layout="total, prev, pager, next" :total="total"></el-pagination>
</el-col>
<el-col :span="12">
<el-table :data="selectedData" class="table hightline" height="464px">
<el-table-column fixed="left" width="5">
<template slot-scope="scope">
<span :scope="scope"></span>
</template>
</el-table-column>
<el-table-column prop="merchantName" label="商户名称" align="center"></el-table-column>
<el-table-column label="删除" align="center" width="70">
<template slot-scope="scope">
<el-button style="padding: 0;" class="el-icon-delete" @click="handleDelete(scope.row)" type="text"></el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</GLDialog>
</template>
<script>
export default {
name: 'relateStoreDialog',
data() {
return {
selectedData: [],
selectingData: [],
// 分页
total: 0,
pageNum: 1,
pageSize: 20
}
},
props: {
relateStoreVisible: {
type: Boolean,
default: false
},
hasPage: {
type: Boolean,
default: true
},
// 页面来源
// sourcePage: {
// type: String,
// default: ''
// },
storeApi: {
type: Function,
default: () => { }
},
storeSelected: {
type: Array,
default: () => []
},
storeSearchForm: {
type: Object,
default: () => { }
}
// 去掉表格中某些字段
// noTableField: {
// type: Array,
// default: () => []
// }
},
mounted() {
this.selectedData = this.storeSelected
this.selectedData.forEach(item => {
item.merchantNo = item.merchantId ? item.merchantId + '' : item.merchantNo
})
this.getSelectingList()
},
methods: {
selectable(row, index) {
var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true
return isSelect
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantNo + '')
this.selectingData.forEach(item => {
if (exitIds.includes(item.merchantNo + '')) {
this.$refs.seletingTable.toggleRowSelection(item, true)
} else {
this.$refs.seletingTable.toggleRowSelection(item, false)
}
})
},
getSelectingList() {
this.storeApi({
...this.storeSearchForm,
pageNum: this.pageNum,
currentPage: this.pageNum,
pageSize: this.hasPage ? this.pageSize : 99999
}).then(res => {
this.selectingData = res.list
this.total = res.total
this.$nextTick(() => {
this.recoverySelection()
})
})
},
handleChange(selection, row) {
var addOrDelete = !!selection.find(item => +item.merchantNo === +row.merchantNo)
addOrDelete ? this.selectedData.push(row) : (this.selectedData = this.selectedData.filter(item => item.merchantNo !== row.merchantNo))
},
handleAll(selection) {
this.selectingData.forEach(item => {
let isExit = this.selectedData.findIndex(subItem => +subItem.merchantNo === +item.merchantNo)
var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
if (selection.length && isExit === -1 && !isServed) {
this.selectedData.push(item)
} else if (!selection.length && isExit !== -1) {
this.selectedData.splice(isExit, 1)
}
})
},
handleDelete(row) {
this.selectedData = this.selectedData.filter(item => +item.merchantNo !== +row.merchantNo)
this.recoverySelection()
},
handleCurrentChange(val) {
this.pageNum = val
this.getSelectingList()
},
handleRelateStoreConfirm() {
if (!this.selectedData.length) {
this.$message({
message: '请选择关联门店',
type: 'warning',
showClose: true,
customClass: 'message-Z-zinde'
})
return true
}
this.$emit('handleRelateStoreConfirm', this.selectedData)
},
handleRelateStoreClose() {
this.$emit('handleRelateStoreClose')
}
}
}
</script>
<style>
.relateStore .table {
margin: 0 auto 20px !important;
width: 98%;
}
/* .service-store .relateStore .el-table .cell,
.d2-form .relateStore .el-table .cell {
line-height: 26px !important;
} */
.service-store .relateStore .el-table--medium td,
.d2-form .relateStore .el-table--medium td {
padding: 6px 8px !important;
}
.relateStore .red {
color: red;
}
.relateStore .tip-icon {
position: absolute;
display: inline-block;
height: 10px;
width: 10px;
line-height: 10px;
color: #ffffff;
background-color: red;
border: 1px solid red;
border-radius: 50%;
cursor: pointer;
font-size: 6px;
margin-left: 2px;
}
</style>
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-08 16:55:43
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
const environment = process.env.NODE_ENV || 'production'
let config = require('./env.' + environment)
module.exports = config
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-09-18 11:51:29
*/
// 本地环境配置
module.exports = {
title: 'scrm-sub-marketing',
response: {
data_key: 'data',
message_key: 'message',
code_key: 'code',
code_success_value: '0',
errId_logout_value: '21',
code_message_map: {}
},
request: {
// baseURL: 'http://scrm.test.glsx.com.cn/',
baseURL: 'http://192.168.2.42:8064/',
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
sign: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0',
format: 'json',
source: ''
},
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
cdn: 'https://www.xxx.cn/static'
}
module.exports = {
title: 'scrm-sub-marketing',
response: {
data_key: 'data',
message_key: 'message',
code_key: 'code',
code_success_value: '0',
errId_logout_value: '21',
code_message_map: {}
},
request: {
baseURL: 'http://scrm.test.glsx.com.cn/',
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
sign: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0',
format: 'json',
source: ''
},
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
cdn: 'https://www.xxx.cn/static'
}
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-09-07 14:38:52
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
// let request = require('@/http/request.js')
let cfg = require('./conf.js')
import { Http, utils } from 'glsx-common'
let timeout = 30000 //超时时间
export const fetchConfig = function (isEnv = true) {
// if (isEnv) {
// let { request } = cfg
// Object.assign(request, { timeout })
// return Promise.resolve(cfg)
let params = { moduleName: 'commodity', mockUrl: 'http://oss-config.dev.glsx.com.cn/mock/6423df03079be3540abbb69e/purchase/config',httpOptions: { Headers: { refererurl: location.href }, request: { timeout: 30000 } } }
return utils.getConfig(params)
// return new Http().get('https://oss-config.test.glsx.com.cn/mock/616d28231072f92988f059fb/home/config')
// return new Http({ Headers: { refererurl: location.href }, request: { timeout: 30000 } }).get('http://config-center-backend.test.glsx.com/glsxAdmin/config?moduleUrl=home').then(res => res)
}
export const config = {
install(vue, cfg) {
vue.prototype.$config = cfg
}
}
\ No newline at end of file
import Vue from 'vue'
import { defaultStatusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, tableData } from '@/utils/constants.js'
// 发货状态
Vue.filter('deliveryStatus', (id, formatString) => {
const text = '--'
for (let i = 0; i < defaultDeliveryStatusOptions.length; i++) {
if (defaultDeliveryStatusOptions[i].id === id) {
return defaultDeliveryStatusOptions[i].label
}
}
return text
})
// 入库状态
Vue.filter('putStatus', (id, formatString) => {
const text = '--'
for (let i = 0; i < defaultPutStatusOptions.length; i++) {
if (defaultPutStatusOptions[i].id === id) {
return defaultPutStatusOptions[i].label
}
}
return text
})
// 订单状态状态
Vue.filter('orderStatus', (id, formatString) => {
const text = '--'
for (let i = 0; i < defaultStatusOptions.length; i++) {
if (defaultStatusOptions[i].id === id) {
return defaultStatusOptions[i].label
}
}
return text
})
No preview for this file type
No preview for this file type
No preview for this file type
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-08-13 14:12:11
* @LastEditors: limin
* @LastEditTime: 2021-09-24 10:41:31
* @FilePath: \scrm\scrm-sub-blog\src\main.js
*/
import Vue from 'vue'
import apis from './api'
import { optionalChaining } from './utils/chaining'
import utils from './utils/index'
import './public-path'
import '@/assets/css/public.scss'
import '@/components'
import '@/filter'
// import 'glsx-components/dist/glsx-components.css'
import { start } from '@/setup'
Vue.config.productionTip = false
Vue.prototype.$apis = apis
Vue.prototype.$$ = optionalChaining
Vue.prototype.$utils = utils
Vue.prototype.size = 'small'
Vue.prototype.$EventBus = new Vue()
start()
export { bootstrap, mount, unmount } from '@/setup'
export const http = params => Vue.prototype.$http(params)
export const http_common = params => Vue.prototype.$http_common(params)
File mode changed
import Vue from 'vue'
import { Message, Button, ButtonGroup, Form, FormItem, Input, Radio, RadioGroup, Checkbox, CheckboxGroup, Switch, Select, Option, TimePicker, Col, DatePicker, Tree, Card, Table, TableColumn, Pagination, Loading, Dialog, MessageBox, Upload, Tooltip, Tabs, TabPane, Container } from 'element-ui'
Vue.use(Button)
Vue.use(ButtonGroup)
Vue.use(Form)
Vue.use(FormItem)
Vue.use(Input)
Vue.use(Radio)
Vue.use(RadioGroup)
Vue.use(Checkbox)
Vue.use(CheckboxGroup)
Vue.use(Switch)
Vue.use(Select)
Vue.use(Option)
Vue.use(TimePicker)
Vue.use(Col)
Vue.use(DatePicker)
Vue.use(Tree)
Vue.use(Card)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(Pagination)
Vue.use(Loading)
Vue.use(Dialog)
Vue.use(Upload)
Vue.use(Tooltip)
Vue.use(Tabs)
Vue.use(TabPane)
export const message = Message
export const messageBox = MessageBox
if (window.__POWERED_BY_QIANKUN__) {
// eslint-disable-next-line no-undef
__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
}
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
Vue.use(VueRouter)
// 处理重复点击同一个路由报错的问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
function getRoutes(routesData) {
return routesData.reduce((routes, route) => {
routes.push({ ...route, component: () => import('@/views' + route.compath + '.vue') })
return routes
}, [])
}
export { VueRouter, routes, getRoutes }
const staticRoutes = Object.freeze([
{
name: 'default',
path: '/',
redirect: '/allocation/index'
},
{
name: 'allocation',
path: '/allocation/index',
component: resolve => require([`@/views/allocation/index.vue`], resolve),
meta: {}
}
])
export default staticRoutes
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-23 19:31:52
* @LastEditors: limin
* @LastEditTime: 2021-09-24 10:41:09
* @FilePath: \scrm\scrm-sub-blog\src\setup\index.js
*/
import { bootstrap, mount, unmount } from './qiankun'
import { start } from './single'
export { bootstrap, mount, unmount, start }
import Vue from 'vue'
import { message, messageBox } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import { GLButton, GLTable, GLTableButton, GLDialog } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { getRoutes } from '@/router'
import ElementUI from 'element-ui'
import render from './render'
import 'glsx-components/dist/glsx-components.css'
let routes = []
let router = null
let instance = null
Vue.use(ElementUI)
Vue.use(GLTable)
Vue.use(GLTableButton)
Vue.use(GLDialog)
export async function bootstrap({ history, common, messenger, globalState, routerBase }) {
const { response, request, sign, secret, sign_common, request_common } = await fetchConfig()
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$common = common
Vue.prototype.$message = message
Vue.prototype.$messageBox = messageBox
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http_common = new common.Http({ response, signWay: 'md5', request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes(routesData)
subscribe({ messenger })
Vue.use(GLButton, { routes, routerBase })
}
export async function mount(props) {
const insts = render(props.routerBase, routes)
router = insts.router
instance = insts.vm
}
export async function unmount() {
instance.$destroy()
instance.$el.innerHTML = ''
instance = null
router = null
}
function subscribe({ messenger }) {
messenger.subscribe(v => {
console.log(`监听到子应用${v.from}发来消息:`, v)
})
}
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-23 19:04:32
* @LastEditors: limin
* @LastEditTime: 2021-10-14 16:30:47
* @FilePath: \scrm\scrm-sub-blog\src\setup\render.js
*/
import App from '../App.vue'
import Vue from 'vue'
import store from '@/store'
import { VueRouter } from '@/router'
const render = (base, routes) => {
const router = new VueRouter({
base,
routes,
mode: 'history'
})
const vm = new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
return { router, vm }
}
export default render
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-23 19:02:23
* @LastEditors: limin
* @LastEditTime: 2021-09-24 10:41:17
* @FilePath: \scrm\scrm-sub-blog\src\setup\single.js
*/
import Vue from 'vue'
import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import { GLButton } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { Http, utils } from 'glsx-common'
import render from './render'
import { routes } from '@/router'
export async function start() {
if (window.__POWERED_BY_QIANKUN__) return
const { response, request, sign, secret } = await fetchConfig()
var urlParams = {}
// window.location.href
// .split('?')[1]
// .split('&')
// .forEach(item => {
// urlParams[item.split('=')[0]] = item.split('=')[1]
// })
var token = Object.keys(urlParams).includes('sessionId') ? urlParams.sessionId : 'mini-53e870b5-80d5-483e-8277-cdc4dec0ad80-rop'
Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: token } })
Vue.use(GLButton, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
render('/', routes)
}
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-08-13 14:12:11
* @LastEditors: limin
* @LastEditTime: 2021-08-25 14:14:44
* @FilePath: \scrm\scrm-base\src\store\index.js
*/
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const modulesFiles = require.context('./modules', true, /\.js$/)
const modules = modulesFiles.keys().reduce(
(result, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
result.getters[moduleName] = state => state[moduleName]
result.modules[moduleName] = value.default
return result
},
{ modules: {}, getters: {} }
)
const store = new Vuex.Store(modules)
export default store
export default {
namespaced: true,
state: {
size: 10, // 分页 页大小
token: ''
},
mutations: {
// 设置分页大小
SET_PAGE_SIZE(state, data) {
state.size = data
},
// 设置token
SET_TOKEN(state, data) {
state.token = data
}
},
actions: {
// 设置分页大小
setPageSize({ commit }, data) {
commit('SET_PAGE_SIZE', data)
},
// 设置token
setToken({ commit }, data) {
commit('SET_TOKEN', data)
}
}
}
export default {
namespaced: true,
state: {},
mutations: {},
actions: {}
}
export const optionalChaining = (obj, ...rest) => {
return rest.reduce((newObj, key) => newObj[key], obj)
}
\ No newline at end of file
// 订单状态
export const defaultStatusOptions = [
{
id: 1,
label: '待审核'
},
{
id: 2,
label: '已审核'
},
{
id: 3,
label: '已取消'
}
]
// 发货状态
export const defaultDeliveryStatusOptions = [
{
id: 1,
label: '未发货'
},
{
id: 2,
label: '已发货'
}
]
// 入库状态
export const defaultPutStatusOptions = [
{
id: 1,
label: '未入库'
},
{
id: 2,
label: '已入库'
}
]
export const membraneTypeList = [1, 4, 6, 12, 14]
// 商户类型 - 除广汇外
export const userType = {
// 1: '员工',
// 2: '门店',
// 3: '市级经销商',
// 4: '省级经销商',
// 5: '工厂',
1: '工厂',
2: '省代',
3: '市代',
4: '门店'
}
// 商户类型 - 广汇
export const ghUserType = {
1: '员工',
2: '门店',
3: '片区',
4: '大区',
5: '总部',
6: '供应商'
}
export const warrantyProList = [1, 4, 6, 12, 14]
function debounce(func, wait = 200) {
let timeout
return function(event) {
clearTimeout(timeout)
timeout = setTimeout(() => {
func.call(this, event)
}, wait)
}
}
function dateFormat(dateTime, format = 'YYYY-MM-DD HH:mm') {
const date = new Date(dateTime)
const config = {
YYYY: date.getFullYear(),
MM: date.getMonth() + 1, //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11)
DD: date.getDate(),
HH: date.getHours(),
mm: date.getMinutes(),
ss: date.getSeconds()
}
for (const key in config) {
format = format.replace(key, config[key])
}
return format
}
/**
* 校验手机号码格式
*/
function checkPhone(mobile) {
const myreg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
return myreg.test(mobile)
}
/**
* 用于glsx-combi-form的select写入options
* formName String FormData的属性名
* hasAll Boolean 是否需要添加“全部”属性
* refreshSigle String 更新特定的属性的options
*/
function getOptionsList(that, formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = that[formName].find(k => k.name == refreshSigle)
var index = that[formName].findIndex(k => k.name == refreshSigle)
that.$set(that[formName][index], 'optionList', that.$common.utils.deepClone(that.baseData[item.optionsName]))
if (hasAll && that.baseData[item.optionsName].length && that.baseData[item.optionsName][0][that[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[that[formName][index].optionId] = ''
temp[that[formName][index].optionLabel] = '全部'
that[formName][index].optionList.unshift(temp)
}
} else {
that[formName].forEach((item, index) => {
if (item.type === 'select' && that.baseData[item.optionsName]?.length) {
that.$set(that[formName][index], 'optionList', that.$common.utils.deepClone(that.baseData[item.optionsName]))
if (hasAll && that.baseData[item.optionsName].length && that.baseData[item.optionsName][0][that[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[that[formName][index].optionId] = ''
temp[that[formName][index].optionLabel] = '全部'
that[formName][index].optionList.unshift(temp)
}
}
})
}
}
/** 二次确认封装 */
function secondConfirm(that, title, txt, apiModule, apiName, apiParams, type = 'warning', fn) {
that.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type,
callback: action => {
if (action == 'confirm') {
// that.$apis[apiModule][apiName](apiParams).then(res => {
// that.$message({
// message: res.code == '0' ? '操作成功' : res.message,
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// fn && fn()
// that.handleSearch()
// }
// })
}
}
})
}
export default {
debounce,
dateFormat,
checkPhone,
getOptionsList,
secondConfirm
}
<template>
<div class="addWrap">
<div class="d2-container-content" style="padding: 10px 20px">
<el-form :inline="true" :model="editAllocationForm" ref="editAllocationFormRef" :rules="formRules" class="demo-form-inline">
<el-form-item label="调出门店:" prop="callOutYqMerchantId">
<el-select v-model="editAllocationForm.callOutYqMerchantId" style="width: 300px">
<el-option v-for="item in callOutYqMerchantList" :key="item.merchantNo" :label="item.merchantName" :value="item.merchantNo" />
</el-select>
</el-form-item>
<el-form-item label="调入门店:" prop="callInYqMerchantId">
<el-select v-model="editAllocationForm.callInYqMerchantId" filterable style="width: 300px">
<el-option v-for="item in callInYqMerchantList" :key="item.merchantId" :label="item.merchantName" :value="item.merchantId" />
</el-select>
</el-form-item>
</el-form>
</div>
<div class="d2-container-content">
<div style="padding: 15px 0">
<div>
<el-input v-model="searchForm.searchName" style="width: 200px" placeholder="请输入商品名称/系列" maxlength="20" clearable />
<el-button @click="handleSearch" size="small" type="primary" style="marginleft: 15px">查询</el-button>
</div>
</div>
<GLTable ref="allocationTable" :getListApi="getListApi" :searchForm="searchFormSearch" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn">
<div slot="auth-button" slot-scope="scope">
<el-button type="text" @click="allocation(scope.scope)" :disabled="setDisabled(scope.scope)">盘点</el-button>
</div>
</GLTable>
</div>
<div class="d2-container-content">
<p class="title">调拨确认单</p>
<GLTable ref="allocationTable2" :tableData="chooseDataList" :tableParams="tableParams2" :hasPage="false">
<div slot="auth-button" slot-scope="scope">
<el-button type="text" @click="cancelAllocation(scope.row, scope.$index)">取消</el-button>
</div>
</GLTable>
</div>
<glsx-form ref="allocationForm" :origin-data="editData" :form-list="editForm" form-ref="inveFormRef" @handleAddConfirm="handleAddConfirm" @handleClose="handleAddClose"></glsx-form>
<!-- 盘点 -->
<allocation-num-dialog :allocation-num-visible="allocationNumVisible" :allocation-info="allocationInfo" v-if="allocationNumVisible" @dialogClose="dialogClose" />
</div>
</template>
<script>
import allocationNumDialog from './allocationNumDialog'
import { membraneTypeList } from '@/utils/constants.js'
export default {
name: 'allocationList',
components: {
allocationNumDialog
},
data() {
return {
callOutYqMerchantList: [],
membraneTypeList: membraneTypeList,
callInYqMerchantList: [],
searchForm: {
searchName: '',
stockFlag: true
},
searchFormSearch: {},
searchSelectObj: {},
showFormData: [
{
// label: '商品名称/系列',
placeholder: '请输入商品名称/系列',
name: 'searchName',
type: 'input',
maxlength: '20',
isClear: true
}
],
getListApi: this.$apis.stockManage.stockRemainPage,
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '商品名称',
prop: 'goodsName',
width: '160px'
},
{
label: '系列',
prop: 'sourceMaterialName',
width: '250px'
},
{
label: '所属分类',
prop: 'goodsTypeName',
width: '250px'
},
{
label: '库存',
prop: 'stock',
formatter: cellValue => {
return cellValue.stock || cellValue.stock == 0 ? parseFloat(cellValue.stock).toFixed(2) + (this.membraneTypeList.includes(cellValue.goodsType) ? '米' : '件') : '-'
}
},
{
label: '所属门店',
prop: 'yqMerchantName',
width: '200px'
}
]
},
tableParams2: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '商品名称',
prop: 'goodsName',
width: '160px'
},
{
label: '系列',
prop: 'sourceMaterialName',
width: '250px'
},
{
label: '所属分类',
prop: 'goodsTypeName',
width: '250px'
},
{
label: '库存',
prop: 'stock',
formatter: cellValue => {
return cellValue.stock || cellValue.stock == 0 ? parseFloat(cellValue.stock).toFixed(2) + (this.membraneTypeList.includes(cellValue.goodsType) ? '米' : '件') : '-'
}
},
{
label: '调拨库存',
prop: 'allocateNumber ',
formatter: cellValue => {
return cellValue.allocateNumber || cellValue.allocateNumber == 0 ? parseFloat(cellValue.allocateNumber).toFixed(2) + (this.membraneTypeList.includes(cellValue.goodsType) ? '米' : '件') : '-'
}
}
]
},
editData: {
// thumbUrlList: [],
},
editForm: [
{
formBlock: [
{
name: 'remark',
label: '备注说明',
type: 'textarea',
maxlength: 100
}
]
}
],
editAllocationForm: {
callOutYqMerchantId: '',
callInYqMerchantId: ''
},
allocationNumVisible: false,
allocationInfo: null,
chooseDataList: [],
formRules: {
callOutYqMerchantId: [
{
required: true,
message: '请选择调出门店',
trigger: 'change'
}
],
callInYqMerchantId: [
{
required: true,
message: '请选择调入门店',
trigger: 'change'
}
]
}
}
},
mounted() {
// this.editAllocationForm.callOutYqMerchantId =
// this.callOutYqMerchantList[0].merchantNo
//调入门店
this.$apis.stockManage.yqRelatedList({ includeSelf: false }).then((res) => {
this.callInYqMerchantList = res
})
},
methods: {
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = this.$common.utils.deepClone(this.searchForm)
resolve()
})
},
handleSearch() {
this.$refs.allocationTable.refreshTable()
},
// 调拨
allocation(row) {
this.allocationInfo = row
this.allocationNumVisible = true
},
//设置禁选
setDisabled(row) {
const index = this.chooseDataList.findIndex((item) => item.id == row.id)
if (index == -1) {
return false
} else {
return true
}
},
dialogClose(chooseData) {
this.allocationNumVisible = !this.allocationNumVisible
console.log(chooseData)
if (chooseData) {
this.chooseDataList.push(chooseData)
}
},
// 取消
cancelAllocation(row, index) {
this.chooseDataList.splice(index, 1)
},
handleAddConfirm(data) {
this.$refs.editAllocationFormRef.validate((valid) => {
if (valid) {
if (this.chooseDataList.length == 0) {
this.notice.warningTips("请选择调拨商品")
return
}
var params = {}
params.stockCheckDetailList = this.chooseDataList
if (data.remark) {
params.remark = data.remark
}
params = {
...params,
...this.editAllocationForm
}
this.$confirm(
"调拨单保存后,系统自动按照调拨数量对调出和调入门店进行库存更新;是否确定保存?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
)
.then(() => {
this.$apis.stockManage.saveStockAllocate(params).then((res) => {
this.notice.okTips()
this.handleAddClose()
})
})
.catch((err) => {
console.log(err)
})
}
})
},
handleAddClose(isRefresh = false) {
// this.close({ tagName: "/addAllocation" })
// this.$router.push({ name: "allocationList" })
}
}
}
</script>
<style scoped>
.d2-container-content {
background: #fff;
padding: 20px;
margin-bottom: 20px;
}
.count-txt {
font-weight: 700;
color: #2a58ad;
margin: 0 2px;
}
.title {
font-weight: 600;
font-size: 16px;
color: #333333;
padding: 17px 0;
}
.leftSpan {
display: inline-block;
box-sizing: border-box;
margin-right: 10px;
}
</style>
<!-- 盘点详情弹窗弹窗 -->
<template>
<GLDialog bigTitle="详细信息"
:visible.sync="allocationDetailVisible"
class="inventoryDetailDailog"
mode="big"
@onCancel="handleClose"
@onOk="handleClose">
<div>
<div class="d2-container-content">
<GLTable ref="recordTable"
:getListApi="getListApi"
:searchForm="searchFormSearch"
:tableParams="tableParams"
:beforeSearchFn="beforeSearchFn">
</GLTable>
</div>
</div>
</GLDialog>
</template>
<script>
import { membraneTypeList } from '@/utils/constants.js'
export default {
name: 'allocationDetailDialog',
data() {
return {
membraneTypeList: membraneTypeList,
searchForm: {
id: ''
},
searchFormSearch: {},
searchSelectObj: {},
showFormData: [],
getListApi: this.$apis.stockManage.stockAllocateDetailPage,
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '商品名称',
prop: 'goodsName'
},
{
label: '系列',
prop: 'sourceMaterialName'
},
{
label: '所属分类',
prop: 'goodsTypeName'
},
{
label: '调拨数量',
prop: 'allocateNumber',
formatter: cellValue => {
return cellValue.allocateNumber || cellValue.allocateNumber == 0 ? parseFloat(cellValue.allocateNumber).toFixed(2) + (this.membraneTypeList.includes(cellValue.goodsType) ? '米' : '件') : '-'
}
}
]
},
baseData: {}
}
},
props: {
allocationDetailVisible: {
type: Boolean,
default: false
},
allocationInfo: {
type: Object,
default: () => {}
}
},
computed: {},
mounted() {
console.log(11111111)
},
methods: {
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm.id = this.allocationInfo.id
this.searchFormSearch = this.$common.utils.deepClone(this.searchForm)
resolve()
})
},
handleClose() {
this.$emit('dialogClose')
}
}
}
</script>
<style scoped>
.count-txt {
font-weight: 700;
color: #2a58ad;
margin: 0 2px;
}
.inventoryDetailDailog .el-dialog {
margin-top: 20vh !important;
min-width: 700px;
}
</style>
<!-- 盘点 -->
<template>
<GLDialog title="调拨" mode="small" :visible.sync="allocationNumVisible" class="allocationNumDailog" okText="确定" @onCancel="handleClose" @onOk="handleAddConfirm">
<el-form ref="allocationNumForm" :model="infoForm" :rules="formRules" label-width="120px">
<el-form-item label="调拨数量:" prop="allocationNum">
<el-input placeholder="请输入调拨数量" v-model="infoForm.allocationNum" style="width: 250px" clearable @input="handleUpgradeNum"></el-input>
</el-form-item>
</el-form>
</GLDialog>
</template>
<script>
import { limitPrice } from '@/common/format'
export default {
name: 'AllocationNumDialog',
data() {
return {
infoForm: {
allocationNum: ''
},
oldVal: {
allocationNum: ''
},
formRules: {
allocationNum: [{ required: true, message: '请输入调拨数量', trigger: 'change' }]
},
selectLoading: false
}
},
props: {
allocationNumVisible: {
type: Boolean,
default: false
},
allocationInfo: {
type: Object,
default: () => {}
}
},
watch: {},
created() {},
components: {},
computed: {},
mounted() {},
methods: {
handleUpgradeNum(newVal) {
this.infoForm.allocationNum = limitPrice(newVal, this.oldVal.allocationNum, 8, 2, 0, this.allocationInfo.stock)
this.oldVal.allocationNum = this.infoForm.allocationNum
},
handleAddConfirm() {
this.$refs.allocationNumForm.validate(valid => {
if (valid) {
this.allocationInfo.allocateNumber = parseFloat(this.infoForm.allocationNum)
this.handleClose(this.allocationInfo)
}
})
},
handleClose(info) {
this.$emit('dialogClose', info)
}
}
}
</script>
<style >
</style>
<template>
<div class="purchase">
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<el-button type="primary" size="small" @click="handleAdd">创建调拨</el-button>
<el-button type="primary" size="small" @click="exportExcel">导出</el-button>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="allocationRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">查看</el-button>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
<!-- 查看 -->
<allocation-detail-dialog :allocation-detail-visible="allocationDetailVisible" :allocationInfo="allocationInfo" v-if="allocationDetailVisible" @dialogClose="dialogClose" />
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import allocationDetailDialog from './allocationDetailDialog'
export default {
name: 'warehousing',
components: {
allocationDetailDialog
},
data() {
return {
size: 'small',
url: url,
searchForm: {
allocateTime: '',
allocateCode: '',
callOutYqMerchantId: '',
callInYqMerchantId: ''
},
tableSearchForm: {},
allocationInfo: {},
allocationDetailVisible: false,
showFormData: [
{
label: '调拨单号',
name: 'allocateCode',
type: 'input',
maxlength: '20',
isClear: true
},
{
label: '调拨时间',
name: 'allocateTime',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
},
{
label: '调出门店',
name: 'callOutYqMerchantId',
type: 'select',
optionList: [],
optionId: 'merchantId',
optionLabel: 'merchantName',
optionsName: 'yqRelatedMerchantList'
},
{
label: '调入门店',
name: 'callInYqMerchantId',
type: 'select',
optionList: [],
optionId: 'merchantId',
optionLabel: 'merchantName',
optionsName: 'yqRelatedMerchantList'
}
],
// 表格
getListApi: this.$apis.stockManage.stockAllocatePage,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '调拨单号',
prop: 'allocateCode',
width: 200
},
{
label: '调拨时间',
prop: 'allocateTime',
formatter: cellValue => {
return dayjs(cellValue.allocateTime).format('YYYY-MM-DD HH:mm:ss')
}
},
{
label: '调拨人',
prop: 'operator'
},
{
label: '调出门店',
prop: 'callOutYqMerchantName'
},
{
label: '调入门店',
prop: 'callInYqMerchantName'
},
{
label: '备注',
prop: 'remark'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
// 基本数据
baseData: {
yqRelatedMerchantList: []
},
imgVisible: false,
previewImgUrl: ''
}
},
mounted() {
//调入门店
this.$apis.stockManage.yqRelatedList({}).then(res => {
this.baseData.yqRelatedMerchantList = res
this.getOptionsList('showFormData')
})
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.allocateTime) {
params.allocateTimeStart = new Date(this.searchForm.allocateTime[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.allocateTimeEnd = new Date(this.searchForm.allocateTime[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.allocateTime
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
// 查看详情
handleDetail(row) {
this.allocationInfo = row
this.allocationDetailVisible = true
console.log(this.allocationDetailVisible)
},
handleAdd() {
this.$router.push({ path: '/allocation/add' })
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.allocationRef.data.length ? (this.$refs.allocationRef.tableHeightValues = '') : this.$refs.allocationRef.setTableHeightFun()
},
exportExcel() {
this.exportLoading = true
var params = this.getParams()
this.$apis.stockManage.exportaAllocateExcel(params).then(res => {
this.exportLoading = false
window.location.href = res
})
},
handleSearch() {
this.$refs.allocationRef.refreshTable()
},
handleReset() {
this.searchForm = {
allocateTime: '',
allocateCode: '',
callOutYqMerchantId: '',
callInYqMerchantId: ''
}
this.handleSearch()
},
handleEnlargeImg(url) {
if (url) {
this.previewImgUrl = url
this.imgVisible = !this.imgVisible
}
},
handleCloseImg() {
this.imgVisible = !this.imgVisible
},
dialogClose() {
this.allocationDetailVisible = !this.allocationDetailVisible
}
}
}
</script>
<style scoped lang="scss">
@import '@/assets/css/mixin.scss';
.purchase {
.table-header {
@include space-between_center;
margin-bottom: 10px;
h2 {
font-weight: 600;
font-size: 16px;
color: #333;
}
}
}
</style>
const statusList = [
{
confId: 0,
confValue: '待上架'
},
{
confId: 1,
confValue: '在售'
},
{
confId: 2,
confValue: '部分在售'
},
{
confId: 3,
confValue: '草稿'
}
]
export default {
statusList
}
const commodityObj = {
searchFormData: [
{
label: '商品名称',
name: 'goodsName',
type: 'input',
isClear: true,
maxlength: 50
},
{
label: '商品编码',
name: 'goodsType',
type: 'input',
isClear: true,
maxlength: 50
},
{
label: '使用门店',
name: 'merchantIdList',
type: 'select',
optionList: [],
optionId: 'categoryType',
optionLabel: 'categoryName',
optionsName: 'productTypeList'
},
{
label: '所属系列',
name: 'goodsSeries',
type: 'select',
optionList: [],
optionId: 'categoryType',
optionLabel: 'categoryName',
optionsName: 'goodsSeriesList'
},
{
label: '产品类型',
name: 'status',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confValue',
optionsName: 'statusList'
}
],
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: {
width: '170'
},
tableColumns: [
{
label: '商品名称',
prop: 'goodsName',
width: '200'
},
{
label: '商品编码',
prop: 'goodsType',
width: '110'
},
{
label: '所属系列',
prop: 'goodsSeries',
width: '100'
},
{
label: '产品类型',
prop: ''
},
{
label: '售价/元',
prop: 'sellPrice'
},
{
label: '最低售价/元',
prop: 'minSellPrice'
},
{
label: '赠送成本',
prop: 'giftCost'
},
{
label: '产品成本',
prop: 'productCost'
},
{
label: '使用门店',
prop: ''
},
{
label: '创建日期',
prop: 'createDateStr',
width: '155px'
}
// {
// label: '更新日期',
// prop: 'updatedDate',
// width: '155px'
// // formatter: cellValue => {
// // return cellValue.updatedDate ? Util.dateFormate(cellValue.updatedDate, 'YYYY-MM-DD HH:mm:ss') : ''
// // }
// }
]
}
}
const editCommodityObj = {
editRule: {
goodsName: [{ required: true, message: '请输入商品名称', trigger: 'change' }],
goodsSeries: [{ required: true, message: '请选择所属系列', trigger: 'change' }],
sellPrice: [{ required: true, message: '请输入售价', trigger: 'change' }],
minSellPrice: [{ required: true, message: '请输入最低售价', trigger: 'change' }],
giftCost: [{ required: true, message: '请输入赠送成本', trigger: 'change' }],
productCost: [{ required: true, message: '请输入产品成本', trigger: 'change' }],
warningValue: [{ required: true, message: '请输入库存预警', trigger: 'change' }],
merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }]
},
editFormData: [
{
label: '商品名称',
name: 'goodsName',
type: 'input',
maxlength: 50
},
{
label: '商品编码',
name: 'goodsType',
type: 'input',
maxlength: 50
},
{
label: '所属系列',
name: 'goodsSeries',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'goodsSeriesList',
changeAttr: function(val, targetItem, that) {
let labeList = ['产品类型']
that.changeFormAttr('editFormData', 'isHide', labeList, val != '1')
if (val != '1') {
that.editForm.baseProductFlag = 'N'
that.editForm.upgradeProductFlag = 'Y'
that.handleCheckChange('Y', 'upgradeProductFlag')
}
}
},
{
label: '产品类型',
name: '',
type: 'slot',
addHtml: 'productFlag',
isHide: true,
tips: '说明:基础产品应用于客户战败(不升级)订单中,升级产品应用于客户升级订单中'
},
{
label: '售价/元',
name: 'sellPrice',
type: 'input',
isHide: true
},
{
label: '最低售价/元',
name: 'minSellPrice',
type: 'input',
isHide: true
},
{
label: '赠送成本/元',
name: 'giftCost',
type: 'input',
isHide: true
},
{
label: '产品成本/元',
name: 'productCost',
type: 'input',
isHide: true
},
{
label: '库存预警',
name: 'warningValue',
type: 'input'
}
],
merchantEditFormData: [
// {
// label: '使用门店列表',
// name: 'merchantList',
// addHtml: 'selectMerchant',
// style: {
// 'margin-bottom': '10px'
// }
// },
{
// label: '',
name: '',
addHtml: 'merchantTable'
}
]
}
export default {
commodityObj,
editCommodityObj
}
<!-- 新建/编辑商品 -->
<template>
<div class="edit-commodity commodity edit-box">
<div class="container edit-container">
<p class="edit-title">基础信息</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :pageThat="this" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="productFlag">
<el-checkbox v-model="editForm.baseProductFlag" true-label="Y" false-label="N" label="基础产品" @change="val => handleCheckChange(val, 'baseProductFlag')"></el-checkbox>
<el-checkbox v-model="editForm.upgradeProductFlag" true-label="Y" false-label="N" label="升级产品" @change="val => handleCheckChange(val, 'upgradeProductFlag')"></el-checkbox>
</div>
</glsx-combi-form>
</div>
<div class="container edit-container">
<p class="edit-title">使用门店</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormMerchantRef" :isEdit="isEdit" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="merchantEditFormData" :formRules="editRule">
<div slot="merchantTable" class="merchant-table" :style="{ width: `calc(100% - ${defaultLabelWidth} )` }">
<div class="table-title">
使用门店列表
<el-button type="default" @click="handleRelateStoreClose(scope)">{{ editForm.merchantList.length ? '更换门店' : '选择门店' }}</el-button>
</div>
<GLTable ref="warehousListRef" :hasPage="false" :tableParams="tableParams" :tableData="editForm.merchantList">
<span slot="customBtn" slot-scope="scope">
<el-button class="p-0" type="text" @click="handleMerchantDelete(scope)">删除</el-button>
</span>
</GLTable>
</div>
</glsx-combi-form>
</div>
<GLFooter>
<el-button @click="handleCancel" size="medium">取消</el-button>
<el-button type="primary" @click="handleConfirm" size="medium" :loading="loading">提交</el-button>
</GLFooter>
<!-- 门店弹窗 -->
<relate-store-dialog v-if="relateStoreVisible" ref="relateStore" :relateStoreVisible="relateStoreVisible" :storeApi="storeApi" :storeSearchForm="storeSearchForm" :storeSelected="selectedList" @handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreClose="handleRelateStoreClose">
<el-row slot>
<el-form :model="storeSearchForm" ref="relate" :inline="true" label-width="90px">
<el-form-item label="门店名称:" prop="merchantName">
<el-input :size="size" v-model.trim="storeSearchForm.merchantName" placeholder="请输入门店名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button :size="size" type="primary" @click="handleSearchStore">搜索</el-button>
</el-form-item>
</el-form>
</el-row>
</relate-store-dialog>
</div>
</template>
<script>
import constData from './constant/data'
import { limitPrice } from '@/common/constant'
export default {
name: 'editCommodity',
data() {
return {
size: 'small',
editChildRef: 'editChildRef',
routeInfo: {
editType: 'add',
id: ''
},
editStatus: false,
editForm: {
baseProductFlag: 'N',
upgradeProductFlag: 'N',
merchantList: []
},
isEdit: true,
editRule: constData.editCommodityObj.editRule,
editFormData: constData.editCommodityObj.editFormData,
merchantEditFormData: constData.editCommodityObj.merchantEditFormData,
// 选择门店
relateStoreVisible: false,
storeApi: this.$apis.commodity.getSimpleMerchantList,
storeSearchForm: {
merchantName: ''
},
selectedList: [],
// 门店表格
tableParams: {
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
},
{
label: '商户号',
prop: 'merchantId'
},
{
label: '操作',
prop: '',
addHtml: 'customBtn'
}
]
},
baseData: {
goodsSeriesList: [
{
confId: '1',
confName: '太阳膜'
},
{
confId: '2',
confName: '车衣'
},
{
confId: '3',
confName: '改色膜'
}
]
}
}
},
watch: {
editForm: {
handler(val) {
this.editStatus = true
},
deep: true
},
// 售价
'editForm.sellPrice'(newValue, oldValue) {
this.editForm.sellPrice = limitPrice(newValue, oldValue, 6, 2)
},
// 最低售价
'editForm.minSellPrice'(newValue, oldValue) {
this.editForm.minSellPrice = limitPrice(newValue, oldValue, 6, 2)
},
// 赠送成本
'editForm.giftCost'(newValue, oldValue) {
this.editForm.giftCost = limitPrice(newValue, oldValue, 6, 2)
},
// 产品成本
'editForm.productCost'(newValue, oldValue) {
this.editForm.productCost = limitPrice(newValue, oldValue, 6, 2)
},
// 库存预警
'editForm.warningValue'(newValue, oldValue) {
this.editForm.warningValue = limitPrice(newValue, oldValue, 6, 2)
},
},
mounted() {
this.routeInfo = this.$route.query
this.routeInfo.editType != 'add' ? this.getInfo() : ''
this.$utils.getOptionsList(this, 'editFormData', false)
// this.changeFormAttr('editFormData', 'isHide', ['规格明细'], false)
},
methods: {
getInfo() {
// this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => {
// this.$nextTick(() => {
// this.editStatus = false
// })
// })
},
// 所属系列改变,清空值
// seriesClear() {
// this.editForm
// },
// 产品类型改变
handleCheckChange(val, attr) {
let baseAttrList = ['赠送成本/元']
let upAttrList = ['售价/元', '最低售价/元', '产品成本/元']
switch (attr) {
case 'baseProductFlag':
this.changeFormAttr('editFormData', 'isHide', baseAttrList, val != 'Y')
break
case 'upgradeProductFlag':
this.changeFormAttr('editFormData', 'isHide', upAttrList, val != 'Y')
break
}
},
changeFormAttr(formName, attrName, labelList, attrValue) {
labelList.forEach(item => {
let idx = this[formName].findIndex(k => k.label == item)
this[formName][idx][attrName] = attrValue
})
},
// 选择门店
handleRelateStoreClose() {
this.selectedList = this.$common.utils.deepClone(this.editForm.merchantList)
this.relateStoreVisible = !this.relateStoreVisible
},
handleRelateStoreConfirm(selectedData) {
this.editForm.merchantList = selectedData
this.selectedList = selectedData
this.handleRelateStoreClose()
this.$refs.editFormMerchantRef.$refs[this.editChildRef].validateField('merchantList')
},
handleSearchStore() {
this.$refs.relateStore.handleCurrentChange(1)
},
handleMerchantDelete(obj) {
this.$messageBox.confirm('是否删除该门店?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
var idx = this.editForm.merchantList.findIndex(item => item.merchantNo == obj.scope.merchantNo)
this.editForm.merchantList.splice(idx, 1)
}
}
})
},
handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.editForm)
console.log(params, 'params----')
// if (this.routeInfo.editType == 'edit') {
// params.id = this.routeInfo.id
// }
// params.merchantList = []
// // 专区类型(1发现频道,2商城专区)
// params.zoneType = '2'
// this.editForm.merchantList.forEach(item => {
// params.merchantList.push({
// merchantId: item.merchantNo,
// merchantName: item.merchantName,
// merchantAccountLevel: item.merchantAccountLevel
// })
// })
// // console.log(params)
// this.$apis.zoneList.insertZoneApi(params).then(res => {
// this.$message({
// message: res.code == '0' ? '操作成功' : '操作失败',
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.cancelJump()
// }
// })
}
})
},
cancelJump() {
this.$router.push({
path: '/commodity/index'
})
},
handleCancel() {
if (this.editStatus) {
this.$confirm('当前有内容信息未保存,是否继续返回?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.cancelJump()
})
.catch(() => { })
} else {
this.cancelJump()
}
}
}
}
</script>
<style scoped>
.commodity.edit-commodity .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
}
.merchant-table {
margin: 0 20px;
}
</style>
<template>
<div>
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<GLButton type="primary" size="small" @click="handleAdd" fn="新建">新增商品</GLButton>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="commofityRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import constData from './constant/data'
import baseList from './constant/baseList'
export default {
name: 'commodity',
data() {
return {
size: 'small',
url: url,
searchForm: {
goodsName: '',
goodsCode: '',
merchantIdList: [],
goodsType: '',
baseProductFlag: 'N',
upgradeProductFlag: 'N'
},
searchFormData: constData.commodityObj.searchFormData,
// 表格
getListApi: this.$apis.commodity.getListApi,
tableParams: constData.commodityObj.tableParams,
// pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
// 表格按钮
tableButtonList: [
{
type: 'GLButton',
name: '查看',
attrs: {
type: 'text',
fn: '查看'
},
// condition: row => {
// return row.goodsStatus
// },
listeners: {
click: row => this.handleEdit('detail', row)
}
},
{
type: 'GLButton',
name: '编辑',
attrs: {
type: 'text',
fn: '编辑'
},
// condition: row => {
// return !row.goodsStatus
// },
listeners: {
click: row => this.handleEdit('edit', row)
}
},
{
type: 'GLButton',
name: '删除',
attrs: {
type: 'text',
fn: '删除'
},
// condition: row => {
// return !row.goodsStatus
// },
listeners: {
click: row => this.handleDelete(row)
}
}
],
// 基本数据
baseData: {
productTypeList: [],
brandList: [],
statusList: baseList.statusList
},
imgVisible: false,
previewImgUrl: ''
}
},
mounted() {
this.$utils.getOptionsList(this, 'searchFormData')
},
methods: {
/**
* @param {Sting} editType add/edit/detail
* @param {Object} info
*/
handleEdit(editType, info) {
var titleObj = {
add: '新建商品',
edit: '编辑商品',
detail: '查看商品'
}
let params = {
editType,
info,
$title: encodeURI(titleObj[editType])
}
this.$router.push({
path: '/commodity/editCommodity',
query: params
})
},
// 删除
handleDelete(info) {
this.$utils.secondConfirm(this, '删除提示', '删除后不可恢复,是否确定删除?')
console.log(info)
},
handleSearch() {
this.$refs.commofityRef.refreshTable()
},
handleReset() {
this.searchForm = {
commodityCode: '',
baseGoodsName: '',
goodsType: '',
status: ''
}
this.handleSearch()
},
}
}
</script>
<style scoped>
</style>
const path = require('path')
const packageName = require('./package.json').name
const node_env = process.env.NODE_ENV === 'production'
const publicPath = node_env ? `/child/${packageName}/` : '/'
const resolve = dir => path.join(__dirname, dir)
const CDN_DOMAIN = 'https://img02.glsx.com.cn/'
const cdn = {
css: [`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/theme-chalk/index.css`],
js: [`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`, `${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`, `${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`, `${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`, `${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`, 'https://webapi.amap.com/loader.js']
}
module.exports = {
outputDir: `../dist/${packageName}`,
publicPath,
assetsDir: 'static',
productionSourceMap: false,
configureWebpack: {
resolve: {
alias: {
'@': resolve('src'),
assets: resolve('src/assets'),
views: resolve('src/views'),
components: resolve('src/components')
}
},
output: {
library: `${packageName}-[name]`,
libraryTarget: 'umd', // 把微应用打包成 umd 库格式
jsonpFunction: `webpackJsonp_${packageName}`
},
externals: {
vue: 'Vue',
'element-ui': 'ELEMENT',
'vue-router': 'VueRouter',
vuex: 'Vuex',
axios: 'axios',
echarts: 'echarts',
AMap: 'AMap'
}
},
devServer: {
hot: true,
disableHostCheck: true,
host: process.env.VUE_APP_HOST,
port: process.env.VUE_APP_PORT,
headers: {
'Access-Control-Allow-Origin': '*' // 主应用获取子应用时跨域响应头
}
},
chainWebpack: config => {
config.plugin('html').tap(args => {
// args[0].minify.removeComments = false;
args[0].cdn = cdn
return args
})
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
config.module
.rule('fonts')
.test(/.(ttf|otf|eot|woff|woff2)$/)
.use('url-loader')
.loader('url-loader')
.tap(options => {
options = {
// limit: 10000,
name: '/static/fonts/[name].[ext]'
}
return options
})
.end()
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!