Commit be37eda7 by wangql

init

1 parent 80cab9e0
Showing 76 changed files with 6522 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 \ 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": "ordermanage",
"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": {
"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.2.5",
"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 \ 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 getProductInfo = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}goodsinfo.get.byId`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取场景下类目
const getProductTypeBySceneId = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}goodsCategoryConfiguration.queryGoodsCategoryBySceneId`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 查询产品列表
const getGoodsList = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}goodsinfo.list`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getGoodsList,getProductInfo, getProductTypeBySceneId }
import { http } from '@/main'
const path = 'dj.api.smarcarlife.'
const path2 = 'dj.api.goodsInfo.'
const path3 = 'dj.api.smartcarlife.'
// 分页查询采购订单
const getPurchaseOrderList = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseOrder.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 采购订单取消/审核
const purchaseOrderCancelOrCheck = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseOrder.cancelOrCheck`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 查看采购订单
const purchaseOrderDetail = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseOrder.view`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 分页查询采购商城素材信息
const listWithPagePurchaseInfo = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path2}listWithPage.purchaseInfo`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取当前登录园区店商户收货地址
const addressGet = (params = {}) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}yqMerchantDeliveryAddress.get`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 保存园区店商户收货地址
const addressSave = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}yqMerchantDeliveryAddress.save`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 按商品类目分组获取购物车列表
const listGroupByGoodsType = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseShoppingCar.listGroupByGoodsType`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 更新购物车商品选中标识
const updateSelectedFlag = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseShoppingCar.updateSelectedFlag`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 移除购物车商品
const shoppingCarRemove = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseShoppingCar.remove`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 添加到购物车
const shoppingCarAdd = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseShoppingCar.add`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 修改购物车商品数量
export function shoppingCarUpdateNumber(params) {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseShoppingCar.updateNumber`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params
})
}
// 添加采购订单
export function purchaseOrderAdd(params) {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseOrder.add`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
export function exportExcel(params) {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.smarcarlife.purchaseOrder.export`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 采购订单入库
export function purchaseOrderPutIn(params) {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}purchaseOrder.putIn`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取下单/入库门店
export function getMerchantList(params) {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path3}permission.yqMerchant.list`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 确认发货
// export function purchaseOrderConfirmDelivery(data) {
// params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
// data.routerMethod = `${path}purchaseOrder.confirmDelivery`
// return http(data)
// }
export default { getMerchantList,purchaseOrderPutIn, exportExcel, shoppingCarUpdateNumber, purchaseOrderAdd, shoppingCarAdd, shoppingCarRemove, updateSelectedFlag, listGroupByGoodsType, getPurchaseOrderList, purchaseOrderCancelOrCheck, purchaseOrderDetail, listWithPagePurchaseInfo, addressGet, addressSave }
\ No newline at end of file \ No newline at end of file
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;
}
.purchase .container {
background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 20px;
}
.purchase .m-b-20 {
margin-bottom: 20px;
}
.purchase .p-t-20 {
padding-top: 20px;
}
.pointer{
cursor: pointer;
}
.carIcon {
display: inline-block;
width: 22px;
height: 22px;
background: url(../../images/shoppingCarIcon.webp) no-repeat;
background-size: 100% 100%;
margin-right: 4px;
}
\ No newline at end of file \ No newline at end of file
/**
* 根据路由匹配地址
* @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 \ 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: () => { }
}
},
mounted() { },
methods: {
// 选择框-添加其他属性
selectAddAttr(value, targetItem) {
targetItem.changeAttr && targetItem.changeAttr(value, targetItem)
},
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 \ 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>
/*
* @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'
Vue.component('glsx-dialog', glsxDialog)
Vue.component('GlsxCombiForm', GlsxCombiForm)
\ No newline at end of file \ No newline at end of file
/*
* @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: 'orderManage', mockUrl: 'https://oss-config.glsx.com.cn/mock/64423183e60bb539e414ec67/orderManage/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
}
}
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 './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.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: '/'
},
{
name: 'orderManage',
path: '/orderManage/index',
component: resolve => require([`@/views/orderManage/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 } 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)
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 \ 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 tableData = [
{
"id": 87,
"orderCode": "CG202303246031",
"totalPrice": 2000,
"orderTime": 1679628260000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 2,
"putTime": 1679628300000,
"putMerchantId": 44211025,
"putMerchantName": "流程测试园区门店",
"status": 2,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 2,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": "23213123321",
"deliveryCompany": "顺丰",
"yqMerchantIds": null
},
{
"id": 86,
"orderCode": "CG202303245909",
"totalPrice": 200,
"orderTime": 1679627865000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 2,
"putTime": 1679627971000,
"putMerchantId": 44211025,
"putMerchantName": "流程测试园区门店",
"status": 2,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 2,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": "202303113333",
"deliveryCompany": "顺丰",
"yqMerchantIds": null
},
{
"id": 85,
"orderCode": "CG202303074278",
"totalPrice": 222,
"orderTime": 1678175926000,
"merchantId": 44211753,
"merchantName": "权限验证门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "test",
"contactPhone": "13156464645",
"contactAddress": "test",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
},
{
"id": 84,
"orderCode": "CG202303062215",
"totalPrice": 2,
"orderTime": 1678094753000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
},
{
"id": 83,
"orderCode": "CG202303061686",
"totalPrice": 80,
"orderTime": 1678094729000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
},
{
"id": 82,
"orderCode": "CG202303061255",
"totalPrice": 100,
"orderTime": 1678094705000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
},
{
"id": 81,
"orderCode": "CG202303068699",
"totalPrice": 200,
"orderTime": 1678094690000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
},
{
"id": 80,
"orderCode": "CG202303061510",
"totalPrice": 88,
"orderTime": 1678094683000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
},
{
"id": 79,
"orderCode": "CG202303068980",
"totalPrice": 266,
"orderTime": 1678094455000,
"merchantId": 44211452,
"merchantName": "lsq园区店02",
"putStatus": 2,
"putTime": 1678938194000,
"putMerchantId": 44211452,
"putMerchantName": "lsq园区店02",
"status": 2,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 2,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "刘世权",
"contactPhone": "15089782612",
"contactAddress": "广东省深圳市龙岗区坂田街道",
"deliveryNumber": "202303061722",
"deliveryCompany": "wllw",
"yqMerchantIds": null
},
{
"id": 78,
"orderCode": "CG202303068011",
"totalPrice": 66,
"orderTime": 1678094339000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
}
]
\ No newline at end of file \ No newline at end of file
export function debounce(func, wait = 200) {
let timeout;
return function (event) {
clearTimeout(timeout)
timeout = setTimeout(() => {
func.call(this, event)
}, wait)
}
}
export 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
}
/**
* 校验手机号码格式
*/
export 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)
}
<!-- 专区管理 -->
<template>
<div class="marketing p-t-20">
<div class="m-b-20">
<el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">新建</el-button>
</div>
<div class="container">
<el-form :inline="true">
<el-form-item label="专区名称">
<el-input style="width: 215px;" :size="size" v-model="searchForm.zoneName"></el-input>
</el-form-item>
<el-form-item class="search-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="default" @click="handleReset">查询</el-button>
</el-form-item>
</el-form>
<!-- 表格区域 开始 -->
<GLTable
ref="zoneRef"
: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="handleEdit(2, scope.scope)">编辑</el-button>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
export default {
name: 'zoneList',
data() {
return {
size: 'small',
url: url,
searchForm: {
zoneName: '',
createDate: []
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '专区名称',
name: 'zoneName',
type: 'input',
maxlength: 20
},
{
label: '创建日期',
name: 'createDate',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
}
],
// 表格
getListApi: this.$apis.zoneList.getZoneListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '专区名称',
prop: 'zoneName'
},
{
label: '创建日期',
prop: 'createdDate',
width: '180',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
mounted() {},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
params.zoneType = '2' //专区类型(1发现频道,2商城专区)
if (this.searchForm.createDate.length) {
params.startTime = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endTime = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.createDate
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
delete this.tableSearchForm.createDate
resolve()
})
},
// 1-新增;2-编辑
handleEdit(addOrEdit, row) {
this.$message({
type: 'success',
message: addOrEdit == '1' ? '新增' : '编辑'
})
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.zoneRef.data.length ? (this.$refs.zoneRef.tableHeightValues = '') : this.$refs.zoneRef.setTableHeightFun()
},
handleSearch() {
this.$refs.zoneRef.refreshTable()
},
handleReset() {
this.searchForm = {
zoneName: ''
}
this.handleSearch()
}
}
}
</script>
<style scoped>
.marketing .search-btns {
float: right;
margin-right: 0;
}
</style>
<template>
<div>
<div>
<el-form ref="form"
:model="company"
label-width="154px"></el-form>
</div>
<div class="member-wrapper">
<div class="member-left">
<div class="member-content">
<div class="member-content-head">
<el-checkbox :indeterminate="isIndeterminate"
v-model="checkAll"
@change="handleCheckAllChange">全选</el-checkbox>
</div>
<div class="table-content">
<el-input size="medium"
v-model="filterText"
suffix-icon="el-icon-search"
clearable
placeholder="请输入搜索关键字"></el-input>
<el-tree :data="departmentList"
:default-expanded-keys="expandedKeys"
show-checkbox
ref="tree"
node-key="id"
:props="defaultProps"
@check="handleNodeClick"
:filter-node-method="filterNode"></el-tree>
</div>
</div>
</div>
<div class="member-right">
<div class="member-name member-content-head">
<div>已选名称</div>
<div class="blue"
@click="clear">清空</div>
</div>
<div class="input-tag-wrapper">
<div class="tag-box">
<el-tag v-for="(label, idx) in userList"
:key="idx"
type="info"
closable
:disable-transitions="false"
@close="remove(idx)">
{{ label.name }}
</el-tag>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
newArr: [],
filterText: '',
userList: [],
isIndeterminate: false,
checkAll: false,
ids: [],
selectIds: [],
expandedKeys: [],
defaultIds: [],
departmentList: [],
defaultProps: {
children: 'children',
label: 'name'
}
}
},
props: {
merchantId: {
type: String,
default: ''
},
selectlist: {
type: Array,
default: () => []
}
},
created() {
this.getDepartmentTree()
},
watch: {
filterText(val) {
console.log(val)
this.$refs.tree.filter(val)
},
selectlist(val) {
this.defaultData()
}
},
methods: {
clear() {
this.userList = []
this.$refs.tree.setCheckedKeys([])
this.handleNodeClick()
},
handleCheckAllChange(val) {
// console.log(this.ids)
val ? this.$refs.tree.setCheckedKeys(this.ids) : this.$refs.tree.setCheckedKeys([])
this.handleNodeClick()
this.isIndeterminate = false
},
defaultData() {
this.defaultIds = this.selectlist.map(item => item.staffId)
this.$refs.tree.setCheckedKeys(this.defaultIds)
this.handleNodeClick()
},
getMerchantList() {
this.$apis.battle.getMerchantList({}).then(res => {
this.merchantList = res
this.merchantId = this.merchantList[0].merchantId
this.merchantName = this.merchantList[0].merchantName
})
},
async getDepartmentTree() {
let params = { addChildrensFlag: true, queryMerchantId: this.merchantId }
// let params = { addChildrensFlag: true, queryMerchantId: '44210895' }
let data = await this.$apis.battle.getlistDepartmentTree(params)
this.ids = []
this.departmentList = data
await this.initData(this.departmentList)
this.expandedKeys = [this.departmentList[0].id]
this.$nextTick(() => {
if (this.selectlist.length > 0) {
this.defaultData()
}
})
},
initData(data) {
data.forEach((item, index) => {
this.$set(item, 'name', item.staffName ? item.staffName : item.departmentName)
let entmicroStaffResponses = this.$common.utils.deepClone(item.entmicroStaffResponses) || []
entmicroStaffResponses = entmicroStaffResponses.filter((staff, idx) => {
if (staff.staffName) {
this.$set(staff, 'name', staff.staffName)
} else {
this.$set(staff, 'name', staff.departmentName)
}
if (staff.staffId && !this.ids.includes(staff.staffId)) {
this.ids.push(staff.staffId)
return true
} else if (staff.staffId && this.ids.includes(staff.staffId)) {
return false
}
})
let child = this.$common.utils.deepClone(item.children) || []
child = child.filter((staff, idx) => {
if (staff.staffName) {
this.$set(staff, 'name', staff.staffName)
} else {
this.$set(staff, 'name', staff.departmentName)
}
if (staff.staffId && !this.ids.includes(staff.staffId)) {
this.ids.push(staff.staffId)
return true
} else if (staff.staffId && this.ids.includes(staff.staffId)) {
return false
} else if (staff.entmicroStaffResponses) {
staff.staffId = staff.id
return true
}
})
const children = [...child, ...entmicroStaffResponses]
item.children = children
//清除没有员工的部门
if (!item.staffName && item.entmicroStaffResponses === null) {
data.splice(index, 1)
}
children.length && this.initData(children)
})
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
search() { },
handleNodeClick() {
this.userList = this.$refs.tree.getCheckedNodes().filter(item => item.children && item.children.length == 0)
this.isIndeterminate = this.userList.length > 0 && this.userList.length < this.ids.length
this.checkAll = this.userList.length === this.ids.length
},
remove(index) {
this.userList.splice(index, 1)
let ids = this.userList.map(item => item.staffId)
this.$refs.tree.setCheckedKeys(ids)
this.isIndeterminate = ids.length < this.ids.length
}
}
}
</script>
<style scoped lang="scss">
.member-wrapper {
display: flex;
.member-left {
width: 400px;
.member-content {
border: 1px solid #eee;
.member-content-head {
height: 44px;
line-height: 44px;
padding: 0 16px;
}
.member-form {
padding: 10px 20px;
}
.table-content {
max-height: 456px;
overflow: auto;
border: 1px solid #eee;
.el-input {
margin: 20px 20px 6px 20px;
width: 360px;
height: 36px;
box-sizing: border-box;
}
}
}
.member-checked {
text-align: right;
margin-top: 10px;
}
}
.member-right {
width: 264px;
margin-left: 14px;
.member-name {
font-size: 14px;
color: #333;
line-height: 44px;
height: 44px;
border: 1px solid #eee;
display: flex;
justify-content: space-between;
align-items: center;
.blue {
color: #5850ff;
cursor: pointer;
}
}
}
}
.table-content {
max-height: 456px;
overflow: auto;
border: 1px solid #eee;
}
.table-content .el-tree {
margin: 0 20px 20px;
}
.member-right {
width: 300px;
margin-left: 14px;
}
.member-name {
font-size: 14px;
color: #333;
line-height: 60px;
height: 60px;
padding: 0 20px;
border: 1px solid #eee;
}
.input-tag-wrapper {
max-height: 456px;
overflow: scroll;
}
.tag-box {
margin: 12px 8px;
.el-tag {
margin-right: 4px;
margin-bottom: 4px;
background-color: #fff !important;
font-weight: 400;
font-size: 14px;
color: #666666;
line-height: 20px;
padding: 3px 8px;
height: auto;
}
}
</style>
<template>
<div class="el-select-dropdown el-popper group-select" :style="groupStyle">
<slot></slot>
</div>
</template>
<script>
export default {
name: 'ElSelectDropdown',
props: {
appendToBody: {
type: Boolean,
default: true
},
domEl: {
type: Object,
default: () => {}
}
},
componentName: 'selectyy',
data() {
return {
groupStyle: '',
includeData:['el-input__inner','placeholder','el-select__caret el-input__icon el-icon-arrow-up']
}
},
mounted() {
if (this.appendToBody) document.body.appendChild(this.$el)
this.getBoundingClientRect()
window.addEventListener('resize', this.getBoundingClientRect)
document.addEventListener('click', e => {
if (!this.includeData.includes(e.target.className)) {
this.removeEl()
}
})
},
methods: {
getBoundingClientRect() {
let { left, top } = this.domEl.getBoundingClientRect()
this.groupStyle = { left: left + 'px', top: top + 45 + 'px' }
},
removeEl() {
document.body.contains(this.$el) && document.body.removeChild(this.$el)
this.$emit('changeStatu')
}
},
beforeDestroy() {
this.removeEl()
}
}
</script>
<style lang="scss" scoped>
.group-select {
min-width: 284px;
transform-origin: center top;
z-index: 10000;
position: fixed;
top: 740px;
left: 600px;
/deep/ .el-select-dropdown__item {
width: 236px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
}
</style>
<template>
<div class="activity">
<GLTabs v-model="activeName"
:tabPaneList="tabPaneList"
@tab-click="handleClick"></GLTabs>
<!-- 表格区域 开始 -->
<!-- <div class="container">
<GLCombiForm ref="showSearch"
:rowNumber="1"
:formObj="tableSearchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"></GLCombiForm>
<div class="flex-between title">
<div class="title-text">专员列表</div>
<template v-if="activeName == 'first'">
<el-button :size="size"
type="primary"
class="battle-set-btn"
@click="battleSetHandle">批量配置专员</el-button>
</template>
</div>
<GLTable ref="battleRef"
:getListApi="getListApi"
:noDataImg="url"
:searchForm="tableSearchForm"
:tableParams="tableParams"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
@setTableFinishFun="setTableFinishFun"
@selectionTable="selectionTable">
<div slot="activityTime"
slot-scope="scope">
{{ dateFormatFun(scope.scope.startTime) }}-{{ dateFormatFun(scope.scope.endTime) }}</div>
<div class="table-btns"
slot="auth-button"
slot-scope="scope">
<el-button type="text"
@click="handleClose(scope.scope, 'close')"
v-if="scope.scope.actionReportSendFlag == 1">关闭</el-button>
<el-button type="text"
@click="handleClose(scope.scope, 'open')"
v-else>打开</el-button>
<el-button type="text"
v-if="scope.scope.reportStaffs.length == 0"
@click="handlebattleOn(scope.scope)">配置</el-button>
<el-button type="text"
v-else
@click="handlebattleOn(scope.scope, 'edit')">编辑</el-button>
</div>
</GLTable>
</div> -->
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { dateFormat } from '../../utils/index'
export default {
components: {
},
data() {
return {
activeName: "1",
tabPaneList: [
{
label: "精品升级",
name: "1"
},
{
label: "众筹",
name: "2"
},
{
label: "车损升级",
name: "3"
}
],
tabName: "Order"
}
},
mounted() {
// this.getOptionsList('searchFormData')
// this.getCrowdfundingParams()
// this.getMerchantList()
},
computed: {
// domEl() {
// return this.$refs.groupRef
// },
// automaticEl() {
// return this.$refs.automaticRef
// },
// happyEl() {
// return this.$refs.happyRef
// }
},
watch: {
// activeName: {
// handler(val) {
// if (val == 'first') {
// this.tableParams.tableOption = true
// this.$nextTick(() => {
// this.tableParams.mutiSelectUniqueKey = 'activityId'
// this.tableParams.mutiSelectName = 'activityId'
// })
// } else {
// this.tableParams.tableOption = false
// this.$nextTick(() => {
// this.tableParams.mutiSelectUniqueKey = ''
// this.tableParams.mutiSelectName = ''
// })
// }
// },
// immediate: true
// },
// idBefEncryptionBattle(val) {
// this.importGroup()
// },
// idBefEncryptionGood(val) {
// this.importGroup()
// },
// filterText(val) {
// this.$refs.tree.filter(val)
// },
// filterTextH(val) {
// this.$refs.treeH.filter(val)
// },
// roomName(val) {
// this.filterRoomName(val)
// }
},
methods: {
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)
}
}
})
}
},
async getCrowdfundingParams() {
/**参数类型 1:众筹活动名称(返回类型String),2:众筹活动门店 */
const funding = await this.$apis.seckillActivity.getCrowdfundingParams({
parameterType: 1
})
const gold = await this.$apis.seckillActivity.getCrowdGoldParams({
parameterType: 1
})
const activity = [...funding?.parameters, ...gold?.parameters]
let activityNameList = []
activity.map(e => {
activityNameList.push({
confId: e,
confName: e
})
})
this.$set(this.searchFormData[1], 'optionList', this.$common.utils.deepClone(activityNameList))
},
clearData() {
// this.setectList = []
this.config.merchantId = this.merchantId
this.config.staffType = '2'
this.wechat = {
battleStaffName: '',
goodStaffName: '',
roomName: ''
}
this.groupName = ''
this.hideSelect()
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
filterRoomName(value) {
this.stageList = this.groupList.filter(item => {
if (item.roomName.indexOf(value) !== -1) {
return item
}
})
},
handleNodeClick(data) {
this.setSendName(data.name, data.staffId)
// this.wechat.roomName = ''
if (this.menuIndex == 1) {
this.idBefEncryptionBattle = data.idBefEncryption
}
if (this.menuIndex == 2) {
this.idBefEncryptionGood = data.idBefEncryption
}
this.hideSelect()
},
setSendName(name, staffId, isClear, i) {
console.log(staffId, this.wechat.battleStaffId, i)
if (this.menuIndex == 1 || i == 1) {
if (staffId == this.wechat.battleStaffId && staffId) return
Object.assign(this.wechat, { battleStaffName: name, battleStaffId: staffId })
}
if (this.menuIndex == 2 || i == 2) {
if (staffId == this.wechat.goodStaffId && staffId) return
Object.assign(this.wechat, { goodStaffName: name, goodStaffId: staffId })
}
console.log(this.wechat)
if (isClear && !this.wechat.battleStaffName && !this.wechat.goodStaffName) {
this.wechat.roomName = ''
this.groupList = []
return
}
if (isClear && (this.wechat.battleStaffName || this.wechat.goodStaffName)) return
this.wechat.roomName = ''
this.getGroupList()
},
hideSelect() {
this.menuIndex = 0
},
selectGroup(data) {
this.hideSelect()
this.wechat.roomName = data.roomName
const { goodStaffId, battleStaffId } = this.wechat
if (this.wechat.battleStaffName) {
const staffCloudId = data.staffInfoList.find(i => i.staffId == battleStaffId)?.staffCloudId
this.wechat.battleGroupId = staffCloudId + '_R:' + data.roomIdOnly
}
if (this.wechat.goodStaffName) {
const staffCloudId = data.staffInfoList.find(i => i.staffId == goodStaffId)?.staffCloudId
this.wechat.goodGroupId = staffCloudId + '_R:' + data.roomIdOnly
}
// this.wechat.groupId = data.roomChatId
},
importGroup() {
if (this.wechat.roomName) return
if (this.wechat.battleStaffName) {
this.wechat.battleGroupId = this.idBefEncryptionBattle + '_R:' + this.groupName
}
if (this.wechat.goodStaffName) {
this.wechat.goodGroupId = this.idBefEncryptionGood + '_R:' + this.groupName
}
},
openMenu(e) {
if (e == this.menuIndex) return (this.menuIndex = 0)
this.menuIndex = e
},
removeStaff(index) {
this.userList.splice(index, 1)
},
//所属企业
changeRadio(val) {
if (this.config.staffType == 1) this.getDepartmentTree()
this.merchantList.forEach(item => {
item.merchantId == val ? (this.merchantName = item.merchantName) : ''
})
this.userList = []
},
getMerchantList() {
this.$apis.battle.getMerchantList({}).then(res => {
this.merchantList = res
this.config.merchantId = this.merchantList && this.merchantList[0].merchantId
this.merchantId = this.merchantList && this.merchantList[0].merchantId
this.merchantName = this.merchantList && this.merchantList[0].merchantName
})
},
changeType(val) {
if (val == 1) {
this.getDepartmentTree()
} else {
this.userList = []
}
},
handleClose(scope, status) {
const info = status == 'close' ? '关闭' : '打开'
const infoN = status == 'close' ? '取消' : '恢复'
this.$confirm(`${info}则${infoN}战报发送功能,是否确认${info}?`, info, {
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning'
})
.then(() => {
this.activityOpen(scope)
})
.catch(() => {
// this.$message({
// type: 'info',
// message: '已取消'
// })
})
},
activityOpen(scope) {
const { activityId, actionReportSendFlag } = scope
this.$apis.battle
.activityOpen({
activityId,
actionReportSendFlag: actionReportSendFlag == 1 ? 2 : 1
})
.then(res => {
if (res) {
this.handleSearch()
this.$message.success('操作成功')
}
})
},
battleSetHandle() {
if (this.setectList.length == 0) {
this.$message({
message: '请选择活动',
type: 'error'
})
return
}
this.getDepartmentTree()
this.userList = []
// this.editStatus = false
this.battleVisible = true
},
dateFormatFun(date) {
return dateFormat(date)
},
selectionTable(val) {
this.setectList = val
},
handlestaffbattleConfirm() {
this.battlestaffVisible = false
this.userList = this.$refs.selectMember.userList
},
handlestaffbattleClose() {
this.battlestaffVisible = false
},
openMembers() {
this.battlestaffVisible = true
// if (this.ids.length > 0) {
// this.$refs.selectMember.$refs.tree.setCheckedKeys(this.ids)
// }
},
handlebattleConfirm() {
if (this.userList.length == 0) {
this.$message({
message: '请选择专员',
type: 'error'
})
return
}
if (this.wechat.battleStaffName !== '' && this.wechat.roomName == '' && !this.groupName) {
this.$message({
message: '请选择关联群',
type: 'error'
})
return
}
let staffRequestList = []
let batchstaffRequestList = []
this.userList.forEach(item => {
staffRequestList.push({
staffId: item.staffId,
staffName: item.staffName,
merchantId: this.config.merchantId,
merchantName: this.merchantName,
userId: item.userId
})
})
const setectList = this.setectEditList.length ? this.setectEditList : this.setectList
setectList.forEach(item => {
let autoStaff = {}
if (Object.keys(this.wechat).length) {
const { battleStaffId, battleStaffName, battleGroupId, goodStaffName, roomName, goodGroupId, goodStaffId } = this.wechat
autoStaff = {
battleStaffId,
battleStaffName,
battleGroupId,
goodGroupId,
goodStaffName,
goodStaffId,
autoGroupName: roomName ? roomName : this.groupName,
autoGroupMerchantId: this.$merchantId
}
}
batchstaffRequestList.push({
activityId: item.activityId,
...autoStaff,
staffRequestList
})
})
this.$apis.battle.insertStaff({ batchstaffRequestList, staffType: this.config.staffType }).then(res => {
this.$message({
message: res.code == '0' ? '配置成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.data) {
this.battleVisible = false
this.handleSearch()
this.activeName = 'first'
this.clearData()
}
})
},
handlebattleClose() {
this.clearData()
this.setectEditList = []
this.battleVisible = false
},
handleDetails() { },
handlebattleOn(data, sign) {
this.setectEditList = []
this.userList = []
this.wechat = {
battleStaffName: '',
roomName: '',
goodStaffName: ''
}
this.setectEditList.push(data)
this.battleVisible = true
if (sign) {
this.getStaffList(data)
}
this.getDepartmentTree()
},
clearWechat(i) {
this.setSendName('', '', true, i)
},
//获取编辑
getStaffList(data) {
this.$apis.battle.getStaffList({ id: data.activityId }).then(res => {
this.config.merchantId = res.staffs[0].merchantId
this.merchantId = res.staffs[0].merchantId
this.merchantName = res.staffs[0].merchantName
this.userList = res.staffs
this.config.staffType = res.staffType + ''
// this.wechat.staffId = res.autoStaffId
// this.wechat.battleStaffName = res.autoStaffName
// this.wechat.groupId = res.autoGroupId
// this.wechat.roomName = res.autoGroupName
const { goodStaffId, goodStaffName, battleStaffId, battleStaffName, goodGroupId, battleGroupId, autoGroupName, autoGroupMerchantId } = res
this.wechat = {
goodStaffId,
goodStaffName,
battleStaffId,
battleStaffName,
goodGroupId,
battleGroupId,
roomName: '',
autoGroupMerchantId
}
const groupId = battleGroupId || goodGroupId
if (groupId.split('_R:')[1] == autoGroupName) {
this.groupName = autoGroupName
this.idBefEncryptionBattle = battleGroupId.split('_R:')[0]
this.idBefEncryptionGood = goodGroupId.split('_R:')[0]
} else {
this.wechat.roomName = autoGroupName
}
this.getGroupList(this.wechat.staffId)
})
},
getGroupList(id) {
const { battleStaffId, goodStaffId } = this.wechat
const msgStaffIdList = [battleStaffId, goodStaffId]
this.$apis.battle.getGroupList({ msgStaffIdList, unionRoom: true }).then(res => {
if (res.code == 0) {
this.groupList = res.data
}
})
},
handleSetting() {
this.drawer = true
},
handleClick() {
let arr = {
1: "order",
2: "crowd-funding",
3: "carDamage"
}
this.tabName = arr[+this.activeName]
},
handleReset() {
this.tableSearchForm = {}
this.handleSearch()
},
getParams() {
let params = {
...this.tableSearchForm
}
this.activeName == 'first' ? (params.activityStatus = 2) : (params.activityStatus = 3)
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.battleRef.data.length ? (this.$refs.battleRef.tableHeightValues = '') : this.$refs.battleRef.setTableHeightFun()
},
handleSearch() {
this.$refs.battleRef.refreshTable()
},
async getDepartmentTree() {
// let params = { addChildrensFlag: true, queryMerchantId: this.config.merchantId,loginStatus:1 }
let params = { addChildrensFlag: true, queryMerchantId: this.$merchantId, loginStatus: 1 }
let data = await this.$apis.battle.getlistDepartmentTree(params)
this.ids = []
this.automaticData = data
await this.initData(this.automaticData)
this.expandedKeys = [this.automaticData[0]?.id]
},
initData(data) {
data.forEach((item, index) => {
this.$set(item, 'name', item.staffName ? item.staffName : item.departmentName)
let entmicroStaffResponses = this.$common.utils.deepClone(item.entmicroStaffResponses) || []
entmicroStaffResponses = entmicroStaffResponses.filter((staff, idx) => {
if (staff.staffName) {
this.$set(staff, 'name', staff.staffName)
} else {
this.$set(staff, 'name', staff.departmentName)
}
if (staff.staffId && !this.ids.includes(staff.staffId)) {
this.ids.push(staff.staffId)
return true
} else if (staff.staffId && this.ids.includes(staff.staffId)) {
return false
}
})
let child = this.$common.utils.deepClone(item.children) || []
child = child.filter((staff, idx) => {
if (staff.staffName) {
this.$set(staff, 'name', staff.staffName)
} else {
this.$set(staff, 'name', staff.departmentName)
}
if (staff.staffId && !this.ids.includes(staff.staffId)) {
this.ids.push(staff.staffId)
return true
} else if (staff.staffId && this.ids.includes(staff.staffId)) {
return false
} else if (staff.entmicroStaffResponses) {
staff.staffId = staff.id
return true
}
})
const children = [...child, ...entmicroStaffResponses]
item.children = children
//清除没有员工的部门
if (!item.staffName && item.entmicroStaffResponses === null) {
// data.splice(index, 1)
}
children.length && this.initData(children)
})
}
}
}
</script>
<style scoped lang="scss">
.activity {
/deep/ {
.el-select .el-tag {
max-width: 60% !important;
}
.el-form-item__content {
overflow: inherit !important;
}
}
.container {
margin-top: 16px;
.title {
height: 32px;
line-height: 32px;
margin-bottom: 10px;
.title-text {
font-weight: 600;
font-size: 16px;
color: #333333;
margin-left: 4px;
}
}
}
.empty-btn {
position: absolute;
right: -40px;
top: 0px;
font-size: 14px;
color: #5850ff;
}
.config-pannel {
background: #f9f9f9;
width: 520px;
height: 168px;
display: flex;
.config-item {
padding: 26px 20px;
}
.clear-btn {
cursor: pointer;
background: #f1f1f1;
width: 40px;
height: 100%;
line-height: 20px;
font-size: 14px;
color: #666666;
padding: 60px 13px;
box-sizing: border-box;
}
}
.input-tag-wrapper {
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px;
max-height: 68px;
overflow: auto;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 450px;
display: flex;
align-items: center;
margin-top: 6px;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
/deep/ .el-tag {
background-color: #fff !important;
margin-bottom: 4px;
}
}
.select-wrap {
.common {
margin: 4px 0;
height: 40px !important;
overflow: hidden;
/deep/ .el-input {
height: 40px !important;
line-height: 40px !important;
}
/deep/ .el-input__suffix {
height: 40px !important;
margin-top: -4px;
.is-reverse {
transform: rotate(180deg);
}
}
}
}
}
.search-groomname {
width: 252px;
margin: 12px 16px 0;
/deep/.el-input {
width: 252px;
}
}
.filter-tree {
padding: 0 16px;
}
.empty {
padding: 10px 0;
margin: 0;
text-align: center;
color: #999;
font-size: 13px;
}
.placeholder {
font-size: 14px;
color: #c0c6ce;
line-height: 20px;
}
</style>
<!-- 采购商城 -->
<template>
<div class="mallContainer">
<div class="bg header addressCon" slot="header">
<div class="addressTitle">
<img src="@/images/addressIcon.webp" alt="" class="icon" />
<span class="title">{{ $$(addressInfo, 'yqMerchantName') }}</span>
<span class="edit pointer" @click="addressComVisible = true">
<img src="@/images/editAddressIcon.webp" alt="" class="editIcon" />
修改
</span>
</div>
<div class="addressInfo">
<!-- 收货人:白敬亭 -->
<span class="name">
收货人:
<span class="label">{{ $$(addressInfo, 'contactName') }}</span>
</span>
<span class="phone">
电话:
<span class="label">{{ $$(addressInfo, 'contactPhone') }}</span>
</span>
<span class="address">
收货地址:
<span class="label">{{ $$(addressInfo, 'contactAddress') }}</span>
</span>
</div>
</div>
<div class="d2-container-content shopMallCon">
<!-- :stretch="false" -->
<div class="classifyContainer">
<el-tabs v-model="searchForm.goodsType" @tab-click="handleSearch" type="card">
<el-tab-pane v-for="(item, i) in navList" :key="i" class="tabItem" :label="item.goodsTypeName" :name="item.goodsType"></el-tab-pane>
</el-tabs>
</div>
<div class="searchCon">
<GLCombiForm ref="showSearch" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleRest"></GLCombiForm>
</div>
<div class="goodsCon">
<div class="goodsItemCon" v-for="(item, index) in purchaseList" :class="[{ active: item.active }, { last: index === purchaseList.length - 1 }]" :key="index" >
<!-- 图片{{ item.thumbUrl }} -->
<img :src="item.thumbUrl" class="img" alt="" />
<span class="goodsName one-line-ellipsis">{{ item.goodsName }}</span>
<!-- 名称{{ item.goodsName }} -->
<span class="purchaseOrderCount">成交量/笔:{{ item.purchaseOrderCount }}</span>
<!-- 成交量{{ item.purchaseOrderCount }} -->
<span class="viewPurchase pointer" @click="handleDetail(item, index)">查看购买</span>
</div>
<div class="emptyCom" v-show="!purchaseList.length">
<img :src="emptyImgUrl" class="emptyImg" alt="" />
<span class="tips">暂无数据</span>
</div>
</div>
<div class="pageCon">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page.pageNum" :page-sizes="[10, 20, 30, 40]" :page-size="page.pageSize" :total="total" layout="->,prev,pager,next" />
</div>
</div>
<!-- 购物车组件 -->
<shoppingCartCom ref="shoppingCartCom" :address-info="addressInfo" @editAddress="orderFrom" />
<addressCom :visible.sync="addressComVisible" @handleConfirmAddress="addressGet" :address-info="addressInfo" />
<goodsDetailCom :visible.sync="goodsDetailComVisible" :goods-id="selectItem.id" />
</div>
</template>
<script>
import shoppingCartCom from './components/shoppingCartCom'
import addressCom from './components/addressCom'
import goodsDetailCom from './components/goodsDetailCom'
export default {
name: 'PurchasingMall',
components: {
shoppingCartCom,
addressCom,
goodsDetailCom
},
data() {
return {
// userInfo: this.$store.state.d2admin.user.info,
addressComVisible: false,
goodsDetailComVisible: false,
emptyImgUrl: require('@/assets/empty.png'),
showFormData: [
{
name: 'goodsName',
type: 'input',
placeholder: '商品名称/系列',
width: '282px'
}
],
searchForm: {
goodsType: '',
goodsName: ''
},
total: 0,
page: {
pageNum: 1,
pageSize: 12
},
navList: [],
purchaseList: [],
addressInfo: {
contactName: '',
contactPhone: '',
contactAddress: '',
yqMerchantName: '',
yqMerchantId: ''
},
productType: [],
selectItem: {},
showOrderCom: false
}
},
created() {
this.getGoodsCategoryConfiguration()
this.listWithPagePurchaseInfo()
this.addressGet()
},
mounted() {},
methods: {
orderFrom() {
this.addressComVisible = true
this.showOrderCom = true
},
handleSearch() {
this.page.pageNum = 1
this.listWithPagePurchaseInfo()
},
handleRest() {
this.searchForm.goodsName = ''
this.page.pageNum = 1
this.listWithPagePurchaseInfo()
},
handleDetail(item, index) {
this.selectItem = item
this.goodsDetailComVisible = true
const list = this.$common.utils.deepClone(this.purchaseList)
this.purchaseList = list.map((item, itemIndex) => {
item.active = itemIndex == index
return item
})
},
listWithPagePurchaseInfo() {
const params = {
...this.page,
goodsType: +this.searchForm.goodsType || '',
goodsName: this.searchForm.goodsName
}
this.$apis.purchaseShopping
.listWithPagePurchaseInfo(params)
.then(result => {
const { list, total } = result
this.purchaseList = list
this.total = total
})
.catch(err => {
console.log(err)
})
},
// 获取类目列表
getGoodsCategoryConfiguration() {
this.$apis.sysBase.getGoodsCategoryConfiguration({ sceneType: 1, shoppingMallFlag: true }).then(result => {
const { list } = result
if (list.length) {
const navList = list.map(({ categoryType, categoryName }) => {
return {
goodsType: categoryType.toString(),
goodsTypeName: categoryName
}
})
this.navList = [{ goodsType: '', goodsTypeName: '所有' }, ...navList]
}
})
},
addressGet() {
this.$apis.purchaseShopping
.addressGet()
.then(result => {
if (result) {
this.addressInfo = result
}
if (this.showOrderCom) {
this.showOrderCom = false
this.$refs.shoppingCartCom.validateGoodsNumber()
}
})
.catch(err => {
console.log(err)
})
},
// 每页条数
handleSizeChange(value) {
// this.page.pageSize = value
// this.getList()
},
// 页码
handleCurrentChange(value) {
this.page.pageNum = value
this.listWithPagePurchaseInfo()
}
},
beforeDestroy() {
// this.$EventBus.$off('updateCarShopping')
}
}
</script>
<style lang="scss" scoped>
::v-deep.mallContainer {
max-width: 1350px;
margin: 0 auto;
overflow: scroll;
.bg {
background: #fff;
}
.d2-header-switch {
display: none;
}
.d2-container-content {
margin: 20px auto;
background: #fff;
}
.shopMallCon {
padding: 0 0 20px !important;
}
.goodsCon {
box-sizing: border-box;
padding: 0 40px;
display: flex;
// justify-content: space-between;
flex-wrap: wrap;
.goodsItemCon {
box-sizing: border-box;
width: 177px;
height: 272px;
display: flex;
flex-direction: column;
background: #f9f9f9;
border-radius: 4px;
// margin-bottom: 16px;
margin: 0 16px 16px;
overflow: hidden;
padding: 8px 8px 16px;
&:hover{
border: 1px solid #5850ff;
}
&.active {
border: 1px solid #5850ff;
}
.img {
width: 157px;
height: 157px;
margin-bottom: 8px;
}
.goodsName {
font-weight: 600;
color: #333333;
margin-bottom: 8px;
}
.purchaseOrderCount {
font-size: 12px;
color: #666666;
margin-bottom: 16px;
}
.viewPurchase {
font-size: 14px;
color: #5850ff;
}
}
.last {
margin-right: auto;
}
}
.emptyCom {
display: flex;
flex-direction: column;
margin: 75px auto;
text-align: center;
.tips {
font-size: 20px;
color: #666;
margin: 16px 0;
}
}
.d2-container-full__body {
overflow-x: hidden !important;
}
}
.addressCon {
padding: 10px 20px;
.addressTitle {
display: flex;
align-items: center;
.title {
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 16px;
color: #333333;
}
.edit {
display: flex;
align-items: center;
margin-left: auto;
font-size: 14px;
color: #5850ff;
}
.editIcon {
width: 20px;
height: 20px;
}
}
.icon {
width: 32px;
height: 32px;
margin-right: 8px;
}
.addressInfo {
display: flex;
box-sizing: border-box;
flex-wrap: wrap;
// align-items: space-between;
align-items: center;
// justify-content: space-between;
width: 100%;
// height: 36px;
padding: 15px 20px 0;
margin-top: 10px;
background: #f9f9f9;
font-size: 14px;
color: #666666;
> span {
margin-right: 25px;
margin-bottom: 15px;
}
.label {
color: #333333;
// margin-left: 0px;
}
.address {
min-width: 500px;
}
}
}
.searchCon {
height: 65px;
.show-search {
width: 670px !important;
min-width: 670px;
}
/deep/ .name {
width: 20px !important;
}
}
::v-deep.classifyContainer {
width: 100%;
.el-tabs__nav {
border-top: none !important;
}
}
</style>
<template>
<el-drawer class="shoppingCartDrawerCon" title="收货地址管理" size="500px" :visible.sync="dialogShow" :direction="direction">
<glsx-combi-form class="edit-form-container" ref="editFormRef" label-width="100px" default-width="350px"
:form-ref="editChildRef" :form-obj="editForm" :form-data="editFormData" :form-rules="editRule"></glsx-combi-form>
<div class="footer-btn">
<el-button @click="submit" type="primary">保存</el-button>
<el-button @click="dialogShow = false">取消</el-button>
</div>
</el-drawer>
</template>
<script>
import { checkPhone as validPhone } from '@/utils/index'
export default {
name: 'AddressCom',
props: {
visible: {
type: Boolean,
default: false
},
addressInfo: {
type: Object,
default: () => {
return {}
}
}
},
data() {
function checkPhone(rule, value, callback) {
if (!validPhone(value)) {
callback(new Error('请输入正确的手机号码'))
return false
}
callback()
}
return {
direction: 'rtl',
editFormData: [
{
label: '收货人',
name: 'contactName',
type: 'input',
maxlength: 10,
placeholder: '请输入姓名'
},
{
label: '收货人电话',
name: 'contactPhone',
type: 'input',
maxlength: 20,
placeholder: '请输入电话号码'
},
{
label: '收货地址',
name: 'contactAddress',
type: 'input',
maxlength: 50,
placeholder: '请输入收货地址',
inputType: 'textarea'
// tips: '如XX店车主关怀活动'
}
],
editForm: {
contactName: '',
contactPhone: '',
contactAddress: ''
},
editRule: {
contactName: [{ required: true, message: '请输入姓名', trigger: 'change' }],
contactPhone: [{ required: true, message: '请输入电话号码', trigger: 'change' },
{ validator: checkPhone, trigger: 'blur' }],
contactAddress: [{ required: true, message: '请输入收货地址', trigger: 'change' }]
},
editChildRef: 'editChildRef'
}
},
computed: {
dialogShow: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
watch: {
visible(val) {
if (val) {
this.editForm = this.addressInfo ? this.$common.utils.deepClone(this.addressInfo) : {}
}
}
},
methods: {
handleDetailClose() {
},
handleOkFn() {
// console.log('您点击了确定')
},
handleRestFn() {
console.log('您点击了取消')
},
submit() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
const params = this.$common.utils.deepClone(this.editForm)
this.$apis.purchaseShopping.addressSave(params).then((result) => {
this.$notify({
type: 'success',
title: '保存成功'
})
this.dialogShow = false
this.$emit('handleConfirmAddress')
}).catch((err) => {
})
}
})
},
navBack() {
}
}
}
</script>
<style lang="scss" scoped>
.shoppingCartDrawerCon {
// position: relative;
::v-deep .el-drawer__header {
border-bottom: 1px solid #e7eaec;
margin-bottom: 20px;
padding-bottom: 10px;
font-weight: 600;
font-size: 20px;
}
.footer-btn {
text-align: center;
}
}
</style>
<template>
<!-- <div>商品详情</div> -->
<GLDialog destroy-on-close="true" :visible.sync="dialogShow" :hasFooter="false" mode="big" bigTitle="产品详情" :close-on-click-modal="false" @onOk="handleSubmit" @onCancel="handleDetailClose">
<div class="detail-content">
<!-- 商品详情 -->
<div class="goodsInfoCom">
<div class="goodsInfoCom__left">
<img :src="goodsInfo.thumbUrl" alt="" />
</div>
<div class="goodsInfoCom__right">
<p class="title two-line-ellipsis">{{ goodsInfo.goodsName }}</p>
<div class="priceCon">
<span class="price">
价格:
<span class="priceNum">¥{{ handleItemInfo.purchasePrice }}</span>
</span>
<span class="turnover">
成交量:
<span class="num">{{ goodsInfo.purchaseOrderCount || 0 }}笔</span>
</span>
</div>
<div class="skuCon">
<div class="label">规格:</div>
<div class="itemCon">
<div
class="skuItem one-line-ellipsis pointer"
:class="{ active: index === selectIndex }"
v-for="(item, index) in goodsInfo.upgradeGoodsList"
:key="index"
@click="
selectIndex = index
setHandleItemInfo(item)
"
>
{{ item.upgradeGoodsName }}
</div>
</div>
</div>
<div class="munCom">
<div class="label">数量:</div>
<div class="munItem">
<el-input-number v-model="handleItemInfo.goodsNumber" :min="1" :max="9999"></el-input-number>
</div>
<div class="tips">
<!-- goodsItem.goodsType == 1 -->
{{ membraneTypeList.includes(goodsInfo.goodsType) ? `卷(1卷=${goodsInfo.convertedValue || 30}米)` : '件' }}
</div>
</div>
<el-button class="carBtn" icon="carIcon" type="primary" @click="updateCarShopping">加入购物车</el-button>
</div>
<!-- <i class="carIcon"></i> -->
</div>
<h3 style="margin-top:20px;">产品详情</h3>
<div class="goodsDescList">
<div class="goodsDescItem" v-for="(item, index) in goodsInfo.goodsDescList" :key="index">
<img :src="item.content" v-if="item.resType == 1" class="productDetailsImg" alt="" />
<!-- <div class="goodsDescItem__title">{{ item.title }}</div> -->
<div v-if="item.resType == 2" class="goodsDescItem__content" v-html="item.content"></div>
</div>
</div>
</div>
</GLDialog>
</template>
<script>
import { membraneTypeList } from '@/utils/constants.js'
export default {
name: 'GoodsDetailCom',
props: {
visible: {
type: Boolean,
default: false
},
selectItemInfo: {
type: Object,
default: () => {}
},
goodsId: {
type: [String, Number]
// required: true
// default: '24'
}
},
data() {
return {
// dialogShow: false,
membraneTypeList,
goodsInfo: {},
selectIndex: 0,
handleItemInfo: {
goodsNumber: 1,
upgradeGoodsId: '',
purchasePrice: 0
}
}
},
computed: {
dialogShow: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
// selectItemInfo(){
// // this.goodsInfo[]
// if (this.goodsInfo.upgradeGoodsList.length) {
// let item = this.goodsInfo.upgradeGoodsList[this.selectIndex]
// return {
// goodsNumber: this.goodsInfo.num,
// upgradeGoodsId: item.id
// }
// }
// // return this.selectItemInfo
// }
},
watch: {
visible(val) {
if (val) {
this.handleItemInfo.goodsNumber = 1
this.getGoodsDetail()
}
}
},
methods: {
getGoodsDetail() {
this.$apis.product.getProductInfo({ id: this.goodsId }).then(res => {
this.goodsInfo = res
// 调试用
// for (let index = 0; index < 12; index++) {
// this.goodsInfo.upgradeGoodsList[index] = this.goodsInfo.upgradeGoodsList[0]
// }
// 默认选中第一个
const item = this.goodsInfo.upgradeGoodsList[0]
// console.log(item)
item && this.setHandleItemInfo(item)
})
},
setHandleItemInfo(item) {
console.log(item)
const { id, purchasePrice } = item
this.handleItemInfo = Object.assign(this.handleItemInfo, {
upgradeGoodsId: id,
purchasePrice
})
},
handleDetailClose() {
this.dialogShow = false
},
updateCarShopping() {
const params = {
goodsNumber: this.handleItemInfo.goodsNumber,
upgradeGoodsId: this.handleItemInfo.upgradeGoodsId
}
// 判断是否有值
params.upgradeGoodsId &&
this.$apis.purchaseShopping.shoppingCarAdd(params).then(res => {
// console.log(res)
this.$message.success('加入购物车成功')
this.$EventBus.$emit('updateCarShopping')
this.dialogShow = false
})
// this.$message.success('加入购物车成功')
// this.$EventBus.$emit('updateCarShopping')
}
}
}
</script>
<style lang="scss" scoped>
.goodsInfoCom {
display: flex;
.goodsInfoCom__left {
width: 400px;
height: 400px;
img {
width: 100%;
height: 100%;
}
}
.goodsInfoCom__right {
flex: 1;
margin-left: 20px;
.title {
margin: 0;
font-weight: 600;
font-size: 20px;
color: #333333;
}
.priceCon {
box-sizing: border-box;
width: 100%;
height: 65px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 10px;
margin: 16px 0 20px;
background: #f2f5fb;
border-radius: 2px;
color: #666666;
.price {
display: flex;
align-items: center;
margin-left: 8px;
}
.num {
margin-left: 8px;
}
.priceNum {
font-weight: 600;
font-size: 30px;
color: #ee3040;
margin-left:8px;
}
}
.skuCon {
display: flex;
// flex-wrap: wrap;
// align-items: center;
.itemCon {
flex: 1;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.skuItem {
box-sizing: border-box;
width: 234px;
height: 36px;
background: #ffffff;
border: 1px solid #e7edf9;
border-radius: 2px;
color: #333333;
text-align: center;
line-height: 36px;
padding: 0 10px;
margin-bottom: 16px;
&.active {
border: 1px solid #5850ff;
}
}
}
.label {
box-sizing: border-box;
width: 60px;
height: 36px;
text-align: center;
padding-left: 18px;
line-height: 36px;
color: #666666;
}
}
}
.productDetailsImg {
max-width: fit-content;
}
.munCom {
display: flex;
margin-bottom: 20px;
.tips {
height: 36px;
line-height: 36px;
margin-left: 8px;
font-size: 12px;
color: #666666;
}
}
.carBtn {
display: flex;
align-items: center;
width: 168px;
height: 40px;
margin-left:18px;
background: #5850ff;
border-radius: 4px;
}
</style>
<template>
<GLDialog v-if="dialogShow" bigTitle="详细信息" mode="big" :visible.sync="dialogShow" :close-on-click-modal="false" @onOk="dialogShow = false" @onCancel="dialogShow = false">
<div class="detail-content" v-if="dialogShow">
<div class="addressTitle">
<img src="@/images/addressIcon.webp" alt="" class="icon" />
<span class="title">{{ paramsObj.merchantName }}</span>
</div>
<div class="address-info">
<span class="name">
收货人:
<span class="label">{{ detailInfo.contactName }}</span>
</span>
<span class="phone">
电话:
<span class="label">{{ detailInfo.contactPhone }}</span>
</span>
<span class="address">
收货地址:
<span class="label">{{ detailInfo.contactAddress }}</span>
</span>
</div>
<div class="table-class">
<GLTable ref="purchaseOrderDetailTable" :tableParams="tableParams" @refreshTable="refreshTable" :tableData="detailInfo.tableData" :pageConf="pageConf" :tableTotal="detailInfo.tableTotal"></GLTable>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" size="small" @click="dialogShow = false">关闭</el-button>
</span>
</GLDialog>
</template>
<script>
import { membraneTypeList } from '@/utils/constants.js'
export default {
name: 'OrderDetailDialog',
props: {
visible: {
type: Boolean,
default: false
},
paramsObj: {
type: Object,
default: () => {}
}
},
computed: {
dialogShow: {
get() {
if (this.visible) {
this.getDetail({ currentPage: 1, pageSize: 20 })
}
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
data() {
return {
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [
{
label: '商品名称',
prop: 'upgradeGoodsName'
},
{
label: '系列',
prop: 'goodsName'
},
{
label: '所属分类',
prop: 'goodsTypeName'
},
{
label: '采购数量',
prop: 'goodsNumber',
formatter: cellValue => {
return membraneTypeList.includes(cellValue.goodsType) ? `${cellValue.goodsNumber}卷/${cellValue.conversionValue ? cellValue.goodsNumber * cellValue.conversionValue : '-'}米` : `${cellValue.goodsNumber}件`
}
},
{
label: '采购总价/元',
prop: 'goodsTotalPrice',
formatter: cellValue => {
return '¥' + cellValue.goodsTotalPrice
}
}
]
},
detailInfo: {}
}
},
methods: {
handleDetailClose() {
this.dialogShow = false
},
refreshTable(pageObj) {
this.getDetail(pageObj)
},
getDetail(pageObj) {
this.$apis.purchaseShopping.purchaseOrderDetail({ orderCode: this.paramsObj.orderCode, pageSize: pageObj.pageSize, currentPage: pageObj.currentPage }).then(res => {
this.detailInfo = res
this.detailInfo.tableData = res.pagination.list
this.detailInfo.tableTotal = res.pagination.total
})
}
}
}
</script>
<style lang="scss" scoped>
.addressTitle {
display: flex;
align-items: center;
.title {
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 16px;
color: #333333;
}
.icon {
width: 28px;
height: 28px;
margin-right: 8px;
}
}
.address-info {
display: flex;
box-sizing: border-box;
align-items: center;
// justify-content: space-between;
flex-wrap: wrap;
width: 100%;
// height: 36px;
padding: 0 20px;
margin-top: 10px;
font-size: 14px;
color: #666666;
> span {
margin-right: 20px;
margin-bottom: 10px;
}
.label {
color: #333333;
}
.address {
min-width: 500px;
}
}
</style>
<template>
<div class="shopCarCon">
<div class="carBtnCon" :data-attr="goodsTotalNumber" @click="drawer = true">
<i class="carIcon"></i>
<span class="car-txt">购物车</span>
</div>
<el-drawer class="shoppingCartDrawerCon" title="购物车" :visible.sync="drawer" size="500px" :direction="direction">
<div class="headerCon" v-if="goodsList.length">
<div class="left">
<el-checkbox :indeterminate="isIndeterminate" @change="handleAllCheckChange(isAllCheck)" v-model="isAllCheck">全选</el-checkbox>
<!-- <input type="checkbox"
class="pointer"
/>全选 -->
</div>
<!-- :indeterminate="isIndeterminate" -->
<div class="right">
已选
<span class="red">{{ goodsSelectTotalNumber }}</span>
件,共计
<span class="red">{{ totalPrice }}</span>
元
</div>
</div>
<div class="goodsTypeCon" v-for="(item, index) in goodsList" :key="index">
<div class="itemHeader">
<el-checkbox :indeterminate="item.isIndeterminate" class="checkoutBox pointer" @change="handleGoodsTypeCheckChange(item.goodsTypeCheckout, item)" v-model="item.goodsTypeCheckout">{{ item.goodsTypeName }}</el-checkbox>
<!-- <input type="checkbox"
class="checkoutBox pointer"
@change="handleGoodsTypeCheckChange(item.goodsTypeCheckout, item)"
v-model="item.goodsTypeCheckout" /> -->
</div>
<div class="shopgGoodsCon" v-for="(goodsItem, goodsIndex) in item.upgradeGoodsList" :key="goodsIndex">
<el-checkbox class="pointer typeCheckoutBox" @change="handleGoodsCheckChange(goodsItem.selectedFlag, goodsItem)" v-model="goodsItem.selectedFlag" />
<!-- <input type="checkbox"
class="pointer typeCheckoutBox"
@change="handleGoodsCheckChange(goodsItem.selectedFlag,goodsItem)"
v-model="goodsItem.selectedFlag"> -->
<div class="itemInfo">
<div class="imgCon">
<img :src="goodsItem.thumbUrl" alt="" />
</div>
<div class="right">
<div class="name one-line-ellipsis">{{ goodsItem.upgradeGoodsName }}</div>
<div class="price">
<span class="label">商品价格:</span>
¥{{ goodsItem.purchasePrice }}
</div>
<div class="num">
<el-input-number v-model="goodsItem.goodsNumber" @change="handleGoodsNumChange($event, goodsItem.upgradeGoodsId)" :min="1" class="numInput" size="mini" :max="9999"></el-input-number>
{{ membraneTypeList.includes(goodsItem.goodsType) ? `卷(1卷=${goodsItem.convertedValue || 30}米)` : '件' }}
</div>
<i class="el-icon-delete deleteIcon pointer" @click="handleDelete(goodsItem.id)"></i>
</div>
</div>
</div>
</div>
<div class="totalCon">
<span class="label">总价:</span>
<span class="num">¥{{ totalPrice }}</span>
<!-- <div></div> -->
<el-button class="submitBtn" @click="validateGoodsNumber" type="primary">结算</el-button>
</div>
</el-drawer>
<GLDialog class="addressDialog" mode="big" bigTitle="结算确认" okText="确定结算" :visible.sync="dialogShow" :close-on-click-modal="false" @onOk="handleSubmit" @onCancel="dialogShow = false">
<h4 class="title">确认要结算订单吗?</h4>
<div class="info">
<p class="tips">
<span>请核对收货仓信息:</span>
<el-button type="text" @click="editAddress">修改</el-button>
</p>
<ul class="orderInfoCom">
<li class="item" v-for="(item, index) in addressInfoList" :key="index">
<span class="label">{{ item.label }}</span>
<span class="conten">{{ $$(addressInfo, [item.name]) }}</span>
</li>
</ul>
</div>
</GLDialog>
</div>
</template>
<script>
import { limitPrice } from '@/common/format'
import { membraneTypeList } from '@/utils/constants.js'
export default {
name: 'ShoppingCartCom',
props: {
addressInfo: {
type: Object,
default: () => {}
}
},
data() {
return {
// addressInfo: {},
throttleSubmit: false,
membraneTypeList,
drawer: false,
dialogShow: false,
direction: 'rtl',
isAllCheck: false,
isIndeterminate: true,
totalPrice: 0,
goodsSelectTotalNumber: 0,
goodsTotalNumber: 0,
goodsList: [],
addressInfoList: [
{
label: '店铺名称',
name: 'yqMerchantName'
},
{
label: '店铺编号',
name: 'yqMerchantId'
},
{
label: '收货人',
name: 'contactName'
},
{
label: '收货人电话',
name: 'contactPhone'
},
{
label: '收货地址',
name: 'contactAddress'
}
],
selectList: []
}
},
computed: {
goodsSelectStatus() {
return this.goodsList.reduce((list, item) => {
item.upgradeGoodsList.forEach(goodsItem => {
list.push({
id: goodsItem.id,
upgradeGoodsId: goodsItem.upgradeGoodsId,
selectedFlag: goodsItem.selectedFlag ? 'Y' : 'N',
goodsNumber: goodsItem.goodsNumber
})
})
return list
}, [])
}
},
// watch: {
// },
mounted() {
// this.restGoodsList()
this.getGoodsList()
// 更新购物车数据
this.$EventBus.$on('updateCarShopping', () => {
// console.log('updateCarShopping')
this.getGoodsList()
})
},
methods: {
editAddress() {
this.dialogShow = false
this.$emit('editAddress')
},
validateGoodsNumber() {
// 判断 是否有地址
if (!this.addressInfo?.id) {
this.$message.warning('请先填写地址')
return
}
// 判断 是否有选中的商品
const selectList = this.goodsSelectStatus.reduce((list, item) => {
if (item.selectedFlag === 'Y') {
list.push({
upgradeGoodsId: item.upgradeGoodsId,
goodsNumber: item.goodsNumber
})
}
return list
}, [])
if (!selectList.length) {
return this.$message.warning('请选择商品')
} else {
this.selectList = selectList
this.dialogShow = true
this.throttleSubmit = false
}
},
handleSubmit() {
if (this.throttleSubmit) return
console.log(this.throttleSubmit)
console.log('submit')
const { contactAddress, contactName, contactPhone } = this.addressInfo
const params = {
orderDelivery: {
contactAddress,
contactName,
contactPhone
},
shoppingCarList: this.selectList
}
this.throttleSubmit = true
this.$apis.purchaseShopping.purchaseOrderAdd(params).then(result => {
this.drawer = false
this.dialogShow = false
this.$message.success('提交成功')
this.getGoodsList()
// this.$nextTick(() => {
// this.throttleSubmit = false
// }, 1000)
})
// purchaseOrderAdd
// this.getGoodsList()
// } else {
// }
},
handleDelete(upgradeGoodsId) {
// console.log(upgradeGoodsId)
this.$apis.purchaseShopping.shoppingCarRemove({ id: upgradeGoodsId }).then(result => {
this.getGoodsList()
})
},
handleAllCheckChange(value) {
console.log(value)
const idsName = value ? 'selectedIds' : 'notSelectedIds'
const list = this.goodsSelectStatus.map(item => {
// item.selectedFlag = value ? 'Y' : 'N'
return item.id
})
this.updateSelectedFlag({ [idsName]: list })
},
handleGoodsTypeCheckChange(value, typeList) {
console.log(value)
const idsName = value ? 'selectedIds' : 'notSelectedIds'
const list = typeList.upgradeGoodsList.map(item => {
return item.id
})
this.updateSelectedFlag({ [idsName]: list })
},
handleGoodsCheckChange(value, goodsItem) {
console.log(value)
const idsName = value ? 'selectedIds' : 'notSelectedIds'
// this.restGoodsList()
this.updateSelectedFlag({
[idsName]: [goodsItem.id]
})
},
updateSelectedFlag(list) {
this.$apis.purchaseShopping.updateSelectedFlag(list).then(result => {
this.getGoodsList()
})
},
getGoodsList() {
this.$apis.purchaseShopping
.listGroupByGoodsType({})
.then(result => {
// console.log(result)
this.goodsList = result.map(item => {
const upgradeGoodsList = item.list.reduce((total, cur, index) => {
total.push({
upgradeGoodsName: cur.upgradeGoods.upgradeGoodsName,
upgradeGoodsId: cur.upgradeGoodsId,
selectedFlag: cur.selectedFlag == 'Y',
goodsNumber: cur.goodsNumber,
goodsType: cur.goodsInfo.goodsType,
convertedValue: cur.goodsInfo.convertedValue,
thumbUrl: cur.goodsInfo.thumbUrl,
purchasePrice: cur.upgradeGoods.purchasePrice,
id: cur.id
})
return total
}, [])
return {
goodsType: item.goodsType,
goodsTypeName: item.gooodsTypeName,
upgradeGoodsList
// isIndeterminate: length > 1 && isIndeterminate
}
})
this.restGoodsList()
})
.catch(err => {
console.log(err)
})
},
restGoodsList() {
let checkoutFlag = true
let totalPrice = 0
let goodsSelectTotalNumber = 0
let goodsTotalNumber = 0
let isIndeterminate = false
console.log('this.goodsList', this.goodsList)
// debugger
this.goodsList = this.goodsList.map(item => {
const length = item.upgradeGoodsList.length
let typeIsIndeterminate = false
item.goodsTypeCheckout = item.upgradeGoodsList.every(goodsItem => goodsItem.selectedFlag)
item.upgradeGoodsList.forEach(goodsItem => {
// if (goodsItem.selectedFlag == 'Y') isIndeterminate = true
console.log(goodsItem, 'goodsItem')
goodsTotalNumber += 1
if (goodsItem.selectedFlag) {
// debugger
typeIsIndeterminate = true
isIndeterminate = true
goodsSelectTotalNumber += 1
totalPrice += goodsItem.goodsNumber * goodsItem.purchasePrice
}
return goodsItem.selectedFlag
})
// if (item.goodsTypeCheckout)
if (!item.goodsTypeCheckout) {
checkoutFlag = false
}
item.isIndeterminate = length > 1 && !item.goodsTypeCheckout && typeIsIndeterminate
return item
})
// 只有有一个选中并且不是全选状态
console.log(isIndeterminate)
this.isIndeterminate = checkoutFlag ? false : isIndeterminate
this.goodsSelectTotalNumber = goodsSelectTotalNumber
this.goodsTotalNumber = goodsTotalNumber
this.isAllCheck = checkoutFlag
this.totalPrice = totalPrice
},
handleGoodsNumChange(goodsNumber, upgradeGoodsId) {
goodsNumber = parseInt(goodsNumber)
goodsNumber = limitPrice(goodsNumber, 1, 6, 2)
this.$apis.purchaseShopping
.shoppingCarUpdateNumber({ upgradeGoodsId, goodsNumber })
.then(result => {
this.getGoodsList()
})
.catch(err => {
console.log(err)
})
}
}
}
</script>
<style lang="scss" scoped>
ul,
li {
padding: 0;
margin: 0;
list-style: none;
}
.shoppingCartDrawerCon {
// box-sizing: border-box;
// margin-top: 20vh;
font-size: 14px;
::v-deep .el-drawer__header {
color: #333333;
border-bottom: 1px solid #e7eaec;
margin-bottom: 0px;
padding-bottom: 10px;
font-weight: 600;
font-size: 20px;
}
::v-deep .el-drawer__body {
box-sizing: border-box;
overflow: scroll;
padding: 20px 20px 65px;
// padding: 0px;
// padding-bottom: 50px;
// // padding-bottom: 300px;
// ::v-deep .el-drawer.rtl {
// padding-bottom: 50px;
// }
}
// padding-bottom: 300px;
// ::v-deep .el-drawer.rtl {
// padding-bottom: 50px;
// }
}
.totalCon {
position: absolute;
bottom: 0;
left: 0;
display: flex;
align-items: center;
width: 100%;
border-top: 1px solid #e7eaec;
color: #333333;
padding: 20px 20px;
font-size: 14px;
background-color: #fff;
z-index: 1;
.num {
margin-left: 3px;
font-size: 20px;
font-weight: 600;
color: #ee3040;
}
.submitBtn {
margin-left: auto;
}
}
.carBtnCon {
// position: absolute;
position: fixed;
top: 30vh;
right: 20px;
display: flex;
flex-direction: column;
align-items: center;
padding: 32px 12px;
z-index: 2;
width: 52px;
height: 158px;
box-sizing: border-box;
background: #5850ff;
box-shadow: 0 9px 28px 8px #0000000d, 0 6px 16px 0 #00000014, 0 3px 6px -4px #0000001f;
border-radius: 4px;
.car-txt {
font-size: 14px;
color: #ffffff;
writing-mode:vertical-rl;
}
&::after {
// content: "123";
content: attr(data-attr);
box-sizing: border-box;
position: absolute;
// right: 7px;
top: 30px;
left: 30px;
display: block;
height: 14px;
border-radius: 7px;
padding: 1px 4px 0;
color: #5850ff;
background: #ffffff;
font-size: 10px;
// width: 100%;
// height: 100%;
// background: url(../assets/img/car.png) no-repeat;
// background-size: 100% 100%;
}
.carIcon {
width: 30px;
height: 30px;
background-position: 1px 0;
margin: 0;
}
// cursor: pointer;
span {
// writing-mode: vertical-lr;
writing-mode: vertical-lr;
}
}
.headerCon {
display: flex;
align-items: center;
justify-content: space-between;
color: #666;
margin-bottom: 10px;
.left {
display: flex;
align-items: center;
}
.red {
color: #ee3040;
}
}
.goodsTypeCon {
display: flex;
flex-direction: column;
width: 100%;
margin-bottom: 20px;
background: #f9f9f9;
color: #666;
.itemHeader {
display: flex;
align-items: center;
padding: 12px 19px;
border-bottom: 1px solid #e7e7e7;
}
}
.shopgGoodsCon {
box-sizing: border-box;
display: flex;
align-items: center;
padding: 16px;
padding-right: 20px;
margin-top: 16px;
&:nth-last-child(1) {
margin-bottom: 16px;
}
.itemInfo {
display: flex;
flex: 1;
width: 501px;
height: 104px;
margin-left: 5px;
background: #ffffff;
border-radius: 2px;
.imgCon {
width: 104px;
height: 104px;
overflow: hidden;
border-radius: 2px;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.right {
position: relative;
box-sizing: border-box;
display: flex;
flex-direction: column;
padding: 8px 17px 11px;
.name {
font-weight: 600;
font-size: 14px;
color: #333333;
}
.price {
display: flex;
align-items: center;
font-weight: 600;
font-size: 18px;
color: #ee3040;
margin: 4px 0 8px;
.label {
font-size: 12px;
font-weight: normal;
color: #666666;
}
}
.num {
font-size: 12px;
color: #666666;
.numInput {
margin-right: 4px;
}
}
.deleteIcon {
position: absolute;
right: -20px;
top: 50%;
transform: translateX(-50%);
}
}
}
}
.addressDialog {
.title {
text-align: center;
font-size: 20px;
color: #f8ba37;
margin:20px 0 40px 0;
}
.tips {
display: flex;
justify-content: space-between;
span{
margin-bottom:20px;
}
}
.info {
padding: 15px 20px;
box-shadow: 0px 0px 5px 0px rgba(136, 152, 157, 0.3);
}
.item {
margin-bottom: 15px;
}
.label {
display: inline-block;
width: 100px;
text-align: right;
margin-right: 10px;
}
}
</style>
<template>
<div class="report-home">
HOME
<GLButton type="danger" @click="test()" class="test555" id="1-1-1-1" mode="link">权限按钮测试</GLButton>
<GLButton type="success" size="small" @click="test()" id="1-1-1-1" class="test">权限按钮测试2</GLButton>
<el-button class="test" @click="test()">东方网分</el-button>
</div>
</template>
<script>
export default {
name: 'home',
methods: {
test() {
console.log('点击了按钮')
this.$messenger.send({ message: { from: 11, message: '11111' } })
}
}
}
</script>
<!-- 评价管理-->
<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">
<GLButton type="primary" class="glbtn" size="small" @click="handleCreatePurchase" fn="创建采购">创建采购</GLButton>
<!-- <el-button type="primary" size="small" @click="handleCreatePurchase">创建采购</el-button> -->
<el-button type="primary" class="btn" size="small" @click="exportExcel">导出</el-button>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="orderRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<template slot="deliveryStatus" slot-scope="scope">
<div>
<span :class="[scope.scope.deliveryStatus == 1 ? 'yellowSpot' : 'greenSpot']"></span>
<span>{{ scope.scope.deliveryStatus | deliveryStatus }}</span>
</div>
</template>
<template slot="putStatus" slot-scope="scope">
<div>
<span :class="[scope.scope.putStatus == 1 ? 'yellowSpot' : 'greenSpot']"></span>
<span>{{ scope.scope.putStatus | putStatus }}</span>
</div>
</template>
<template slot="status" slot-scope="scope">
<div>
<span :class="[scope.scope.status == 1 ? 'yellowSpot' : scope.scope.status == 2 ? 'greenSpot' : 'ashSpot']"></span>
<span>{{ scope.scope.status | orderStatus }}</span>
</div>
</template>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">查看</el-button>
<GLButton type="text" size="small" v-show="scope.scope.status == 1" @click="handleCancel(scope.scope)" fn="取消">取消</GLButton>
<GLButton type="text" size="small" v-show="scope.scope.putStatus == 1 && scope.scope.deliveryStatus == 2" @click="handleWarehousing(scope.scope)" fn="入库">入库</GLButton>
<!-- <el-button type="text" v-show="scope.scope.status == 1" @click="handleCancel(scope.scope)">取消</el-button> -->
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
<orderDeatilDialog :visible.sync="detailVisible" :paramsObj="paramsObj"></orderDeatilDialog>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import orderDeatilDialog from './components/orderDetailDialog'
import { defaultStatusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, tableData } from '@/utils/constants.js'
export default {
name: 'PurchaseOrder',
components: {
orderDeatilDialog
},
data() {
return {
size: 'small',
url: url,
searchForm: {
status: '',
deliveryStatus: '',
putStatus: '',
merchantId: '',
putMerchantId: '',
sortType: 1,
orderTimeStr: [],
putTimeStr: [],
placeOrderTimeStr: [],
warehousingTimeStr: []
},
tableSearchForm: {},
paramsObj: {},
// 查看门店
detailVisible: false,
tableData: tableData,
showFormData: [
{
label: '订单编号',
name: 'orderCode',
type: 'input',
isClear: true
},
{
label: '订单状态',
name: 'status',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'label',
optionsName: 'defaultStatusOptions'
},
{
label: '发货状态',
name: 'deliveryStatus',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'label',
optionsName: 'defaultDeliveryStatusOptions'
},
{
label: '入库状态',
name: 'putStatus',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'label',
optionsName: 'defaultPutStatusOptions'
},
{
label: '下单时间',
name: 'placeOrderTimeStr',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
},
{
label: '入库时间',
name: 'warehousingTimeStr',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
},
{
label: '下单门店',
name: 'merchantId',
type: 'select',
optionList: [],
optionId: 'merchantNo',
optionLabel: 'merchantName',
optionsName: 'merchantName'
},
{
label: '入库门店',
name: 'putMerchantId',
type: 'select',
optionList: [],
optionId: 'merchantNo',
optionLabel: 'merchantName',
optionsName: 'merchantName'
}
],
// 表格
getListApi: this.$apis.purchaseShopping.getPurchaseOrderList,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '订单编号',
prop: 'orderCode',
width: '200'
},
{
label: '订单总价',
prop: 'totalPrice',
formatter: cellValue => {
return '¥' + cellValue.totalPrice
},
width: 100
},
{
label: '下单时间',
prop: 'orderTime',
formatter: cellValue => {
return dayjs(cellValue.orderTime).format('YYYY-MM-DD HH:mm:ss')
},
width: 180
},
{
label: '下单门店',
prop: 'merchantName',
minWidth: 150
},
{
label: '发货状态',
prop: 'deliveryStatus',
addHtml: 'deliveryStatus',
width: 120
},
{
label: '承运公司',
prop: 'deliveryCompany',
formatter: cellValue => {
return cellValue.deliveryCompany || '--'
},
minWidth: 120
},
{
label: '承运单号',
prop: 'deliveryNumber',
formatter: cellValue => {
return cellValue.deliveryNumber || '--'
},
width: 120,
line: 1
},
{
label: '入库状态',
prop: 'putStatus',
addHtml: 'putStatus',
width: 120
},
{
label: '入库时间',
prop: 'putTime',
formatter: cellValue => {
return cellValue.putTime ? dayjs(cellValue.putTime).format('YYYY-MM-DD HH:mm:ss') : '--'
},
width: 180
},
{
label: '入库门店',
prop: 'putMerchantName',
line: 1,
width: 150,
formatter: cellValue => {
return cellValue.putMerchantName || '--'
}
},
{
label: '订单状态',
prop: 'status',
addHtml: 'status',
width: 120
},
{
label: '操作',
width: '180px',
addHtml: 'auth-button'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
// 基本数据
baseData: {
defaultStatusOptions: defaultStatusOptions,
defaultDeliveryStatusOptions: defaultDeliveryStatusOptions,
defaultPutStatusOptions: defaultPutStatusOptions,
merchantName: []
}
}
},
mounted() {
this.$apis.purchaseShopping.getMerchantList({}).then(res => {
this.baseData.merchantName = res
this.getOptionsList('showFormData')
})
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
console.log(this.searchForm)
if (this.searchForm.placeOrderTimeStr.length) {
params.orderTimeStr[0] = new Date(this.searchForm.placeOrderTimeStr[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.orderTimeStr[1] = new Date(this.searchForm.placeOrderTimeStr[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
if (this.searchForm.warehousingTimeStr.length) {
params.putTimeStr[0] = new Date(this.searchForm.warehousingTimeStr[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.putTimeStr[1] = new Date(this.searchForm.warehousingTimeStr[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.placeOrderTimeStr
delete params.warehousingTimeStr
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
delete this.tableSearchForm.warehousingTimeStr
delete this.tableSearchForm.placeOrderTimeStr
resolve()
})
},
// 入库
handleWarehousing(row) {
this.$confirm('订单入库后自动更新对应的库存,可在入库管理中查看记录。是否确定入库?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$apis.purchaseShopping
.purchaseOrderPutIn({
orderCode: row.orderCode
})
.then(res => {
this.$notify({
type: 'success',
title: '操作成功'
})
this.$refs.orderRef.refreshTable()
})
.catch(() => {})
})
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
// 查看详情
handleDetail(row) {
this.paramsObj = {
orderCode: row.orderCode,
merchantName: row.merchantName
}
this.detailVisible = true
},
//取消
handleCancel(row) {
this.secondConfirm('取消', '订单取消后即自动作废该订单,且无法撤回。是否确定取消?', 'purchaseShopping', 'purchaseOrderCancelOrCheck', { orderCode: row.orderCode, operateType: 2 })
},
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.orderRef.data.length ? (this.$refs.orderRef.tableHeightValues = '') : this.$refs.orderRef.setTableHeightFun()
},
// 创建采购
handleCreatePurchase() {
this.$router.push('/purchaseOrder/add')
},
exportExcel() {
var params = this.getParams()
this.$apis.purchaseShopping.exportExcel(params).then(res => {
window.location.href = res
})
},
handleSearch() {
this.$refs.orderRef.refreshTable()
},
handleReset() {
this.searchForm = {
status: '',
deliveryStatus: '',
putStatus: '',
merchantId: '',
putMerchantId: '',
sortType: 1,
orderTimeStr: [],
putTimeStr: [],
placeOrderTimeStr: [],
warehousingTimeStr: []
}
this.handleSearch()
}
}
}
</script>
<style scoped lang="scss">
@import '@/assets/css/mixin.scss';
.purchase {
.table-header {
display: flex;
align-items: center;
margin-bottom: 25px;
margin-top:20px;
h2 {
font-weight: 600;
font-size: 16px;
color: #333;
}
.glbtn{
left: 46px;
position: absolute;
}
.btn {
right: 47px;
position: absolute;
}
}
.greenSpot {
@include dot;
background: $color-green;
}
.yellowSpot {
@include dot;
background: $color-yellow;
}
.ashSpot {
@include dot;
background: $color-gray;
}
.table-btns /deep/.el-button--text {
min-width: 0 !important;
padding: 0;
}
}
</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`,
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!