Commit c14d5bb3 by 前端

添加项目代码

0 parents
Showing 83 changed files with 9871 additions and 0 deletions
NODE_ENV='development'
# must start with VUE_APP_
VUE_APP_ENV = 'development'
VUE_APP_PORT = 6652
NODE_ENV='production'
# must start with VUE_APP_
VUE_APP_ENV = 'production'
\ No newline at end of file
{
"root": true,
"env": {
"node": true
},
"extends": ["plugin:vue/essential", "@vue/prettier"],
"rules": {
"no-console": "off",
"no-unused-vars":"off",
"prettier.endOfLine": "crlf",
"endOfLine":"auto"
},
"parserOptions": {
"parser": "babel-eslint"
}
}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
{
"printWidth": 800,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"semi": false,
"wrap_line_length": 820,
"wrap_attributes": "auto",
"proseWrap": "always",
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "ignore",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"jsxBracketSameLine": true,
"files.insertFinalNewline": true,
"useTabs": false,
"eslintIntegration": true,
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
}
],
"endOfLine": "auto"
}
# subapp-blog
微前端博客子应用
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
plugins: [
[
"component",
{
libraryName: "element-ui",
styleLibraryName: "theme-chalk"
}
]
]
};
This diff could not be displayed because it is too large.
{
"name": "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",
"rfdc": "^1.3.0",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.0",
"@vue/cli-plugin-vuex": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"@vue/eslint-config-prettier": "^5.0.0",
"babel-eslint": "^10.0.3",
"babel-plugin-component": "^1.1.1",
"eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^5.0.0",
"node-sass": "^4.14.1",
"prettier": "^1.19.1",
"sass-loader": "^8.0.0",
"vue-cli-plugin-element": "^1.0.1",
"vue-template-compiler": "^2.6.10"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
No preview for this file type
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="referrer" content="never">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<!-- 使用CDN的CSS文件 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
<% } %>
<!-- 使用CDN的JS文件 预加载 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
<% } %>
<title>微前端子应用:博客</title>
</head>
<body>
<noscript>
<strong>We're sorry but module-report doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
</body>
</html>
\ No newline at end of file
var express = require('express')
// var history = require('connect-history-api-fallback')
var cors = require('cors')
var app = express()
// app.use(history())
app.use(cors())
app.use(express.static('./dist'))
app.get('/', function(req, res) {
res.send('Hello jq')
})
const port = 6652
app.listen(port)
console.log(`服务已运行:\r\n http://127.0.0.1:${port}`)
<template>
<div id="app">
<!-- <h2>
报表子应用
<span class="right"></span>
</h2>
<div id="nav">
<span>切换路由:</span>
<el-button-group class="right">
<el-button type="primary" size="medium" @click="routerChange('/')">报表</el-button>
<el-button type="primary" size="medium" @click="routerChange('/about')">穿梭框</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-1')">表格</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-2')">日历</el-button>
<el-button type="primary" size="medium" @click="toAppReport('3-1')">aaaa</el-button>
</el-button-group>
</div>
<div class="parent-child-communication">
<h3>父子应用通信:</h3>
<div style="margin-bottom: 20px;">
<span>rxjs通信方案:</span>
<el-button class="right" type="primary" size="medium" @click="callParentChange('rxjs')">通知父应用变天了</el-button>
</div>
<div>
<span>官方通信方案:</span>
<el-button class="right" type="primary" size="medium" @click="callParentChange('default')">通知父应用收到</el-button>
</div>
<img src="./assets/logo.png" alt="" srcset="" />
</div>-->
<router-view />
</div>
</template>
<script>
export default {
name: 'report-app',
props: {
msg: String,
message: String
},
data() {
return {
myMsg: '',
gs: ''
}
},
created() {
this.myMsg = this.msg
this.myMessage = this.message
}
}
</script>
<style lang="scss">
.parent-child-communication {
padding: 20px 0;
line-height: 36px;
}
#app {
padding: 0px 20px 20px 40px;
// overflow-y: auto;
height: 100%;
}
</style>
>
/*
所有模块都定义在 modules
|-modules
|----demo.js
|----demo1.js
|----...
|-index.js ---动态对外暴露所有模块 无须手动添加
参考demo.js 用法 : this.$apis.demo.GETLISTDEVICEFILEUNSTOCK(...)
*/
const modulesFiles = require.context('./modules', true, /\.js$/)
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
modules[moduleName] = value.default
return modules
}, {})
export default modules
import { http } from '@/main'
const path = 'dj.api.'
const path2 = 'dj.api.smartcarlife.'
// 获取有关联关系的4s店列表
const listShop4sByRef = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}scenemerchantref.listShop4sByRef`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 根据4S店商户号查询二级流量方
const getDiversionMerchantRef = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path2}diversionMerchant.getDiversionMerchantRef`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
export default { listShop4sByRef, getDiversionMerchantRef }
import { http } from '@/main'
const path = 'dj.api.smartcarlife.'
const path2 = 'scrm.api.shopmall.'
const getList = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}ordermanage.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
const getOrderDetail = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}advanceOrder.detail`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
const getOrderCount = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}ordermanage.count`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 众筹活动订单查询列表
const shopmallOrderList = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}shopmallOrder.pageList`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 订单详情
const goodsOrderDetail = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path}goodsOrder.detail`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
//根据园区店商户号获取4s列表
const getServiceStore = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.scenemerchantref.query4SRefByYqShop`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
//众筹订单列表
// const getListApi = params => {
// params.method = `${path2}order.noSessionPage`
// params.routerMethod = `${path2}order.noSessionPage`
// return http({
// url: 'rop-scrm-boutiquecoupon/router',
// method: 'POST',
// data: params,
// sign: true
// })
// }
const getListApi = params => {
params.method = `${path2}order.noSessionPage`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getList, getOrderDetail, getOrderCount, shopmallOrderList, goodsOrderDetail, getServiceStore, getListApi }
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.smartcarlife.'
const path2 = 'dj.api.'
/** 获取园区店列表 - 园区店 */
const getParkStore = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.smartcarlife.api.yqMerchant.list`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
/** 获取园区店列表 - 流量来源 */
const getServiceStore = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path2}servicemerchantref.list`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取渠道列表
const getChannelType = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path2}channel.type.list`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getParkStore, getServiceStore, getChannelType }
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
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
/**
* 根据路由匹配地址
* @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
// 订单状态
export const orderStatusList = [
{
confId: 1,
confLabel: '待升级'
},
{
confId: 2,
confLabel: '战败'
},
{
confId: 3,
confLabel: '待支付'
},
{
confId: 4,
confLabel: '已支付'
},
/* {
confId: 5,
confLabel: '已退款'
}, */ {
confId: 6,
confLabel: '已评价'
},
{
confId: 9,
confLabel: '已撤销'
},
{
confId: 10,
confLabel: '已关闭'
},
{
confId: 11,
confLabel: '错误订单'
},
{
confId: 12,
confLabel: '已退款'
}
]
// 升级状态
export const upgradeList = [
{
confId: 'Y',
confLabel: '已升级'
},
{
confId: 'N',
confLabel: '战败'
},
{
confId: 'R',
confLabel: '待升级'
}
]
// 施工状态
export const constructionList = [
{
confId: 'Y',
confLabel: '已施工'
},
{
confId: 'N',
confLabel: '未施工'
}
]
// 分账状态
export const profitAllocationStatusList = [
{
confId: '1',
confLabel: '未分账'
},
{
confId: '2',
confLabel: '已分账'
},
{
confId: '4',
confLabel: '待分账'
}
]
// 订单来源
export const sourceList = [
{
confId: '1',
confLabel: '小程序订单'
},
{
confId: '7',
confLabel: '系统导入'
}
]
export const payType = {
1: '微信支付',
2: '4S店支付',
3: 'POS机收款',
4: '支付宝支付'
}
export const businessType = [
{
optionId: 1,
optionLabel: '1.2'
},
{
optionId: 2,
optionLabel: '1.3'
},
{
optionId: 3,
optionLabel: '2.0'
}
]
export const orderManageStatusList = [
{ confId: '1', confName: '待付款' },
{ confId: '2', confName: '已支付' },
{ confId: '3', confName: '已失效' },
// { confId: '21', confName: '待收货(待核销)' },
{ confId: '21', confName: '待核销' },
{ confId: '22', confName: '已核销' },
// { confId: '22', confName: '已收货(已核销)' },
{ confId: '6', confName: '待发货' },
// { confId: '7', confName: '待核销' },
// { confId: '8', confName: '已核销' },
{ confId: '9', confName: '售后中' },
{ confId: '10', confName: '售后完成' },
{ confId: '11', confName: '待审批' }
]
export const afterSaleStatusList = [
{ confId: '1', confName: '待审核' },
{ confId: '2', confName: '审核成功' },
{ confId: '3', confName: '审核失败' },
{ confId: '4', confName: '待确认' },
{ confId: '5', confName: '退款中' },
{ confId: '6', confName: '已退款' },
{ confId: '7', confName: '退款失败' }
]
export const orderSourceList = [
{ confId: '1', confName: '商城订单' },
{ confId: '2', confName: '直播订单' },
{ confId: '3', confName: '活动订单' },
{ confId: '4', confName: '众筹订单' }
]
export const deliveryTypeList = [
{ confId: '1', confName: '到店核销' },
{ confId: '2', confName: '快递到家' }
]
function getExplorer() {
var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null
if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
browserType = 'IE'
} else if (ua.match(/firefox/) != null) {
browserType = '火狐'
} else if (ua.match(/ubrowser/) != null) {
browserType = 'UC'
} else if (ua.match(/opera/) != null) {
browserType = '欧朋'
} else if (ua.match(/bidubrowser/) != null) {
browserType = '百度'
} else if (ua.match(/metasr/) != null) {
browserType = '搜狗'
} else if (ua.match(/tencenttraveler/) != null || ua.match(/qqbrowse/) != null) {
browserType = 'QQ'
} else if (ua.match(/maxthon/) != null) {
browserType = '遨游'
} else {
browserType = '谷歌'
}
return browserType
}
function exportFn(url) {
let browserType = getExplorer()
if (browserType == 'QQ') {
window.open(url)
return
}
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = url
document.body.appendChild(iframe)
}
// 获取最近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
}
}
// import Vue from 'vue'
import { Message, MessageBox, Loading } from "element-ui"
// import moment from 'moment'
import dayjs from "dayjs"
let loadingInstance = ""
export const Util = {
/**
* 简单alert
* title 标题
* message 内容
* className 自定义class
* showCancelButton 是否展示取消按钮
* confirmButtonText 确认按钮文案
* cancelButtonText 取消按钮文案
* confirmButtonColor 确认按钮颜色
* cancelButtonColor 取消按钮颜色
*/
msg: function (options) {
MessageBox({
title: options.title || "",
type: options.type || "error",
message: options.message || "",
className: options.className || "",
showCancelButton: options.showCancelButton || false,
confirmButtonText: options.confirmButtonText || "确认",
cancelButtonText: options.cancelButtonText || "取消",
confirmButtonColor: options.confirmButtonColor || "#1989fa",
cancelButtonColor: options.cancelButtonColor || "#000",
dangerouslyUseHTMLString: true,
callback: function (action, done) {
if (action == "confirm") {
if (options.success) {
options.success(done)
}
} else {
console.log(done)
// done()
}
}
})
/* Vue.$vux.alert.show({
title: options.title||'',
content: options.message||'',
onShow() {
options.onShow?(options.onShow)():'';
},
onHide() {
options.onHide?(options.onHide)():'';
}
}) */
},
/**
* 提示框
*/
Info: function (options) {
Message({
message: options.message || "提示",
type: options.type || "error",
duration: options.time || 2000,
onClose: options.onClose || ""
})
},
/**
* 轻提示
*/
Tips: function (options) {
Message({
message: options.message || "提示",
duration: options.duration || 3000,
type: options.type || "text",
icon: options.icon || ""
})
},
/**
* loading
*/
loading: function (message) {
loadingInstance = Loading.service({
text: message || "加载中..."
})
},
/**
* 关闭loading
*/
closeLoading: function () {
loadingInstance.close()
},
/**
* 校验手机号码格式
*/
checkPhone: function (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)
},
/**
* 校验固定电话
*/
validationTel: function (tel) {
const reg = /^0[\d]{2,3}-[\d]{7,8}$/
return reg.test(tel)
},
/**
* 是否特殊字符
*/
isSpecialLetter: function (str) {
const reg = new RegExp(
"[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]"
)
return reg.test(str)
},
/**
* 只能输入英文字母和数字,不能输入中文
*/
validationInput: function (str) {
const reg = /[^\w\.\/]/gi // eslint-disable-line
return reg.test(str)
},
/**
* 获取当前时间
*/
getCurrentDate: function () {
const time = new Date()
const y = time.getFullYear()
const m = time.getMonth() + 1
const d = time.getDate()
return {
date: y + "/" + m + "/" + d
}
},
/**
* 获取浏览器参数
*/
getUrlParams: function (name) {
const vars = []
let hash
const oParams = {}
const hashes = window.location.href
.slice(window.location.href.indexOf("?") + 1)
.split("&")
for (let i = 0; i < hashes.length; i++) {
hash = hashes[i].split("=")
vars.push(hash[0])
oParams[hash[0]] = hash[1]
}
console.log(vars)
if (name) {
return oParams[name]
} else {
return oParams
}
},
/**
* 根据当前时间,计算往后30天的日期
*/
getAfterDate: function (day) {
const date1 = new Date()
const date2 = new Date(date1)
let time = 30
if (day) {
time = day
}
date2.setDate(date1.getDate() + time)
const _date =
date2.getFullYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate()
return {
date: _date,
year: date2.getFullYear(),
month: date2.getMonth() + 1,
day: date2.getDate()
}
},
/**
* 日期格式转换
*/
dateFormate: function (str, type) {
let txt = "YYYY-MM-DD"
if (type) {
txt = type
}
const m = dayjs(str).format(txt)
return m
},
/**
* 字段截取
*/
cutStr: function (str, num) {
if (!str) {
return ""
}
let m = 10
let n = str
if (num) {
m = num
}
if (str.length > m) {
n = str.slice(0, m) + "..."
}
return n
},
// /**
// * 深克隆 所有原型链上的对象和属性
// * 例: const bar=deepClone(foo)
// * console.log(bar===foo) false
// * @param {*} obj
// */
deepClone: function (obj) {
const clone = require("rfdc")({ proto: false, circles: false })
return clone(obj)
},
// deepClone: function (obj) {
// // Handle the 3 simple types, and null or undefined or function
// if (obj == null || typeof obj !== "object") return obj
// // Handle Date
// if (obj instanceof Date) {
// const copy = new Date()
// copy.setTime(obj.getTime())
// return copy
// }
// // Handle Array or Object
// if ((obj instanceof Array) | (obj instanceof Object)) {
// const copy = obj instanceof Array ? [] : {}
// for (var attr in obj) {
// // if (Object.prototype.hasOwnProperty.call(attr)) {
// if (obj.hasOwnProperty(attr)) {
// copy[attr] = Util.deepClone(obj[attr])
// // console.log("copy[attr] ", copy[attr])
// }
// }
// return copy
// }
// throw new Error("Unable to clone obj! Its type isn't supported.")
// },
/**
* url下载文件
*
*/
downLoadFile: function (url) {
// console.log(row)
// return
const Temp = document.createElement("a")
// Temp.href = process.env.VUE_APP_BASE_URL + '/article/export.do?articleId=' + row.id
Temp.href = url
// console.log(url)
// console.log(Temp.href)
document.body.append(Temp)
Temp.click()
document.body.removeChild(Temp)
},
/**
* @param {Object} json
* @param {Object} type: 默认不传 ==>全部小写;传1 ==>全部大写;传2 ==>首字母大写
* 将json的key值进行大小写转换
*/
jsonKeysToCase: function (json, type) {
if (typeof json == "object") {
var tempJson = JSON.parse(JSON.stringify(json))
toCase(tempJson)
return tempJson
} else {
return json
}
function toCase(json) {
if (typeof json == "object") {
if (Array.isArray(json)) {
json.forEach(function (item) {
toCase(item)
})
} else {
for (var key in json) {
var item = json[key]
if (typeof item == "object") {
toCase(item)
}
delete json[key]
switch (type) {
case 1:
// key值全部大写
json[key.toLocaleUpperCase()] = item
break
case 2:
// key值首字母大写,其余小写
json[
key.substring(0, 1).toLocaleUpperCase() +
key.substring(1).toLocaleLowerCase()
] = item
break
default:
// 默认key值全部小写
json[key.toLocaleLowerCase()] = item
break
}
}
}
}
}
},
// 判断字段为空时显示
fieldShow: function (field, show) {
return field || show
},
// 整数补零显示两位小数
returnFloat: function (num) {
num = num.toString()
if (num.indexOf(".") != -1) {
let newVal = num.split(".")
if (newVal[1].length == 1) {
newVal = newVal.join(".")
newVal += "0"
num = newVal
}
} else {
num += ".00"
}
return num
}
}
export const showModal = Util.msg
export const showToast = Util.Info
export const showLoading = Util.loading
export const hideLoading = Util.closeLoading
export const deepClone = Util.deepClone
export const downLoadFile = Util.downLoadFile
export const returnFloat = Util.returnFloat
/**
* 时间控件-限制月份
*/
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
<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
/*
* @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: {}
},
//精品升级订单详情
{
name: 'orderDetail',
path: '/orderManage/orderDetail',
component: resolve => require([`@/views/orderManage/orderDetail.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
// 订单状态
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
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="marketing order-manage">
<div class="container">
<template v-if="showTable">
<div class="sticky">
<GLCombiForm ref="showSearch"
:rowNumber="1"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"></GLCombiForm>
<div class="flex">
<div class="flex-default tabs">
<el-tabs v-model="searchForm.requestSource"
@tab-click="handleTabClick">
<el-tab-pane :label="i"
:name="index"
:key="index"
v-for="(i,index) in requestSourceList"></el-tab-pane>
</el-tabs>
</div>
<div class="btn-group">
<template v-if="!hideStatus">
<el-button class="default-blue-btn"
:size="size"
type="default"
@click="handleExport">导出</el-button>
</template>
</div>
</div>
</div>
<!-- 表格区域 - 全部订单/售后订单 - 开始 -->
<div class="order-manage-table">
<div class="table-tips">
<div class="table-tips-text">
已生成有效订单{{ statisticsInfo.orderCount || 0 }}项
累计订单总额:{{ statisticsInfo.payPriceTotal || 0 }}元
累计退款总额:{{ statisticsInfo.refundTotal || 0 }} 元
</div>
</div>
<GLTable ref="allOrderRef"
:getListApi="getListApi"
:noDataImg="url"
:searchForm="tableSearchForm"
:tableParams="tableParams"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
@setTableFinishFun="setTableFinishFun"
@selectionTable="selectionTable">
<div slot="weChatName"
class="flex-align"
slot-scope="scope">
<img v-if="scope.scope.weChatImageUrl"
class="img-36 pointer img-circle"
:src="scope.scope.weChatImageUrl" />
<span class="m-l-10">{{ scope.scope.weChatName }}</span>
<span v-if="!scope.scope.shareAvatar && !scope.scope.weChatName">-</span>
</div>
<template slot="vinNo"
slot-scope="scope">
{{ Array.isArray(scope.scope.vinNo) ? scope.scope.vinNo[0] : scope.scope.vinNo }}
<el-popover popper-class="order-table-popover"
placement="right-start"
trigger="click">
<p v-for="(item, index) in scope.scope.vinNo"
:key="index">{{ item }}</p>
<span class="car-no"
slot="reference"
v-show="Array.isArray(scope.scope.vinNo)">...({{ scope.scope.vinNo.length - 1 }})</span>
</el-popover>
</template>
<div slot="orderStatus"
slot-scope="scope">
<span
:class="['table-circle', 'm-r-8', [2, 10, 22].includes(scope.scope.orderStatus) ? 'back-green' : [9].includes(scope.scope.orderStatus) ? 'back-blue' : [1, 21, 6].includes(scope.scope.orderStatus) ? 'back-orange' : 'back-grey']"></span>
<span>{{ baseData.orderStatusList.map(item => item.confId).includes(scope.scope.orderStatus + '') ? baseData.orderStatusList.find(item => item.confId == scope.scope.orderStatus).confName : '-' }}</span>
</div>
<div slot="shareStaffName"
class="table-image"
slot-scope="scope">
<div>
<img v-if="scope.scope.shareStaffImageUrl"
class="img-36 pointer img-circle"
style="vertical-align: middle"
slot="reference"
:src="scope.scope.shareStaffImageUrl" />
<span class="m-l-10">
<span>{{ scope.scope.shareStaffName }}</span>
<span class="txt-green"
v-if="scope.scope.shareStaffSource == 1">@个微</span>
<span class="txt-orange"
v-if="scope.scope.shareStaffSource == 2">@企微</span>
<span class="txt-blue"
v-if="scope.scope.shareStaffSource == 3">@员工</span>
</span>
</div>
<span v-if="!scope.scope.shareStaffImageUrl && !scope.scope.shareStaffName">-</span>
</div>
<div slot="assignName"
slot-scope="scope">
<div class="flex-align">
<template v-if="scope.scope.assignStaffName">
<img class="img-36 pointer img-circle"
v-if="scope.scope.assignStaffImageUrl"
:src="scope.scope.assignStaffImageUrl" />
<span class="m-l-10">
<span>{{ scope.scope.assignStaffName }}</span>
</span>
</template>
<template v-else-if="scope.scope.shareStaffName">
<img class="img-36 pointer img-circle"
v-if="scope.scope.shareStaffImageUrl"
:src="scope.scope.shareStaffImageUrl" />
<span class="m-l-10">
<span>{{ scope.scope.shareStaffName }}</span>
</span>
</template>
<template v-else>
<span>{{ scope.scope.assignStaffName || scope.scope.shareStaffName || '-' }}</span>
</template>
<span @click="handlerAssign(scope.scope)"
class="assignLabel">指派</span>
</div>
</div>
<div slot="orderType"
slot-scope="scope">
<el-switch :value="scope.scope.orderType == 1 ? true : false"
class="switchStyle"
@change="changeOrderType(scope.scope)"
active-text="是"
inactive-text="否"></el-switch>
</div>
<div slot="marketingStatus"
slot-scope="scope">
<template v-if="scope.scope.marketingStatus">
<span
:class="['table-circle', 'm-r-8', [1, 2].includes(scope.scope.marketingStatus) ? 'back-green' : 'back-grey']"></span>
</template>
<span>{{ scope.scope.marketingStatus ?{
1:'已完结',
2:'已完结',
3:'未完结',
4:'已取消'
}[scope.scope.marketingStatus]: '-' }}</span>
</div>
<div class="table-btns"
slot="auth-button"
slot-scope="scope">
<GLTableButton :buttonList="tableButtonList"
:buttonItem="scope.scope"
:buttonNum="3"></GLTableButton>
</div>
</GLTable>
</div>
</template>
<!-- 表格区域 - 全部订单/售后订单 - end -->
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { Util } from '@/common/util'
import { businessType, orderManageStatusList, afterSaleStatusList, orderSourceList, deliveryTypeList, exportFn } from '@/common/constant'
const userInfo = [
{
label: '员工名称:',
key: 'confirmInstallStaffName'
},
{
label: '提交时间:',
key: 'confirmInstallTime'
},
{
label: '活动名称:',
key: 'activityName'
},
{
label: '应付尾款:',
key: 'tailPrice'
},
{
label: '尾款凭证:',
key: 'verificationVoucher'
},
]
export default {
name: 'orderManage',
components: {
},
data() {
return {
userInfo,
isCancelVisible: false,
cancelForm: {
reasonsForFailure: ''
},
cancelRules: {
reasonsForFailure: [
{
required: true,
validator: (rule, value, callback) => {
if (!value || (value && !value.trim())) {
return callback(new Error('请输入审批不通过说明'))
} else {
return callback()
}
},
trigger: 'change'
}
]
},
isStaffVisible: false,
size: 'small',
url: url,
isEdit: true,
orderCode: '',
merchantId: '',
approvalInfo: {},
oldVal: {
orderStatuses: [],
afterSaleStatuses: []
},
searchForm: {
orderCode: '',
orderStatuses: [],
afterSaleStatuses: [],
merchantNames: [],
customerName: '',
createDate: [],
orderSource: '4',
requestType: '1', //运营版 固定传值 实现筛选全部订单
deliveryType: '',
vin: '',
shareStaffName: '',
shareStaffType: '',
activityNames: [],
goodsName: '',
requestSource: '0',
afterSaleType: ''
},
tableSearchForm: {},
statisticsInfo: {
orderCount: '',
payPriceTotal: '',
refundTotal: ''
},
// 搜索
searchFormData: [],
// 快递信息
isExpressVisible: false,
writeOffApprovalVisible: false,
editChildRef: 'editChildRef',
expressForm: {
deliveryCompany: '',
deliveryNumber: ''
},
expressRules: {
deliveryCompany: [{ required: true, message: '快递公司是必填项', trigger: 'change' }],
deliveryNumber: [{ required: true, message: '快递单号是必填项', trigger: 'change' }]
},
expressFormData: [
{
label: '快递公司',
name: 'deliveryCompany',
type: 'input',
maxlength: 20
},
{
label: '快递单号',
name: 'deliveryNumber',
type: 'input',
maxlength: 20
}
],
// 订单核销
writeOffForm: {
verificationCode: ''
},
writeOffRules: {
verificationCode: [{ required: true, message: '核销码是必填项', trigger: 'change' }]
},
writeOffFormData: [
{
label: '核销码',
name: 'verificationCode',
type: 'input',
maxlength: 32
}
],
// 退款审核
isExamineVisible: false,
orderInfo: {},
examineForm: {
isAllowed: '1',
contactAddress: '',
contactName: '',
contactPhone: ''
},
examineRules: {
contactAddress: [{ required: true, message: '退货地址是必填项', trigger: 'change' }],
contactName: [{ required: true, message: '联系人是必填项', trigger: 'change' }],
contactPhone: [
{ required: true, message: '手机号是必填项', trigger: 'change' },
{
validator: (rule, value, callback) => {
let phoneReg = /^(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 phoneReg.refundType(value) ? callback() : callback(new Error('请输入正确的联系号码'))
},
trigger: 'blur'
}
]
},
examineFormData: [
{
label: '退货地址',
name: 'contactAddress',
type: 'input',
maxlength: 50
},
{
label: '联系人',
name: 'contactName',
type: 'input',
maxlength: 10
},
{
label: '手机号',
name: 'contactPhone',
type: 'input',
maxlength: 11
}
],
// 确认收获
isReceivingVisible: false,
// 表格按钮
tableButtonList: [
{
type: 'GLButton',
name: '查看订单',
attrs: {
type: 'text',
fn: '查看订单'
},
listeners: {
click: this.handleDetail
}
},
{
type: 'GLButton',
name: '退款',
attrs: {
type: 'text',
fn: '退款'
},
condition: row => {
// return row.orderSource == 4 && [2, 6, 21, 22].includes(+row.orderStatus) && row.isOffline != 0
return row.showRefund == 1 //是否展示退款按钮 1:是 0:否
},
listeners: {
click: row => {
if (row.paymentModel == 3) {
this.refundVisible = true
this.refundParams = {
orderCode: row.orderCode,
afterSaleType: '2'
}
} else this.secondConfirm('退款', '请确定是否发起退款?', 'orderManage', 'crowdFundRefundApi', { orderCode: row.orderCode, afterSaleType: '1' }, () => { }, this.searchForm.requestSource != 0)
}
}
},
{
type: 'GLButton',
name: '订单核销',
attrs: {
type: 'text',
fn: '订单核销'
},
condition: row => {
// return (row.deliveryType == 1 && row.orderStatus == 21) || (row.afterSaleType == 2 && [2, 4, 5, 6, 7, 9, 10].includes(row.orderStatus))
return row.showVerf == 1 //是否展示核销按钮 1:是 0:否
},
listeners: {
click: this.handleWriteOff
}
},
{
type: 'GLButton',
// name: '输入快递信息',
name: '商品发货',
attrs: {
type: 'text',
fn: '商品发货'
},
condition: row => {
return row.deliveryType == 2 && row.orderStatus == 6
},
listeners: {
click: this.handleExpressInfo
}
},
{
type: 'GLButton',
name: '退款审核',
attrs: {
type: 'text',
fn: '退款审核'
},
condition: row => {
return row.afterSaleStatus == 1
},
listeners: {
click: this.handleExamine
}
},
{
type: 'el-button',
name: '确认收货',
attrs: {
type: 'text'
},
condition: row => {
return row.afterSaleStatus == 4
},
listeners: {
click: this.handleReceiving
}
},
{
type: 'el-button',
name: '设为已完结',
attrs: {
type: 'text'
},
condition: row => {
return row.marketingStatus && row.marketingStatus == 3
},
listeners: {
click: row => {
this.secondConfirm('设为已完结', '请确定将此订单营销状态设为已完结?', 'orderManage', 'finishOrderStatus', { subOrderCode: row.orderCode }, false)
}
}
},
],
// 表格
getListApi: this.$apis.order.getListApi,
tableParams: {
mutiSelectName: 'table',
mutiSelectUniqueKey: 'orderCode',
// checkSelectKey: 'orderStatus',
// checkSelectVal: [9, 10, 11, 22],
checkSelectable: row => {
// return [9, 10, 11, 22].indexOf(row.orderStatus) == -1 && row.isOffline != '0' && row?.paymentModel != 3
return row.showRefund == 1 && row?.paymentModel != 3 //v3.6.0修改批量退款
},
listName: 'list',
tableOption: true,
tableColumns: []
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
// 基本数据
baseData: {
searchOrderStatusList: orderManageStatusList.filter(item => ['1', '3', '21', '22', '6', '9'].includes(item.confId)),
searchAfterSaleStatusList: afterSaleStatusList.filter(item => ['1', '6', '7'].includes(item.confId)),
orderStatusList: orderManageStatusList,
afterSaleStatusList: afterSaleStatusList,
orderSourceList: orderSourceList,
deliveryTypeList: deliveryTypeList,
refundTypeList: [
{ confId: '1', confName: '退款退货' },
{ confId: '2', confName: '我要退款(无需退货)' },
{ confId: '3', confName: '众筹订单退款' }
],
// shareStaffTypeList: [
// { confId: '1', confName: '个微' },
// { confId: '2', confName: '企微' },
// { confId: '3', confName: '员工' }
// ],
shareStaffSourceList: [
{ confId: '1', confName: '个微' },
{ confId: '2', confName: '企微' },
{ confId: '3', confName: '员工' }
],
testSheetTypeList: [
{ confId: '0', confName: '否' },
{ confId: '1', confName: '是' }
],
isOffSheetTypeList: [
{ confId: '0', confName: '是' },
{ confId: '1', confName: '否' }
],
businessTypeList: Util.deepClone(businessType),
marketingStatusList: [
{ confId: '1', confName: '已完结' },
{ confId: '3', confName: '未完结' },
{ confId: '4', confName: '已取消' }
]
},
requestSourceList: ['全部订单', '已付款', '未付款', '已退款', '售后订单', '待审批'],
batchRefundVisible: false,
refundVisible: false,
refundParams: {},
selectList: [],
refundTips: true,
selectTableParams: {
tableColumns: [
{
label: '客户信息',
prop: 'customerName',
width: 160,
formatter: cellValue => {
return cellValue.customerName || '-'
}
},
{
label: '推荐人',
prop: 'shareStaffName',
width: 210,
addHtml: 'shareStaffName'
},
{
label: '支付定金/元',
prop: 'payPrice',
width: '120',
formatter: cellValue => {
return cellValue.payPrice || '0'
}
},
{
label: '门店',
prop: 'merchantName',
line: 1,
width: 280
},
{
label: '活动名称',
prop: 'activityName',
}
]
},
importVisible: false,
file: {
fileName: '',
fileType: ''
},
showTable: false, //显示隐藏表格
hideStatus: true
}
},
mounted() {
this.getCrowdfundingOrderConfig()
// this.getCount()
},
methods: {
async getCrowdfundingOrderConfig() {
let tableColumns = [
{
label: '客户名称',
prop: 'customerName',
width: 160,
formatter: cellValue => {
return cellValue.customerName || '-'
}
},
{
label: '手机号',
prop: 'customerPhone',
width: 160,
formatter: cellValue => {
return cellValue.customerPhone || '-'
}
},
{
label: '其他',
prop: 'otherInformation',
width: 210
},
{
label: '微信名称',
prop: 'weChatName',
addHtml: 'weChatName',
width: 210
},
{
label: '推荐人',
prop: 'shareStaffName',
width: 210,
addHtml: 'shareStaffName'
},
{
label: '推荐人ID',
prop: 'shareStaffId',
name: 'shareStaffId',
width: 210,
},
{
label: '指派人',
prop: 'assignName',
width: 210,
addHtml: 'assignName'
},
{
label: '推荐人手机号',
prop: 'shareStaffPhone',
width: 160,
formatter: cellValue => {
return cellValue.shareStaffPhone || '-'
}
},
{
label: '订单时间',
prop: 'createdDate',
width: '180',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
},
{
label: '支付时间',
prop: 'payDate',
width: '180',
formatter: cellValue => {
return cellValue.payDate ? dayjs(cellValue.payDate).format('YYYY-MM-DD HH:mm:ss') : '-'
}
},
{
label: '核销时间',
prop: 'verificationDate',
width: '180',
formatter: cellValue => {
return cellValue.verificationDate ? dayjs(cellValue.verificationDate).format('YYYY-MM-DD HH:mm:ss') : '-'
}
},
{
label: '车架号',
prop: 'vinNo',
width: 130,
addHtml: 'vinNo'
},
{
label: '订单状态',
prop: 'orderStatus',
addHtml: 'orderStatus',
width: 160
},
{
label: '业务场景',
prop: 'businessType',
width: 120,
formatter: cellValue => {
let type = cellValue.businessType
if (type) {
return businessType.find(item => item.optionId == type).optionLabel
} else {
return '-'
}
}
},
{
label: '线下订单',
prop: 'isOffline',
width: 120,
formatter: cellValue => {
return cellValue.isOffline == 1 ? '否' : cellValue.isOffline == 0 ? '是' : '-'
}
},
{
label: '商品名称',
prop: '',
width: '120',
formatter: cellValue => {
return cellValue.orderGoods.length ? cellValue.orderGoods.map(item => item.goodsName).join(',') : '-'
}
},
{
label: '支付定金/元',
prop: 'payPrice',
width: '120',
formatter: cellValue => {
return cellValue.payPrice || '0'
}
},
{
label: '活动名称',
prop: 'activityName',
width: '120'
},
{
label: '门店信息',
prop: 'merchantName',
line: 1,
width: 280
},
{
label: '订单类型',
prop: 'orderSource',
width: '100',
formatter: cellValue => {
return this.baseData.orderSourceList.map(item => item.confId).includes(cellValue.orderSource + '') ? this.baseData.orderSourceList.find(item => item.confId == cellValue.orderSource).confName : '-'
}
},
{
label: '测试单',
prop: 'orderType',
width: '100',
addHtml: 'orderType'
},
{
label: '退款类型',
prop: 'afterSaleType',
width: 100,
formatter: cellValue => {
return { 1: '退订单', 2: '退定金' }[cellValue.afterSaleType] || '-'
}
},
{
label: '营销状态',
name: 'marketingStatus',
width: 180,
addHtml: 'marketingStatus',
},
{
label: '售后状态',
prop: 'afterSaleStatus',
width: '100',
formatter: cellValue => {
return this.baseData.afterSaleStatusList.map(item => item.confId).includes(cellValue.afterSaleStatus + '') ? this.baseData.afterSaleStatusList.find(item => item.confId == cellValue.afterSaleStatus).confName : '-'
}
},
{
label: '结算方式',
prop: 'deliveryType',
width: '100',
formatter: cellValue => {
return this.baseData.deliveryTypeList.map(item => item.confId).includes(cellValue.deliveryType + '') ? this.baseData.deliveryTypeList.find(item => item.confId == cellValue.deliveryType).confName : '-'
}
},
{
label: '订单编号',
prop: 'orderCode',
width: '180'
},
{
label: '商户订单号',
prop: 'outTradeNo',
width: '160',
formatter: cellValue => {
return cellValue.outTradeNo || '-'
}
}
],
searchFormData = [
{
label: '订单编号',
name: 'orderCode',
type: 'input'
},
{
label: '订单状态',
name: 'orderStatuses',
type: 'select',
multiple: true,
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'searchOrderStatusList',
changeAttr: (value, targetItem) => {
var isAdd = value.length > this.oldVal.orderStatuses.length
var targetVal = value[value.length - 1]
var formIdx = this.searchFormData.findIndex(item => item.label == '订单状态')
if (!isAdd) {
for (var i = 0; i < this.oldVal.orderStatuses.length; i++) {
if (!value.includes(this.oldVal.orderStatuses[i])) {
targetVal = this.oldVal.orderStatuses[i]
break
}
}
}
!targetVal && (this.searchForm.orderStatuses = isAdd ? this.searchFormData[formIdx].optionList.map(item => item.confId) : [])
if (targetVal) {
var idx = value.findIndex(item => item == '')
if (idx != -1 && this.searchForm.orderStatuses.length < this.searchFormData[formIdx].optionList.length) {
this.searchForm.orderStatuses.splice(idx, 1)
} else if (idx == -1 && this.searchForm.orderStatuses.length == this.searchFormData[formIdx].optionList.length - 1) {
this.searchForm.orderStatuses.push('')
}
}
this.oldVal.orderStatuses = this.$common.utils.deepClone(this.searchForm.orderStatuses)
}
},
{
label: '售后状态',
name: 'afterSaleStatuses',
type: 'select',
labelWidth: 72,
multiple: true,
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'searchAfterSaleStatusList',
changeAttr: (value, targetItem) => {
var isAdd = value.length > this.oldVal.afterSaleStatuses.length
var targetVal = value[value.length - 1]
var formIdx = this.searchFormData.findIndex(item => item.label == '售后状态')
if (!isAdd) {
for (var i = 0; i < this.oldVal.afterSaleStatuses.length; i++) {
if (!value.includes(this.oldVal.afterSaleStatuses[i])) {
targetVal = this.oldVal.afterSaleStatuses[i]
break
}
}
}
!targetVal && (this.searchForm.afterSaleStatuses = isAdd ? this.searchFormData[formIdx].optionList.map(item => item.confId) : [])
if (targetVal) {
var idx = value.findIndex(item => item == '')
if (idx != -1 && this.searchForm.afterSaleStatuses.length < this.searchFormData[formIdx].optionList.length) {
this.searchForm.afterSaleStatuses.splice(idx, 1)
} else if (idx == -1 && this.searchForm.afterSaleStatuses.length == this.searchFormData[formIdx].optionList.length - 1) {
this.searchForm.afterSaleStatuses.push('')
}
}
this.oldVal.afterSaleStatuses = this.$common.utils.deepClone(this.searchForm.afterSaleStatuses)
}
},
{
label: '门店',
name: 'merchantNames',
type: 'select',
labelWidth: 56,
multiple: true,
attrs: {
multipleLimit: 10,
},
noFilter: false,
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
},
{
label: '客户姓名',
name: 'customerName',
type: 'input'
},
{
label: '订单日期',
name: 'createDate',
type: 'datePicker',
labelWidth: 72,
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
},
{
label: '结算方式',
name: 'deliveryType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'deliveryTypeList'
},
{
label: '商户订单号',
name: 'outTradeNo',
type: 'input',
maxlength: 50
},
{
label: '车架号',
name: 'vin',
labelWidth: 56,
type: 'input',
maxlength: 50
},
{
label: '推荐人',
name: 'shareStaffName',
labelWidth: 56,
type: 'input',
maxlength: 100
},
{
label: '推荐人类型',
name: 'shareStaffSource',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'shareStaffSourceList'
},
{
label: '活动名称',
name: 'activityNames',
labelWidth: 56,
type: 'select',
multiple: true,
attrs: {
multipleLimit: 10,
},
noFilter: false,
optionList: [],
optionId: 'confId',
optionLabel: 'confName'
},
{
label: '商品名称',
name: 'goodsName',
labelWidth: 56,
type: 'input',
maxlength: 100
},
{
label: '手机号',
name: 'customerPhone',
labelWidth: 56,
type: 'input',
maxlength: 11
},
{
label: '推荐人手机号',
name: 'shareStaffPhone',
labelWidth: 56,
type: 'input',
maxlength: 11
},
{
label: '测试单',
name: 'orderType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'testSheetTypeList'
},
{
label: '退款类型',
name: 'afterSaleType',
type: 'select',
optionList: [
{
confId: null,
confName: '全部'
},
{
confId: '2',
confName: '退定金'
},
{
confId: '1',
confName: '退订单'
}
],
optionId: 'confId',
optionLabel: 'confName',
},
{
label: '线下订单',
name: 'isOffline',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'isOffSheetTypeList'
},
{
label: '业务场景',
name: 'businessType',
type: 'select',
optionList: [],
optionId: 'optionId',
optionLabel: 'optionLabel',
optionsName: 'businessTypeList'
},
{
label: '营销状态',
name: 'marketingStatus',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'marketingStatusList'
}
],
hideStatus = false
try {
const res = await this.$apis.common.getCrowdfundingOrderConfig(),
filterTableList = ['customerPhone', 'otherInformation', 'shareStaffName', 'assignName', 'shareStaffPhone', 'verificationDate', 'vinNo', 'afterSaleStatus'],
filterFormList = ['afterSaleStatuses', 'vin', 'shareStaffName', 'shareStaffSource', 'customerPhone', 'shareStaffPhone']
hideStatus = res == 1
if (hideStatus) {
for (let i = 0; i < tableColumns.length; i++) {
if (filterTableList.includes(tableColumns[i].prop)) {
tableColumns.splice(i, 1)
i--
}
}
for (let i = 0; i < searchFormData.length; i++) {
if (filterFormList.includes(searchFormData[i].name)) {
searchFormData.splice(i, 1)
i--
}
}
}
} catch (error) {
console.log(error)
}
this.tableParams.tableColumns = tableColumns
this.searchFormData = searchFormData
this.showTable = true
this.hideStatus = hideStatus
this.getOptionsList('searchFormData')
this.getCrowdfundingParams()
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.createDate?.length) {
params.createdStartDateStr = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.createdEndDateStr = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
if (params.orderStatuses.includes('3') && params.requestSource == '0') delete params.requestSource
delete params.createDate
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
delete this.tableSearchForm.createDate
resolve()
})
},
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') {
console.log(item.optionsName)
console.log(this.baseData[item.optionsName])
}
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)
}
}
})
}
},
//取消弹框,如果没有凭证,直接关闭
handleApprovalClose() {
if (this.approvalInfo.verificationVoucher) {
this.openPassDialog()
} else {
this.writeOffApprovalVisible = false
}
},
// 确认不通过审批
confirmNoPass() {
this.$refs?.cancelRef?.validate(valid => {
if (valid) this.handleApprovalConfirm(1)
})
},
// 确认通过审批
handleApprovalConfirm(type) {
let params = { orderCode: this.orderCode }
if (type == 1) {
params.reasonsForFailure = this.cancelForm.reasonsForFailure
params.failureflag = true
}
this.$apis.orderManage.orderVerfication(params).then(result => {
this.writeOffApprovalVisible = false
this.closePassDialog()
this.handleSearch()
})
},
//关闭不通过弹窗
closePassDialog() {
this.isCancelVisible = false
this.cancelForm = {
reasonsForFailure: ''
}
},
// 打开不通过弹窗
openPassDialog() {
this.$refs?.cancelRef?.clearValidate()
this.writeOffApprovalVisible = false
this.isCancelVisible = true
},
// 订单指派
handlerAssign(item) {
// this.
console.log(item)
this.merchantId = item.merchantId
this.orderCode = item.orderCode
this.isStaffVisible = true
},
// 改变订单类型
changeOrderType(item) {
console.log(item)
let params = {
subOrderCode: item.orderCode,
orderType: item.orderType ? 0 : 1
}
this.secondConfirm('测试单', '测试单数据不纳入对应战报和喜报的排名展示', 'orderManage', 'updateOrderType', params, false)
// return
// this.$apis.orderManage
// .updateOrderType(params)
// .then(result => {
// this.handleSearch()
// })
// .catch(err => {
// console.log(err)
// })
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn, isResetPage = true) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: Util.debounce((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()
isResetPage ? this.handleSearch() : this.$refs.allOrderRef.refreshTable(false)
}
})
}
}, 500)
})
},
getCount() {
var params = this.getParams()
delete params.createDate
// if(params.orderStatuses.includes('3')) return
this.$apis.orderManage.getCountApi(params).then(res => {
this.statisticsInfo = res || { orderCount: '', payPriceTotal: '', refundTotal: '' }
})
},
handleDetail(row) {
this.$router.push({
path: '/orderManage/orderDetail',
query: {
orderCode: row.orderCode
}
})
},
// 输入快递信息 - start
handleExpressClose() {
this.isExpressVisible = !this.isExpressVisible
this.orderCode = ''
this.expressForm = {
deliveryCompany: '',
deliveryNumber: ''
}
},
handleExpressConfirm() {
this.$refs.expressRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.expressForm)
params.orderCode = this.orderCode
this.$apis.orderManage.addDeliveryApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error',
customClass: 'message-Z-zinde'
})
if (res.code == '0') {
this.handleExpressClose()
this.handleSearch()
}
})
}
})
},
handleExpressInfo(row) {
this.isExpressVisible = !this.isExpressVisible
this.orderCode = row.orderCode
},
// 输入快递信息 - end
// 订单核销 - start
handleWriteOffClose() {
this.isWriteOffVisible = !this.isWriteOffVisible
this.orderCode = ''
this.writeOffForm = {
verificationCode: ''
}
},
handleWriteOffConfirm() {
this.$refs.writeOffRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.writeOffForm)
params.orderCode = this.orderCode
this.$apis.orderManage.writeOffApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error',
customClass: 'message-Z-zinde'
})
if (res.code == '0') {
this.handleWriteOffClose()
this.searchForm.requestSource == 0 ? this.$refs.allOrderRef.refreshTable(false) : this.handleSearch()
}
})
}
})
},
handleStaffClose() {
console.log('dialogVisible')
this.isStaffVisible = !this.isStaffVisible
},
handleDialogConfirm() {
this.handleStaffClose()
this.handleSearch()
},
handleWriteOff(row) {
if (row.orderSource == 4) {
this.secondConfirm('订单核销', '请确定是否核销此订单?', 'orderManage', 'crowdFundWriteOffApi', { orderCode: row.orderCode }, () => { }, this.searchForm.requestSource != 0)
return true
}
this.isWriteOffVisible = !this.isWriteOffVisible
this.orderCode = row.orderCode
},
// 订单核销 - end
// 退款审核 - start
handleExamineClose() {
this.isExamineVisible = !this.isExamineVisible
this.orderCode = ''
this.orderInfo = {}
this.examineForm = {
isAllowed: '1',
contactAddress: '',
contactName: '',
contactPhone: ''
}
},
submitExamine(params) {
this.$apis.orderManage.examineAllowApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error',
customClass: 'message-Z-zinde'
})
if (res.code == '0') {
this.handleExamineClose()
this.searchForm.requestSource == 0 ? this.$refs.allOrderRef.refreshTable(false) : this.handleSearch()
}
})
},
handleExamineConfirm() {
var params = {
id: this.orderInfo.id
}
if (this.orderInfo.refundType == 1 && this.examineForm.isAllowed == '1') {
this.$refs.examineRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
params = this.$common.utils.deepClone(this.examineForm)
params.id = this.orderInfo.id
params.isAllowed = true
this.submitExamine(params)
}
})
} else {
params.isAllowed = this.examineForm.isAllowed == '1'
this.submitExamine(params)
}
},
handleExamine(row) {
this.orderCode = row.orderCode
this.$apis.orderManage.examineDetailApi({ orderCode: row.orderCode }).then(res => {
this.orderInfo = res || {}
this.orderInfo.refundTypeName = [1, 2, 3].includes(this.orderInfo.refundType) ? this.baseData.refundTypeList.find(item => item.confId == this.orderInfo.refundType + '').confName : '-'
this.orderInfo.createdDateStr = this.orderInfo.createdDate ? dayjs(this.orderInfo.createdDate).format('YYYY-MM-DD HH:mm:ss') : '-'
this.isExamineVisible = !this.isExamineVisible
})
},
// 退款审核 - end
// 确认收货 - start
handleReceivingClose() {
this.isReceivingVisible = !this.isReceivingVisible
this.orderCode = ''
this.orderInfo = {}
},
handleReceivingConfirm() {
var params = {
id: this.orderInfo.id
}
this.$apis.orderManage.confirmReceiptGoodsApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error',
customClass: 'message-Z-zinde'
})
if (res.code == '0') {
this.handleReceivingClose()
this.handleSearch()
}
})
},
handleReceiving(row) {
this.$apis.orderManage.examineDetailApi({ orderCode: row.orderCode }).then(res => {
this.orderInfo = res || {}
this.orderInfo.refundTypeName = [1, 2, 3].includes(this.orderInfo.refundType) ? this.baseData.refundTypeList.find(item => item.confId == this.orderInfo.refundType + '').confName : '-'
this.orderInfo.createdDateStr = this.orderInfo.createdDate ? dayjs(this.orderInfo.createdDate).format('YYYY-MM-DD HH:mm:ss') : '-'
this.isReceivingVisible = !this.isReceivingVisible
})
},
// 确认收货 - end
setTableFinishFun() {
this.$refs.allOrderRef.data.forEach(item => {
item.vinNo = item.vin ? (item.vin.split(',').length > 1 ? item.vin.split(',') : item.vin) : '-'
})
//接收到的数据为空
this.$refs.allOrderRef.data.length ? (this.$refs.allOrderRef.tableHeightValues = '') : this.$refs.allOrderRef.setTableHeightFun()
this.getCount()
},
handleSearch() {
// this.$refs.allOrderRef.refreshTable(true, false)
this.$refs.allOrderRef.refreshTable()
},
handleTabClick() {
this.handleSearch()
},
handleExport(row) {
var params = this.getParams()
this.$apis.orderManage.orderExportApi(params).then(res => {
exportFn(res)
})
},
handleReset() {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
selectionTable(selectList) {
this.selectList = selectList.filter(e => e.orderCode)
},
async refundFun() {
let { refundParams } = this
const res = this.$apis.orderManage.crowdFundRefundApi(refundParams)
this.refundVisible = false
this.searchForm.requestSource != 0 ? this.handleSearch() : this.$refs.allOrderRef.refreshTable(false)
},
async getCrowdfundingParams() {
/**参数类型 1:众筹活动名称(返回类型String),2:众筹活动门店 */
const activity = await this.$apis.seckillActivity.getCrowdfundingParams({
parameterType: 1
})
let activityNameList = []
if (activity?.parameters && activity.parameters.length) {
activity.parameters.map(e => {
activityNameList.push({
confId: e,
confName: e
})
})
}
const activityNamesIndex = this.searchFormData.findIndex(e => e.name == 'activityNames')
this.$set(this.searchFormData[activityNamesIndex], 'optionList', this.$common.utils.deepClone(activityNameList))
const merchant = await this.$apis.seckillActivity.getCrowdfundingParams({
parameterType: 2
})
let merchantNameList = []
if (merchant?.parameters && merchant.parameters.length) {
merchant.parameters.map(e => {
merchantNameList.push({
confId: e,
confName: e
})
})
}
const merchantNamesIndex = this.searchFormData.findIndex(e => e.name == 'merchantNames')
this.$set(this.searchFormData[merchantNamesIndex], 'optionList', this.$common.utils.deepClone(merchantNameList))
},
async batchRefundOrder() {
let { selectList } = this,
orderCodes = []
console.table(selectList)
selectList.map(e => orderCodes.push(e.orderCode))
const res = await this.$apis.orderManage.batchRefundOrder({
orderCodes,
refundType: 1
})
console.log(res)
this.batchRefundVisible = false
if (res) {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error',
customClass: 'message-Z-zinde'
})
this.searchForm.requestSource != 0 ? this.handleSearch() : this.$refs.allOrderRef.refreshTable(false)
}
},
handleXlsxChange(e) {
let [file] = e.srcElement.files,
reader = new FileReader()
if (!file) return
this.$notify({
title: '提示',
message: '文件上传中,请稍后'
})
// 默认1MB
this.file.fileName = file.name
reader.readAsDataURL(file)
reader.onload = el => {
const imgFile = el.target.result
const arrBase64 = imgFile.split(',')
const splitStr = file.name.split('.')
this.file.fileType = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
this.$notify({
title: '提示',
message: '文件上传成功',
type: 'success'
})
}
},
importFun() {
let { file: {
fileType,
fileName
} } = this
if (fileType) this.$apis.orderManage.importCrowdFundingOrder({ file: fileType }).then(res => {
console.log(res)
if (res) {
this.$notify({
title: '提示',
message: '订单导入成功',
type: 'success'
})
this.visibleImportDialog()
this.searchForm.requestSource != 0 ? this.handleSearch() : this.$refs.allOrderRef.refreshTable(false)
}
})
else this.$message.error(fileName ? '文件上传中,请稍后' : '请上传文件后,在点击确定')
},
downloadXlsx() {
var alink = document.createElement('a')
alink.href = '//img02.glsx.com.cn/weapp/resource/saas/scrm/xlsx/订单导入模板.xlsx'
alink.setAttribute('target', '_blank')
alink.download = '订单导入模板.xlsx'
alink.click()
alink.remove()
},
visibleImportDialog(val = false) {
if (this.$refs?.uploadInput) this.$refs.uploadInput.value = null
this.file = {
fileName: '',
fileType: ''
}
this.importVisible = val
}
}
}
</script>
<style lang="scss">
.order-table-popover {
min-width: 80px !important;
padding: 8px 12px !important;
}
.order-manage {
.container {
padding: 20px 14px;
}
.table-tips {
font-size: 14px;
color: #333333;
display: flex;
&-text {
padding-top: 12px;
}
}
.car-no {
cursor: pointer;
font-size: 12px;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 2px 4px;
line-height: 25px;
}
.txt-blue {
color: #5850ff;
}
.list-tips {
background: #e4e3ff;
border-radius: 4px;
border: none;
display: flex;
align-items: center;
}
.order-manage-table {
padding: 20px;
border: 1px solid #e5e5e5;
border-radius: 0 4px 4px 4px;
display: flex;
flex-direction: column;
.refund-btn {
margin: 0 0 10px auto;
}
.is-disabled {
color: #c0c4cc !important;
border-color: #ebeef5 !important;
}
}
.flex-default.tabs {
border-bottom: 1px solid #e5e5e5;
border-bottom: 0;
.el-tabs__item {
background: #fafafa;
border: 1px solid #e5e5e5 !important;
border-radius: 4px 4px 0 0;
border-bottom: 0;
}
.is-active {
border-bottom: 1px solid #fff !important;
font-weight: 500;
}
}
.switchStyle .el-switch__label {
position: absolute;
display: none;
color: #fff;
}
.el-switch__core {
background-color: rgba(166, 166, 166, 1);
}
.switchStyle .el-switch__label--left {
z-index: 9;
left: 20px;
}
.switchStyle .el-switch__label--right {
z-index: 9;
left: 4px;
}
.switchStyle .el-switch__label.is-active {
display: block;
}
.switchStyle.el-switch .el-switch__core,
.el-switch .el-switch__label {
width: 50px !important;
}
.assignLabel {
color: var(--primaryColor, #5850ff);
&:hover {
cursor: pointer;
}
}
}
.approvalInfoTips {
font-weight: 500;
font-size: 16px;
color: #1d1d1d;
margin-bottom: 16px;
}
.approvalInfoItem {
margin-left: 20px;
margin-bottom: 10px;
display: flex;
}
.refund-dialog {
.refund-item {
padding-top: 14px;
}
.refund-tips {
font-size: 14px;
margin: 8px 0 6px 0;
color: #999999;
}
.refund-dialog-tips-close {
margin-left: auto;
cursor: pointer;
}
.tips-img {
margin: 0 8px 0 0 !important;
}
}
.el-select .el-select__tags > span {
width: 80%;
display: flex !important;
}
.el-select .el-tag {
max-width: 55% !important;
}
.import-dialog {
.el-dialog__body {
height: 70px !important;
min-height: 70px !important;
max-height: 70px !important;
}
.import-button {
position: relative;
margin-left: 10px;
cursor: pointer;
.upload-input {
position: absolute;
top: 0;
left: 0;
width: 88px;
height: 100%;
opacity: 0;
z-index: 1;
cursor: pointer !important;
}
}
.download-btn {
position: absolute;
top: 110%;
right: 0;
}
}
.btn-group {
.el-button + .el-button {
margin-left: 8px;
}
}
.approvalWrap {
margin-left: 84px;
}
.noPassDialog {
.tip {
margin-left: 72px;
width: 522px;
font-weight: 400;
font-size: 14px;
color: #666666;
}
.form {
margin-top: 16px;
.el-form-item__label {
height: 32px;
line-height: 32px;
padding-right: 10px;
}
.el-textarea__inner {
font-family: auto;
}
}
}
</style>
<!-- 精品升级订单 -->
<template>
<div class="purchase">
<div class="container">
<GLCombiForm ref="showSearch"
:rowNumber="1"
:formObj="searchForm"
:formData="showFormData"
@handleOk="handleSearch"
@handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<span class="priceSpan">累计订单金额:¥{{ totalCount }}元</span>
<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="carTypeName"
slot-scope="scope">
<span v-show="scope.scope.carBrand">{{ scope.scope.carBrand }}</span>
<span v-show="scope.scope.carChildsBrandName">-{{ scope.scope.carChildsBrandName }}</span>
<span v-show="scope.scope.carSeriesName">-{{ scope.scope.carSeriesName }}</span>
</template>
<template slot="upgradeGoodsNames"
slot-scope="scope">
<span v-for="(item, index) in scope.scope.subOrderList"
:key="index">
<p v-if="item.upgradeGoodsId">{{ item.upgradeGoodsName }}</p>
<p v-else>{{ item.baseGoodsName }}</p>
</span>
</template>
<template slot="upgradeGoodsAlias"
slot-scope="scope">
<span v-for="(item, index) in scope.scope.subOrderList"
:key="index">
<p>{{ item.upgradeGoodsAlias }}</p>
</span>
</template>
<template slot="goodsPrice"
slot-scope="scope">
<span v-for="(item, index) in scope.scope.subOrderList"
:key="index">
<p v-if="item.upgradeGoodsId">¥ {{ item.totalPrice }}</p>
<p v-else>¥ {{ item.baseRetailPrice }}</p>
</span>
</template>
<template slot="upgradeWarrantyPeriod"
slot-scope="scope">
<span v-for="(item, index) in scope.scope.subOrderList"
:key="index">
<p>{{ item.upgradeWarrantyPeriod ? (item.upgradeWarrantyPeriod + '年') : '无' }}</p>
</span>
</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>
</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 { Util } from '@/common/util'
import { orderStatusList, upgradeList, constructionList, profitAllocationStatusList, sourceList, manageTypeList } from '@/common/constant.js'
export default {
name: 'Order',
components: {
},
data() {
return {
sessionInfo: this.$globalState.session,
size: 'small',
url: url,
searchForm: {
sceneType: 1,
status: '',
upgradeFinishFlag: '',
customerName: '',
yqMerchantId: '',
merchantId: '',
orderTime: '',
constructionFlag: '',
sourceList: '',
channelType: '',
businessModel: '',
subShopMerchantId: ''
},
tableSearchForm: {},
paramsObj: {},
// 查看门店
detailVisible: false,
// tableData: tableData,
showFormData: [
{
label: '订单状态',
name: 'status',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'orderStatusList'
},
{
label: '升级状态',
name: 'upgradeFinishFlag',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'upgradeList'
},
{
label: '施工状态',
name: 'constructionFlag',
type: 'select',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'constructionList'
},
{
label: '分账状态',
name: 'profitAllocationStatus',
type: 'select',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'profitAllocationStatusList'
},
{
label: '商品名称',
name: 'orderGoodsName',
type: 'input',
isClear: true,
maxlength: 20
},
{
label: '商品别名',
name: 'upgradeGoodsAlias',
type: 'input',
isClear: true,
maxlength: 20
}, {
label: '客户姓名',
name: 'customerName',
type: 'input',
isClear: true,
maxlength: 20
}, {
// label: '园区店',
label: '服务对接',
name: 'yqMerchantId',
type: 'select',
optionList: [],
optionId: 'merchantId',
optionLabel: 'merchantName',
optionsName: 'parkServiceList',
changeAttr: (value, targetItem) => {
if (value) {
// 获取流量方
this.getServiceStore(value)
} else {
this.getAllServiceStore()
// this.baseData.storeIdList = []
}
this.searchForm.merchantId = ''
this.getOptionsList()
}
}, {
label: '流量来源',
name: 'merchantId',
type: 'select',
noDataText: '请先选择服务对接',
// noDataText: '请先选择园区店',
optionList: [],
optionId: 'merchantId',
optionLabel: 'merchantName',
optionsName: 'storeIdList',
changeAttr: (value, targetItem) => {
if (value) {
// // 获取二级流量方
this.getDiversionMerchantRef(value)
} else {
// this.baseData.subShopMerchantList = []
}
this.searchForm.subShopMerchantId = ''
this.getOptionsList()
}
},
{
label: '下单日期',
name: 'orderTime',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
}, {
label: '订单编号',
name: 'orderCode',
type: 'input',
isClear: true,
maxlength: 128
}, {
label: '订单来源',
name: 'sourceList',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'sourceList'
}, {
label: '渠道',
name: 'channelType',
type: 'select',
optionList: [],
optionId: 'value',
optionLabel: 'name',
optionsName: 'channelTypeList'
}, {
label: '服务对接模式',
name: 'businessModel',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'manageTypeList'
}, {
label: '二级流量方',
name: 'subShopMerchantId',
type: 'select',
noDataText: '请先选择流量来源',
isHide: this.subShopMerchanShowHide,
optionList: [],
optionId: 'subMerchantId',
optionLabel: 'subMerchantName',
optionsName: 'subShopMerchantList'
}
],
// 表格
getListApi: this.$apis.order.getList,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '订单编号',
prop: 'orderCode',
width: '160'
},
{
label: '订单时间',
prop: 'orderTimeStr',
width: 170
},
{
label: '支付时间',
prop: 'paySuccessDate',
width: 170
},
// {
// label: '下单时间',
// prop: 'orderTime',
// formatter: cellValue => {
// return dayjs(cellValue.orderTime).format('YYYY-MM-DD HH:mm:ss')
// },
// width: 180
// },
{
label: '客户姓名',
prop: 'customerName',
minWidth: 100,
},
{
label: '客户性别',
prop: 'customerSex',
minWidth: 100,
formatter: (cellValue) => {
return { 1: "男", 2: "女" }[cellValue.customerSex] || "-"
}
},
{
label: '客户车型',
prop: 'carTypeName',
addHtml: 'carTypeName',
minWidth: 200
},
{
label: '客户车牌号',
prop: 'plateNumber',
minWidth: 110
},
{
label: '升级状态',
prop: 'upgradeFlag',
minWidth: 100,
formatter: (cellValue) => {
return this.baseData.upgradeList.find(item => item.confId === cellValue.status)?.confLabel || "待升级"
}
},
{
label: '施工状态',
prop: 'constructionFlag',
minWidth: 100,
formatter: (cellValue) => {
return this.baseData.constructionList.find(item => item.confId === cellValue.status)?.confLabel || "-"
}
},
{
label: '订单状态',
prop: 'status',
minWidth: 100,
formatter: cellValue => {
return this.baseData.orderStatusList.find(item => item.confId === cellValue.status)?.confLabel || '-'
}
},
{
label: '分账状态',
prop: 'profitAllocationStatus',
minWidth: 100,
formatter: cellValue => {
return this.baseData.profitAllocationStatusList.find(item => item.confId === cellValue.status)?.confLabel || '-'
}
},
{
label: '商品名称',
prop: 'upgradeGoodsNames',
addHtml: 'upgradeGoodsNames',
minWidth: 150
},
{
label: '商品别名',
prop: 'upgradeGoodsAlias',
addHtml: 'upgradeGoodsAlias',
minWidth: 150
},
{
label: '商品单价',
prop: 'goodsPrice',
addHtml: 'goodsPrice',
minWidth: 100
},
{
label: '总价',
prop: 'totalPrice',
minWidth: 100,
formatter: (cellValue) => {
return cellValue.totalPrice ? '¥' + cellValue.totalPrice : '-'
}
},
{
label: '质保年限',
prop: 'upgradeWarrantyPeriod',
addHtml: 'upgradeWarrantyPeriod',
minWidth: 100
},
{
label: '流量方',
prop: 'merchantName',
minWidth: 170
},
{
label: '二级流量方',
prop: 'subShopMerchantName',
minWidth: 170
},
{
label: '服务对接',
prop: 'sellerMerchantName',
minWidth: 170
},
{
label: '安装服务商',
prop: 'installMerchantName',
minWidth: 170
},
{
label: '营销服务商',
prop: 'marketingMerchantName',
minWidth: 170
},
{
label: '销售顾问',
prop: 'employeeName',
minWidth: 100
},
{
label: '转化人员',
prop: 'sellerName',
minWidth: 100
},
{
label: '订单来源',
prop: 'source',
minWidth: 110,
formatter: (cellValue) => {
return cellValue.source == 7 ? '系统导入' : '小程序订单'
}
},
{
label: '操作',
width: '180px',
addHtml: 'auth-button'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 基本数据
baseData: {
orderStatusList: orderStatusList,
upgradeList: upgradeList,
constructionList: constructionList,
profitAllocationStatusList: profitAllocationStatusList,
sourceList: sourceList,
parkServiceList: [],
storeIdList: [],
channelTypeList: [],
manageTypeList: manageTypeList,
subShopMerchantList: []
},
totalCount: '',
subShopMerchanShowHide: true,
}
},
created() {
},
mounted() {
this.getChannelType()
this.getAllServiceStore()
this.showFormData = this.showFormData.filter(item => item.name !== 'yqMerchantId')
this.getServiceStore(this.sessionInfo.merchantId)
this.getBaseData()
this.getOrderCount()
},
watch: {
'baseData.subShopMerchantList': {
handler(val) {
console.log('baseData.subShopMerchantList', val)
if (val.length > 0) {
this.showFormData[this.findFormIdx('subShopMerchantId')].isHide = false
} else {
this.showFormData[this.findFormIdx('subShopMerchantId')].isHide = true
}
},
immediate: true
}
},
methods: {
async getBaseData() {
this.getOptionsList()
},
findFormIdx(name) {
return this.showFormData.findIndex(item => item.name === name)
},
getChannelType(merchantId) {
this.$apis.public.getChannelType({}).then(res => {
this.baseData.channelTypeList = res || []
this.getOptionsList()
})
},
getServiceStore(merchantId) {
this.$apis.public.getServiceStore({
yqMerchantId: merchantId
}).then(res => {
this.baseData.storeIdList = res || []
this.getOptionsList()
})
},
getAllServiceStore() {
this.$apis.merchant.listShop4sByRef({
scene: 1
}).then(res => {
console.log('this.getAllServiceStore()', res)
this.baseData.storeIdList = res || []
this.getOptionsList()
})
},
getDiversionMerchantRef(merchantId) {
this.$apis.merchant.getDiversionMerchantRef({
merchantId: merchantId
}).then(res => {
this.baseData.subShopMerchantList = res || []
this.getOptionsList()
})
},
getParams() {
var params = Util.deepClone(this.searchForm)
const form = this.searchForm
if (form.orderTime && form.orderTime.length) {
params.placeOrderStartDateStr = Util.dateFormate(form.orderTime[0], 'YYYY-MM-DD HH:mm:ss')
params.placeOrderEndDateStr = Util.dateFormate(form.orderTime[1], 'YYYY-MM-DD') + ' 23:59:59'
}
// delete params.placeOrderTimeStr
// delete params.warehousingTimeStr
console.log(form)
return params
},
getOrderCount() {
var params = this.getParams()
params = {
...params
}
this.$apis.order.getOrderCount(params).then(res => {
this.totalCount = res.totalPriceCount
})
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
delete this.tableSearchForm.warehousingTimeStr
delete this.tableSearchForm.placeOrderTimeStr
resolve()
})
},
// 查看详情
handleDetail(row) {
this.$router.push({
path: '/orderManage/orderDetail',
query: row
})
},
getOptionsList(formName = 'showFormData', 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()
},
exportExcel() {
var params = this.getParams()
this.$apis.purchaseShopping.exportExcel(params).then(res => {
window.location.href = res
})
},
handleSearch() {
this.$refs.orderRef.refreshTable()
},
handleReset() {
this.searchForm = {
sceneType: 1,
status: '',
upgradeFinishFlag: '',
customerName: '',
yqMerchantId: '',
merchantId: '',
orderTime: '',
constructionFlag: '',
channelType: '',
businessModel: '',
subShopMerchantId: ''
}
this.baseData.storeIdList = []
// this.getOptionsList()
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;
}
.priceSpan {
font-size: 14px;
color: #909399;
}
}
</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>
<components :is="tabName"></components>
<!-- 表格区域 开始 -->
<!-- <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'
import Order from "./components/order.vue"
import Crowdfunding from "./components/crowdfunding.vue"
export default {
components: {
Order,
Crowdfunding
},
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: "crowdfunding",
3: "carDamage"
}
this.tabName = arr[+this.activeName]
console.log('this.tabName', this.tabName);
},
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>
<d2-container class="order-detail">
<div class="d2-container-content">
<!-- <p class="edit-title">
订单详情
</p> -->
<div class="form_gp">
<p class="edit-sub-title">
订单详情
</p>
<el-form class="edit-sub-block"
:inline="true">
<el-form-item label="订单单号:">
{{ detail.orderCode }}
</el-form-item>
<el-form-item label="订单状态:">
{{ statusOpts[detail.status] }}
</el-form-item>
<el-form-item label="订单来源:"
v-if="!specialAccout">
{{ detail.source==7 ? '系统导入' : '小程序订单' }}
</el-form-item>
<el-form-item style="width:400px"
label="交易流水:">
{{ detail.outTradeNo }}
</el-form-item>
<el-form-item v-if="detail.source==7"
label="订单导入时间:">
{{ detail.createdDate }}
</el-form-item>
<el-form-item label="支付方式:">
{{ detail.upgradeFlag == 'N'?'战败': payTypeOpts[detail.payType] }}
</el-form-item>
<el-form-item label="施工状态:">
{{ constructioOpts[detail.constructionFlag] }}
</el-form-item>
<el-form-item label="支付状态:">
{{ detail.upgradeFlag == 'N'?'战败': payStatusOpts[detail.payStatus] }}
</el-form-item>
<el-form-item label="收款凭证:">
<img v-if="detail.payVoucher"
class="order-img"
:src="detail.payVoucher"
@click="handleEnlargeImg">
<span v-else>无</span>
</el-form-item>
<el-form-item label="退款订单:"
v-if="detail.status == 12">
{{ detail.refundRemark }}
</el-form-item>
</el-form>
</div>
<div class="form_gp">
<p class="edit-sub-title">
用户信息
</p>
<el-form class="edit-sub-block"
:inline="true">
<el-form-item label="用户姓名:">
{{ detail.customerName }}
</el-form-item>
<!-- <el-form-item label="车架号:">
{{ detail.standNo }}
</el-form-item> -->
<el-form-item label="评价:">
{{ detail.customerComment }}
</el-form-item>
</el-form>
</div>
<div class="form_gp">
<p class="edit-sub-title">
关联信息
</p>
<el-form class="edit-sub-block"
:inline="true">
<el-form-item label="流量来源:">
{{ detail.merchantName }}
</el-form-item>
<el-form-item label="推荐人:">
{{ detail.employeeName }}
</el-form-item>
<el-form-item label="技师:"
v-if="detail.sceneType == 1">
{{ detail.technicianName }}
</el-form-item>
<div>
<!-- <el-form-item label="园区店:"> -->
<el-form-item label="服务对接:">
{{ detail.sellerMerchantName }}
</el-form-item>
<el-form-item label="转化员:">
{{ detail.sellerName }}
</el-form-item>
<el-form-item label="门店地址:">
{{ detail.sellerMerchantAddress }}
</el-form-item>
</div>
<div>
<!-- 审计特殊字段 -->
<el-form-item label="二级流量方:"
v-if="detail.subShopMerchantName">
{{ detail.subShopMerchantName }}
</el-form-item>
</div>
</el-form>
</div>
<div class="form_table_gp">
<p class="edit-sub-title">
订单商品
</p>
<el-table :data="detail.subOrderList"
border
:header-cell-style="{'text-align':'center', 'background-color':'#fafafa'}"
show-summary
:summary-method="getSummaries"
style="width: 100%">
<!-- <el-table-column :prop="detail.upgradeFlag === 'Y' ? 'upgradeGoodsCommodityCode' : 'baseGoodsCommodityCode'" -->
<el-table-column :prop="'upgradeGoodsCommodityCode'"
align="center"
label="商品ID"
width="180px" />
<el-table-column :prop="'upgradeGoodsName'"
align="center"
label="商品名称" />
<el-table-column :prop="'upgradeGoodsAlias'"
align="center"
label="商品别名" />
<el-table-column :prop="'upgradeGoodsTypeName' "
align="center"
label="商品分类" />
<el-table-column :prop="'upgradeBrandMerchantName'"
align="center"
label="品牌商" />
<el-table-column :prop="'upgradePrice'"
align="center"
label="商品售价" />
<!-- <el-table-column
prop="upgradeDiscount"
align="center"
label="优惠折扣">
<template slot-scope="scope">
<span v-if="detail.upgradeFlag === 'Y'">{{scope.row.upgradeDiscount === '10' ? '无' : scope.row.upgradeDiscount}}</span>
<span v-else>0</span>
</template>
</el-table-column> -->
<el-table-column prop="upgradeWarrantyPeriod"
align="center"
label="质保年限">
<span
slot-scope="scope">{{ scope.row.upgradeWarrantyPeriod ? (scope.row.upgradeWarrantyPeriod + '年') : '无' }}</span>
</el-table-column>
<el-table-column prop="cardCode"
align="center"
label="质保条形码">
<span slot-scope="scope">{{ scope.row.cardCode ? (scope.row.cardCode) : '无' }}</span>
</el-table-column>
<el-table-column prop="nums"
align="center"
label="数量(件)">
<template slot-scope="scope">
<span>{{ scope.row.number }}件</span>
</template>
</el-table-column>
<el-table-column prop="totalPrice"
align="center"
label="支付金额">
<template slot-scope="scope">
<span v-if="detail.upgradeFlag === 'Y'">¥{{ scope.row.totalPrice || 0 }}</span>
<span v-else>0</span>
</template>
</el-table-column>
</el-table>
</div>
<div class="form_table_gp">
<p class="edit-sub-title">
订单进度
</p>
<!-- header-cell-style="text-align:center; background-color:#fafafa" -->
<el-table :data="detail.accessLogs"
border
:header-cell-style="{'text-align':'center','background-color':'#fafafa'}"
style="width: 100%">
<el-table-column prop="createdDateStr"
align="center"
label="时间" />
<el-table-column prop="logContent"
align="center"
label="当前进度" />
<el-table-column prop="userName"
align="center"
label="关联操作员">
<template slot-scope="scope">
<span v-if="detail.payType == 1 && scope.row.logType == 3">用户 微信支付</span>
<span v-else>{{ logType[scope.row.logType] }} {{ scope.row.userName }}</span>
</template>
</el-table-column>
</el-table>
</div>
<!-- <p style="text-align:left; padding-left: 30px; margin: 0 0 16px 0;">
<el-button type="primary"
@click="handleClose">
返回
</el-button>
</p> -->
</div>
<el-dialog :visible="imgVisible"
:before-close="handleEnlargeImg">
<img width="100%"
:src="detail.payVoucher"
alt="图片">
</el-dialog>
</d2-container>
</template>
<script>
import { mapActions } from 'vuex'
import { deepClone } from '@/common/util'
import { payType } from '@/common/constant.js'
import dayjs from 'dayjs'
// import { getList, goodsOrderDetail } from '@api/order'
export default {
name: 'OrderDetail',
components: {
},
data() {
return {
// userInfo: this.$store.state.d2admin.user.info,
imgVisible: false,
detail: {
orderCode: '',
subOrderList: []
},
statusOpts: {
1: '待升级',
2: '战败',
3: '待支付',
4: '已支付',
// 5: '已退款',
6: '已评价',
9: '已撤销',
10: '已关闭',
11: '错误订单',
12: '已退款'
},
payStatusOpts: {
1: '未支付',
2: '已支付'
},
payTypeOpts: deepClone(payType),
// {
// '1': '微信支付',
// '2': '4S店支付',
// '3': 'POS机收款'
// },
logType: {
1: '预录员',
2: '转化员',
3: '转化员',
4: '用户',
5: '管理员'
},
constructioOpts: {
Y: '已施工',
N: '未施工'
},
productList: [{
name: 'xx'
}, {
}],
progressList: [],
signRefundVisible: false,
// signRefundFlag: false,
page: {
pageNum: 1,
pageSize: 20
}
}
},
computed: {
// specialAccout() {
// return this.userInfo?.loginAccount?.loginAccout == '18123663366'
// }
},
mounted() {
this.detail = this.$route.query
console.log('this.detail', this.detail);
// this.signRefundFlag = this.$route.params.signRefundFlag
if (this.detail.source == 7) {
this.detail.createdDate = dayjs(this.detail.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
this.getGoodsOrderDetail()
},
methods: {
...mapActions({ close: 'd2admin/page/close' }),
// arraySpanMethod({ row, column, rowIndex, columnIndex }) {
// if (rowIndex === 1) {
// if (columnIndex === 0) {
// return [1, 6]
// } else {
// return [1, 1]
// }
// }
// },
// getTotalNums() {
// return this.detail.subOrderList.reduce((prev, item) => prev + item.nums, 0)
// },
handleEnlargeImg() {
this.imgVisible = !this.imgVisible
},
getSummaries(param) {
const { columns } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
column.align = 'is-left'
column.colSpan = 6
return
}
if (index === 1) {
const numberList = this.detail.subOrderList.map(item => item.number)
sums[index] = (numberList.length ? numberList.reduce((preVal, curVal) => { return preVal + curVal }) : '0') + '件'
return
}
if (index === 2) {
sums[index] = this.detail.upgradeFlag === 'Y' ? `¥${this.detail.totalPrice}` : '¥0'
}
})
return sums
},
handleClose() {
if (this.$route.params.from) { // 从待补录订单列表跳转
this.close({ tagName: '/orderSupplement' })
this.$router.push({ name: 'orderSupplement' })
} else { // 从订单列表跳转
this.close({ tagName: '/orderList' })
this.$router.push({ name: 'orderList' })
}
this.close({ tagName: '/orderDetail' })
},
refund() {
this.signRefundVisible = !this.signRefundVisible
},
dialogClose(flag) {
this.signRefundVisible = !this.signRefundVisible
if (flag) {
this.getGoodsOrderDetail()
}
},
getGoodsOrderDetail() {
this.$apis.order.goodsOrderDetail({ orderCode: this.detail.orderCode }).then(res => {
this.detail = res
})
}
}
}
</script>
<style lang="scss">
.order-detail {
.d2-container-content {
margin-top: 0 !important;
}
.edit-title {
// padding-left: 0;
}
.form_gp {
color: #333333;
padding: 20px 30px;
border-bottom: 1px solid #eee;
// h4{
// margin: 0 0 10px;
// }
.edit-sub-title {
font-weight: bold;
margin-bottom: 10px;
}
.edit-sub-block {
padding: 0 16px;
}
.el-form-item {
width: 300px;
margin-bottom: 0px;
}
.order-img {
width: 80px;
height: 80px;
cursor: pointer;
}
}
.form_table_gp {
padding: 20px 30px;
margin-bottom: 20px;
}
}
.signRefundBtn {
margin-left: 10px;
.signRefundIcon {
width: 12px;
margin-right: 5px;
}
span {
display: flex;
align-items: center;
justify-content: center;
}
}
</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!