Commit 3affad7d by 杨明

fixed

1 parent 6e72223e
Showing 88 changed files with 9991 additions and 1610 deletions
NODE_ENV='production' NODE_ENV='production'
# must start with VUE_APP_ # must start with VUE_APP_
VUE_APP_ENV = 'production'
\ No newline at end of file \ No newline at end of file
VUE_APP_ENV = 'production'
VUE_APP_SERVER = production
\ No newline at end of file \ No newline at end of file
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
"javascript.format.insertSpaceBeforeFunctionParenthesis": true, "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"jsxBracketSameLine": true, "jsxBracketSameLine": true,
"files.insertFinalNewline": true, "files.insertFinalNewline": true,
"prettier.ignorePath": ".prettierignore",
"useTabs": false, "useTabs": false,
"eslintIntegration": true, "eslintIntegration": false,
"overrides": [ "overrides": [
{ {
"files": ".prettierrc", "files": ".prettierrc",
......
module.exports = { module.exports = {
presets: ["@vue/cli-plugin-babel/preset"]
};
\ No newline at end of file \ No newline at end of file
presets: ['@vue/cli-plugin-babel/preset']
}
...@@ -5,16 +5,19 @@ ...@@ -5,16 +5,19 @@
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint",
"build:test": "vue-cli-service build --mode test"
}, },
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
"core-js": "^3.4.4", "core-js": "^3.4.4",
"el-tree-transfer": "^2.2.6", "el-tree-transfer": "^2.2.6",
"glsx-common": "^1.4.6", "glsx-common": "^1.4.9",
"glsx-components": "^1.2.4", "glsx-components": "^1.4.7",
"glsx-table": "^1.0.9", "glsx-table": "^1.0.9",
"vue-draggable-resizable": "^2.3.0" "vue-draggable-resizable": "^2.3.0",
"vuedraggable": "^2.24.3",
"xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0", "@vue/cli-plugin-babel": "^4.1.0",
......
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
} }
}, },
created() { created() {
document.onkeydown = function () { document.onkeydown = function() {
var evt = window.event || arguments[0] var evt = window.event || arguments[0]
if (evt && evt.keyCode == 13) { if (evt && evt.keyCode == 13) {
if (typeof evt.cancelBubble != 'undefined') evt.cancelBubble = true if (typeof evt.cancelBubble != 'undefined') evt.cancelBubble = true
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
this.myMessage = this.message this.myMessage = this.message
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.parent-child-communication { .parent-child-communication {
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
} }
#app { #app {
background: #f4f5fa; background: #f4f5fa;
padding: 0px 20px 20px 40px; padding: 0px 20px 20px 20px;
position: absolute; position: absolute;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
...@@ -49,4 +49,4 @@ export default { ...@@ -49,4 +49,4 @@ export default {
overflow-y: auto; overflow-y: auto;
height: 100%; height: 100%;
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -6,151 +6,196 @@ ...@@ -6,151 +6,196 @@
* @param {*} params * @param {*} params
* @returns * @returns
*/ */
import { http } from '@/main' import { http, http_tag } from '@/main'
let session = 'mini-c38a80dd-cf48-4491-8933-fb2eb57fb4ca-rop' let session = 'mini-c38a80dd-cf48-4491-8933-fb2eb57fb4ca-rop'
const getListApi = params => { const getListApi = params => {
params.method = 'entmicro.api.staff.listFollowerStaffByPage' params.method = 'entmicro.api.staff.listFollowerStaffByPage'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const getFollower = params => { const getFollower = params => {
params.method = 'entmicro.api.staff.listFollowerStaffByPage' params.method = 'entmicro.api.staff.listFollowerStaffByPage'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const querylabeltree = params => { const querylabeltree = params => {
params.method = 'scrm.api.datahub.label.querylabeltree' params.method = 'scrm.api.datahub.labelgroup.queryLabelTree'
params.sessionId = session params.sessionId = session
return http({ return http_tag({
url: '/rop-scrm-datahub/router', url: '/rop-scrm-datahub/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
}
const queryCrowdtree = params => {
params.method = 'scrm.api.datahub.user.queryCrowdTree'
return http_tag({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true
})
} }
const deleteChannelCodeBill = params => { const deleteChannelCodeBill = params => {
params.method = 'entmicro.api.code.deleteChannelCodeBill' params.method = 'entmicro.api.code.deleteChannelCodeBill'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const getSubCodeChannelCodeBill = params => { const getSubCodeChannelCodeBill = params => {
params.method = 'entmicro.api.code.getSubCodeChannelCodeBill' params.method = 'entmicro.api.code.getSubCodeChannelCodeBill'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const saveChannelCodeBill = params => { const saveChannelCodeBill = params => {
params.method = 'entmicro.api.code.saveChannelCodeBill' params.method = 'entmicro.api.code.saveChannelCodeBill'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const updateChannelCodeBill = params => { const updateChannelCodeBill = params => {
params.method = 'entmicro.api.code.updateChannelCodeBill' params.method = 'entmicro.api.code.updateChannelCodeBill'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const listChannelCodeBill = params => { const listChannelCodeBill = params => {
params.method = 'entmicro.api.code.listChannelCodeBill' params.method = 'entmicro.api.code.listChannelCodeBill'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const deleteChannelCode = params => { const deleteChannelCode = params => {
params.method = 'entmicro.api.code.deleteChannelCode' params.method = 'entmicro.api.code.deleteChannelCode'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const detailChannelCode = params => { const detailChannelCode = params => {
params.method = 'entmicro.api.code.detailChannelCode' params.method = 'entmicro.api.code.detailChannelCode'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const listChannelCodeByPage = params => { const listChannelCodeByPage = params => {
params.method = 'entmicro.api.code.listChannelCodeByPage' params.method = 'entmicro.api.code.listChannelCodeByPage'
params.sessionId = session params.sessionId = session
return http({ console.log(http)
url: '/rop-scrm-entmicro/router', return http({
method: 'POST', url: '/rop-scrm-entmicro/router',
data: params, method: 'POST',
sign: true data: params,
}) sign: true
})
} }
const saveChannelCode = params => { const saveChannelCode = params => {
params.method = 'entmicro.api.code.saveChannelCode' params.method = 'entmicro.api.code.saveChannelCode'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const updateChannelCode = params => { const updateChannelCode = params => {
params.method = 'entmicro.api.code.updateChannelCode' params.method = 'entmicro.api.code.updateChannelCode'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
}
const getCustomer = params => {
params.method = 'entmicro.api.customer.code.page'
params.sessionId = session
return http({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
const getChannelCodeStaffList = params => {
params.method = 'entmicro.api.code.getChannelCodeStaffList'
params.sessionId = session
return http({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
const getStatus = params => {
params.method = 'scrm.api.work.wechat.access.status'
params.sessionId = session
return http({
url: '/rop-scrm-wechat/router',
method: 'POST',
data: params,
sign: true
})
} }
export default { export default {
getListApi,
getFollower,
querylabeltree,
saveChannelCodeBill,
getSubCodeChannelCodeBill,
deleteChannelCodeBill,
updateChannelCode,
saveChannelCode,
listChannelCodeByPage,
detailChannelCode,
deleteChannelCode,
updateChannelCodeBill,
listChannelCodeBill
}
\ No newline at end of file \ No newline at end of file
getStatus,
getListApi,
getFollower,
querylabeltree,
saveChannelCodeBill,
getSubCodeChannelCodeBill,
deleteChannelCodeBill,
updateChannelCode,
saveChannelCode,
listChannelCodeByPage,
detailChannelCode,
deleteChannelCode,
updateChannelCodeBill,
listChannelCodeBill,
getCustomer,
getChannelCodeStaffList,
queryCrowdtree
}
...@@ -6,17 +6,53 @@ ...@@ -6,17 +6,53 @@
* @param {*} params * @param {*} params
* @returns * @returns
*/ */
import { http_common } from '@/main' import { http_common, http } from '@/main'
const pictureUpload = params => { const pictureUpload = params => {
params.method = "glsx.accounts.biz.common.pictureUpload" params.method = 'glsx.accounts.biz.common.pictureUpload'
return http_common({ return http_common({
url: '/router?method=glsx.accounts.biz.common.pictureUpload', url: '/router?method=glsx.accounts.biz.common.pictureUpload',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true, sign: true,
noSignAttr: ['file'] noSignAttr: ['file']
}) })
}
// const pictureUpload = params => {
// params.method = 'scrm.api.equity.common.upload.common.multiple'
// return http({
// url: 'rop-scrm-equity/router',
// data: params,
// sign: true,
// noSignAttr: ['file']
// })
// }
const getUploadFileToken = params => {
params.method = 'glsx.accounts.biz.common.getUploadFileToken'
return http_common({
url: 'http://qcdidicb.glsx.com.cn:7060/router',
method: 'get',
data: params
})
}
const checkAndListFragmentDetail = params => {
params.method = 'glsx.accounts.biz.common.checkAndListFragmentDetail'
return http_common({
url: 'http://qcdidicb.glsx.com.cn:7060/router',
method: 'get',
data: params
})
}
const uploadFileWithFileInfo = params => {
params.method = 'glsx.accounts.biz.common.uploadFileWithFileInfo'
return http_common({
url: 'http://qcdidicb.glsx.com.cn:7060/router',
method: 'get',
data: params
})
} }
export default { export default {
pictureUpload
}
\ No newline at end of file \ No newline at end of file
pictureUpload,
getUploadFileToken,
checkAndListFragmentDetail,
uploadFileWithFileInfo
}
...@@ -7,155 +7,198 @@ ...@@ -7,155 +7,198 @@
* @returns * @returns
*/ */
import { http } from '@/main' import { http } from '@/main'
let session = 'mini-c38a80dd-cf48-4491-8933-fb2eb57fb4ca-rop' let session = 'mini-57c1c42e-8a0c-4fc3-959c-b62813a471cd-rop'
const getCoupon = params => { const getCoupon = params => {
params.method = 'scrm.api.boutiquecoupon.coupon.page' params.method = 'scrm.api.boutiquecoupon.coupon.page'
return http({ return http({
url: '/rop-scrm-boutiquecoupon/router', url: '/rop-scrm-boutiquecoupon/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const getMerchant = params => { const getMerchant = params => {
params.method = 'scrm.api.coupon.list.merchant' params.method = 'scrm.api.coupon.list.merchant'
return http({ return http({
url: 'rop-scrm-coupon/router', url: 'rop-scrm-coupon/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const getCard = params => { const getCard = params => {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid' params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
return http({ return http({
url: 'rop-scrm-equity/router', url: 'rop-scrm-equity/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const merchantOpen = params => {
params.method = 'scrm.api.equity.service.merchant.config.get'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const merchant = params => {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const getPackage = params => { const getPackage = params => {
params.method = 'scrm.api.equity.package.info.list.with.page' params.method = 'scrm.api.equity.package.info.list.with.page'
return http({ return http({
url: 'rop-scrm-equity/router', url: 'rop-scrm-equity/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const getActivity = params => { const getActivity = params => {
params.method = 'scrm.api.shopmall.activity.page' params.method = 'scrm.api.shopmall.activity.page'
return http({ return http({
url: 'rop-scrm-shopmall/router', url: 'rop-scrm-shopmall/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const findAllByPage = params => { const findAllByPage = params => {
params.method = 'entmicro.api.dracIm.findAllByPage' params.method = 'entmicro.api.dracIm.findAllByPage'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const exportAdd = params => { const exportAdd = params => {
params.method = 'entmicro.api.dracIm.exportAdd' params.method = 'entmicro.api.dracIm.exportAdd'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const exportUpdate = params => { const exportUpdate = params => {
params.method = 'entmicro.api.dracIm.exportUpdate' params.method = 'entmicro.api.dracIm.exportUpdate'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const findById = params => { const findById = params => {
params.method = 'entmicro.api.dracIm.findById' params.method = 'entmicro.api.dracIm.findById'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const dracImMessage = params => { const dracImMessage = params => {
params.method = 'entmicro.api.dracImMessage.findAllByCondition' params.method = 'entmicro.api.dracImMessage.findAllByCondition'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const listChannelCodeBill = params => { const listChannelCodeBill = params => {
params.method = 'entmicro.api.code.listChannelCodeBill' params.method = 'entmicro.api.code.listChannelCodeBill'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const addConfig = params => { const addConfig = params => {
params.method = 'entmicro.api.dracImConfig.addConfig' params.method = 'entmicro.api.dracImConfig.addConfig'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const findConfig = params => { const findConfig = params => {
params.method = 'entmicro.api.dracImConfig.findConfig' params.method = 'entmicro.api.dracImConfig.findConfig'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const updateConfig = params => { const updateConfig = params => {
params.method = 'entmicro.api.dracImConfig.updateConfig' params.method = 'entmicro.api.dracImConfig.updateConfig'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
}
const customerPage = params => {
params.method = 'entmicro.api.dracIm.customer.search.page'
params.sessionId = session
return http({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
const findMerchantInfoByMerchantNo = params => {
params.method = 'entmicro.api.common.findMerchantInfoByMerchantNo.list'
params.sessionId = session
return http({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
} }
export default { export default {
getCoupon,
getMerchant,
getCard,
getPackage,
getActivity,
listChannelCodeBill,
findAllByPage,
dracImMessage,
exportAdd,
exportUpdate,
findById,
updateConfig,
findConfig,
addConfig
}
\ No newline at end of file \ No newline at end of file
getCoupon,
getMerchant,
merchantOpen,
merchant,
getCard,
getPackage,
getActivity,
listChannelCodeBill,
findAllByPage,
dracImMessage,
exportAdd,
exportUpdate,
findById,
updateConfig,
findConfig,
addConfig,
customerPage,
findMerchantInfoByMerchantNo
}
...@@ -9,123 +9,123 @@ ...@@ -9,123 +9,123 @@
import { http } from '@/main' import { http } from '@/main'
let session = 'mini-c38a80dd-cf48-4491-8933-fb2eb57fb4ca-rop' let session = 'mini-c38a80dd-cf48-4491-8933-fb2eb57fb4ca-rop'
const codeDefault = params => { const codeDefault = params => {
params.method = 'entmicro.api.drac.statistic.code.default' params.method = 'entmicro.api.drac.statistic.code.default'
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const listStaff = params => { const listStaff = params => {
params.method = 'entmicro.api.drac.statistic.code.detail.list.staff' params.method = 'entmicro.api.drac.statistic.code.detail.list.staff'
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const listTime = params => { const listTime = params => {
params.method = 'entmicro.api.drac.statistic.code.detail.list.time' params.method = 'entmicro.api.drac.statistic.code.detail.list.time'
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const detailTotal = params => { const detailTotal = params => {
params.method = 'entmicro.api.drac.statistic.code.detail.total' params.method = 'entmicro.api.drac.statistic.code.detail.total'
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const codeSearch = params => { const codeSearch = params => {
params.method = 'entmicro.api.drac.statistic.code.search' params.method = 'entmicro.api.drac.statistic.code.search'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const codeTrend = params => { const codeTrend = params => {
params.method = 'entmicro.api.drac.statistic.code.trend' params.method = 'entmicro.api.drac.statistic.code.trend'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const dayTrend = params => { const dayTrend = params => {
params.method = 'entmicro.api.drac.statistic.day.trend' params.method = 'entmicro.api.drac.statistic.day.trend'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const overview = params => { const overview = params => {
params.method = 'entmicro.api.drac.statistic.overview' params.method = 'entmicro.api.drac.statistic.overview'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const findMessageStatic = params => { const findMessageStatic = params => {
params.method = 'entmicro.api.dracIm.findMessageStatic' params.method = 'entmicro.api.dracIm.findMessageStatic'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const viewChart = params => { const viewChart = params => {
params.method = 'entmicro.api.drac.statistic.getCustomerStatisticCodeTrend' params.method = 'entmicro.api.drac.statistic.getCustomerStatisticCodeTrend'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const findAllMessageByPage = params => { const findAllMessageByPage = params => {
params.method = 'entmicro.api.dracIm.findAllMessageByPage' params.method = 'entmicro.api.dracIm.findAllMessageByPage'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
export default { export default {
codeDefault,
listStaff,
listTime,
detailTotal,
codeSearch,
codeTrend,
dayTrend,
overview,
viewChart,
findMessageStatic,
findAllMessageByPage
}
\ No newline at end of file \ No newline at end of file
codeDefault,
listStaff,
listTime,
detailTotal,
codeSearch,
codeTrend,
dayTrend,
overview,
viewChart,
findMessageStatic,
findAllMessageByPage
}
...@@ -9,69 +9,115 @@ ...@@ -9,69 +9,115 @@
import { http } from '@/main' import { http } from '@/main'
let session = 'mini-c38a80dd-cf48-4491-8933-fb2eb57fb4ca-rop' let session = 'mini-c38a80dd-cf48-4491-8933-fb2eb57fb4ca-rop'
const importsUpload = params => { const importsUpload = params => {
params.method = 'entmicro.api.imports.upload' params.method = 'entmicro.api.imports.upload'
params.sessionId = session params.sessionId = session
return http({ return http({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const downloadModel = params => { const downloadModel = params => {
params.method = 'entmicro.api.imports.download.model' params.method = 'entmicro.api.imports.download.model'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const merchantConfig = params => {
params.method = 'entmicro.api.datacube.merchant.config'
params.sessionId = session
return http({
url: 'rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
const datacubeUpload = params => {
params.method = 'entmicro.api.datacube.upload'
params.sessionId = session
return http({
url: 'rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
const importsRecord = params => { const importsRecord = params => {
params.method = 'entmicro.api.imports.record.page' params.method = 'entmicro.api.datacube.log.page'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
}
const datacubeNotice = params => {
params.method = 'entmicro.api.datacube.notice.pc'
params.sessionId = session
return http({
url: 'rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
} }
const importsCount = params => { const importsCount = params => {
params.method = 'entmicro.api.imports.count' params.method = 'entmicro.api.imports.count'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const importsKey = params => { const importsKey = params => {
params.method = 'entmicro.api.imports.record.key' params.method = 'entmicro.api.imports.record.key'
params.sessionId = session params.sessionId = session
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
const findLoginCount = params => { const findLoginCount = params => {
params.method = 'entmicro.api.common.findLoginCount' params.method = 'entmicro.api.common.findLoginCount'
return http({ return http({
url: 'rop-scrm-entmicro/router', url: 'rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
}
const queryCrowdTree = params => {
params.method = 'scrm.api.datahub.user.queryCrowdTree'
return http({
url: 'rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true
})
} }
export default { export default {
importsUpload,
downloadModel,
importsRecord,
importsCount,
importsKey,
findLoginCount
}
\ No newline at end of file \ No newline at end of file
importsUpload,
downloadModel,
importsRecord,
importsCount,
importsKey,
findLoginCount,
datacubeUpload,
merchantConfig,
datacubeNotice,
queryCrowdTree
}
import { http } from '@/main'
const path = 'entmicro.api.mass.'
const URL = 'rop-scrm-entmicro/router'
//权益卡
const getCard = params => {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
//权益卡
const merchant = params => {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
//是否开通权益
const merchantOpen = params => {
params.method = 'scrm.api.equity.service.merchant.config.get'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
//优惠券
const getCoupon = params => {
params.method = 'scrm.api.boutiquecoupon.coupon.page'
return http({
url: '/rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
//套餐
const getPackage = params => {
params.method = 'scrm.api.equity.package.info.list.with.page'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const getMerchant = params => {
params.method = 'scrm.api.coupon.list.merchant'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
//秒杀活动
const getActivity = params => {
params.method = 'scrm.api.shopmall.activity.page'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取素材组列表
const getGroupListApi = params => {
params.method = 'marketing.api.material.group.list'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取素材列表
const getMaterialListApi = params => {
// params.method = 'marketing.api.material.page'
params.method = 'marketing.api.material.sop.page'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true
})
}
//模板列表
const templatePage = params => {
params.method = `${path}template.page.search`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
//模板保存
const templateSave = params => {
params.method = `${path}template.save`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
//模板更新
const templateUpdate = params => {
params.method = `${path}template.update`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
//模板创建人
const createdNameList = params => {
params.method = `${path}template.created.name.list`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
export default {
getCard,
merchant,
getActivity,
getPackage,
getMerchant,
getCoupon,
merchantOpen,
getGroupListApi,
getMaterialListApi,
templatePage,
createdNameList,
templateUpdate,
templateSave
}
...@@ -101,7 +101,7 @@ img { ...@@ -101,7 +101,7 @@ img {
.scrm-box-f { .scrm-box-f {
background: #ffffff; background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1); // box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
} }
.scrm-flex { .scrm-flex {
...@@ -148,3 +148,43 @@ img { ...@@ -148,3 +148,43 @@ img {
.el-table tbody tr:hover > td { .el-table tbody tr:hover > td {
background: #f4f3ff !important; background: #f4f3ff !important;
} }
.el-message-box .el-message-box__title,
.el-message-box .el-message-box__headerbtn {
display: none;
}
.el-message-box__content {
text-align: center;
padding: 50px 0px 50px;
}
.el-message-box__status.el-icon-warning {
display: none;
}
.el-message-box__btns {
text-align: center;
padding: 20px 0px 10px;
border-top: 1px solid #e6e6e6;
}
.el-message-box__btns button:nth-child(2) {
margin-left: 40px;
}
.el-message-box__status + .el-message-box__message {
padding: 0px 10px;
}
.el-message-box--center {
padding: 0px;
}
.el-message--info {
height: 40px;
background: #e6e9ff;
border: 1px solid #5850ff;
border-radius: 4px;
font-size: 14px;
color: rgba(0, 0, 0, 0.65);
}
.el-message .el-icon-info {
color: #5850ff;
font-size: 16px;
}
.el-radio:focus:not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner {
box-shadow: none !important;
}

644 Bytes | W: | H:

527 Bytes | W: | H:

src/assets/img/question.png
src/assets/img/question.png
src/assets/img/question.png
src/assets/img/question.png
  • 2-up
  • Swipe
  • Onion skin
<template>
<div class="full-container" v-bind="$attrs">
<el-tooltip placement="top" v-if="hoverStatus">
<div slot="content">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
<div :class="['full-text', identification]" :style="{ 'max-width': labelWidth + 'px' }" v-if="textType != 'text' && !haveClose">
<el-tag type="info" class="full-text" :disable-transitions="false">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</el-tag>
</div>
<div v-if="textType != 'text' && haveClose">
<el-tag class="tag-user-closable" :style="{ 'max-width': labelWidth + 'px' }" type="info" :disable-transitions="false" closable @close="handleRemove">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<span :class="['full-text-user', { 'user-icon-checked': textType == 'user' && haveClose }, identification]">{{ label }}</span>
</el-tag>
</div>
<div :class="[line ? 'full-text-line' : 'full-text', identification]" :style="{ 'max-width': labelWidth + 'px', '-webkit-line-clamp': line }" v-if="textType == 'text'">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
</el-tooltip>
<template v-else>
<div :class="['full-text', identification]" @mouseenter="hoverFun" :style="{ 'max-width': labelWidth + 'px' }" v-if="textType != 'text' && !haveClose">
<el-tag type="info" class="full-text" :disable-transitions="false">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</el-tag>
</div>
<div @mouseenter="hoverFun" v-if="textType != 'text' && haveClose">
<el-tag class="tag-user-closable" type="info" :style="{ 'max-width': labelWidth + 'px' }" :disable-transitions="false" closable @close="handleRemove">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<span :class="['full-text-user', identification]">{{ label }}</span>
</el-tag>
</div>
<div :class="[line ? 'full-text-line' : 'full-text', identification]" @mouseenter="hoverFun" :style="{ 'max-width': labelWidth + 'px', '-webkit-line-clamp': line }" v-if="textType == 'text'">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
</template>
</div>
</template>
<script>
export default {
name: 'GLFull',
data() {
return {
hoverStatus: false,
identification: 'text_' + this.identi
}
},
props: {
//唯一标识
identi: {
type: String,
default: 'identi'
},
//文本
label: {
type: String,
default: ''
},
//文本宽度
labelWidth: {
type: Number,
default: 100
},
//行数
line: {
type: Number,
default: 0
},
textType: {
type: String,
default: 'text', // text 文本 user 跟进员工 tag 标签
validator: function(value) {
return ['text', 'user', 'tag'].indexOf(value) !== -1
}
},
//是否包含关闭按钮
haveClose: {
type: Boolean,
default: false
}
},
methods: {
hoverFun() {
if (this.line > 1) {
this.hoverStatus = document.querySelector(`.${this.identification}`).scrollHeight - 10 > document.querySelector(`.${this.identification}`).offsetHeight
return
}
if (this.haveClose) {
//this.hoverStatus = this.identi ? document.querySelector(`.${this.identification}`).scrollWidth > document.querySelector(`.${this.identification}`).offsetWidth : document.querySelector(`.full-text`).scrollWidth > this.labelWidth - 30
this.hoverStatus = document.querySelector(`.${this.identification}`).scrollWidth > document.querySelector(`.${this.identification}`).offsetWidth
} else {
let widthMuti = this.textType == 'user' ? 17 : this.textType == 'tag' ? 20 : 0
// this.hoverStatus = this.identi ? document.querySelector(`.${this.identification}`).scrollWidth - widthMuti > this.labelWidth : document.querySelector(`.full-text`).scrollWidth > this.labelWidth
this.hoverStatus = document.querySelector(`.${this.identification}`).scrollWidth - widthMuti > this.labelWidth
console.log(document.querySelector(`.${this.identification}`).scrollWidth)
}
},
handleRemove() {
this.$emit('handleRemove', this.$attrs)
}
}
}
</script>
<style scoped lang="scss">
.full-container {
display: inline-block;
margin-right: 6px;
/deep/ {
.el-tag {
margin-right: 10px;
line-height: 26px;
height: 26px;
}
}
}
.full-text {
max-width: 100%;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.full-text-user {
max-width: calc(100% - 14px);
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
&.user-icon-checked {
max-width: calc(100% - 30px);
}
}
.tag-user-closable {
display: flex;
align-items: center;
/deep/ {
.el-icon-close {
margin-top: 2px;
}
}
}
.full-text-line {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
word-break: break-all;
}
.el-icon-user-solid {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
</style>
import GLCombiForm from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GLCombiForm.install = function(Vue) {
Vue.component(GLCombiForm.name, GLCombiForm)
}
// 默认导出组件
export default GLCombiForm
\ No newline at end of file \ No newline at end of file
/**
* 时间控件-限制月份
*/
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-formwrap">
<div class="glsx-combi-form">
<GLSearch @onOk="handleOkFn" @onRest="handleRestFn">
<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" :style="{ ...item.style }" :prop="item.name">
<GLSearchItem>
<div slot="name">
<span v-if="!item.isHide && item.tips" class="tips-block" slot="label">
<span class="tips-label">{{ item.label }}</span>
<el-tooltip popper-class="tooltip-class" effect="dark" :content="item.tips" :placement="item.placement || 'top'">
<span class="tips-icon"></span>
</el-tooltip>
{{ item.label }}:
</span>
<span v-else-if="!item.isHide && item.label" slot="label">
<span class="combi-form-label" :style="{ width: '112px', 'padding-right': isEdit ? '12px' : labelPaddingRight + 'px' }">{{ item.label }}:</span>
</span>
<!-- // select 组件 作为label -->
<div v-if="item.type === 'selectInput'" id="selectlabel">
<el-select v-model="searchSelectObj[item.selectName].attr" placeholder="请选择" @change="item.handleSelectChange">
<el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option>
</el-select>
</div>
</div>
<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" :prefix-icon="item.prefixIcon" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :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="append">{{ item.append }}</span>
</el-input>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<!-- 选择-输入框 -->
<el-input class="select-inp" v-else-if="item.type === 'selectInput'" :placeholder="'请输入' + item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).label" :maxlength="item.maxlength" v-model.trim="searchSelectObj[item.selectName].value" :clearable="item.isClear || false">
<!-- <el-select v-model="searchSelectObj[item.selectName].attr" :style="{ width: item.selectWidth || (labelWidth + 'px') }" slot="prepend" placeholder="请选择" @change="item.handleSelectChange">
<el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option>
</el-select> -->
</el-input>
<!-- 选择-时间选择框 -->
<!-- <template v-else-if="item.type === 'selectDatePicker'">
<el-select v-model="searchSelectObj[item.selectName].attr" :style="{ width: item.selectWidth || (labelWidth + 'px') }" placeholder="请选择" @change="item.handleSelectChange">
<el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option>
</el-select>
<el-date-picker v-model="searchSelectObj[item.selectName].value" :type="item.dateType || 'daterange'" :clearable="item.isClear || false" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOption[item.pickerOptions]"></el-date-picker>
</template> -->
<!-- 双选择框 -->
<!-- <template v-else-if="item.type === 'selectDouble'">
<el-select v-model="searchSelectObj[item.selectName].attr" :style="{ width: item.selectWidth || (labelWidth + 'px') }" placeholder="请选择" @change="item.handleSelectChange">
<el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option>
</el-select>
<el-select v-model="searchSelectObj[item.selectName].value" :placeholder="'请选择' + item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).label">
<el-option label="全部" value=""></el-option>
<el-option v-for="subItem in item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).optionList" :key="subItem[item.optionId]" :label="subItem[item.optionLabel]" :value="subItem[item.optionId]"></el-option>
</el-select>
</template> -->
<!-- 选择框 -->
<div v-else-if="item.type === 'select'">
<el-select v-model="formObj[item.name]" :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 -->
<el-radio-group v-else-if="item.type === 'radio'" v-model="formObj[item.name]" :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] }}</el-radio>
</el-radio-group>
<el-date-picker v-else-if="item.type === 'datePicker'" v-bind="item.datePickerAttrs ? item.datePickerAttrs : {}" v-on="item.datePickerListeners ? item.datePickerListeners : {}" v-model="formObj[item.name]" :type="item.dateType || 'daterange'" :disabled="item.isDisabled" :value-format="item.valueFormat" :clearable="item.isClear || false" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="item.customPickerOptions || pickerOption[item.pickerOptions]"></el-date-picker>
</GLSearchItem>
</el-form-item>
</template>
<slot name="footer"></slot>
</el-form>
</GLSearch>
</div>
</div>
</template>
<script>
import GLSearch from '../../GlSearch'
import GLSearchItem from '../../GlSearchItem'
import { beforeRangePickerOptions, afterRangePickerOptions } from './common'
export default {
name: 'GLCombiForm',
data() {
return {
pickerOption: {
beforeRangePickerOptions: beforeRangePickerOptions,
afterRangePickerOptions: afterRangePickerOptions
},
isImgVisible: false,
dialogObj: {
url: '',
uploadType: 'img'
}
}
},
props: {
isBlock: {
type: Boolean,
default: false
},
// defaultWidth: {
// type: String,
// default: '215px'
// },
formRef: {
type: String,
default: 'formRef'
},
isEdit: {
type: Boolean,
default: false
},
// labelWidth: {
// type: Number,
// // 默认是四个字符长度
// default: 56
// },
labelPaddingRight: {
type: Number,
default: 0
},
formData: {
type: Array,
default: () => []
},
formObj: {
type: Object,
default: () => {}
},
hasTitle: {
type: Boolean,
default: true
},
formRules: {
type: Object,
default: () => {}
},
// 搜索+输入框/搜索组合组件,搜索栏绑值
searchSelectObj: {
type: Object,
default: () => {}
}
},
mounted() {},
components: {
GLSearch,
GLSearchItem
},
methods: {
//gl-search 方法
handleOkFn() {
this.$emit('handleOk')
},
handleRestFn() {
this.$emit('handleRest')
},
// 选择框-添加其他属性
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)
}
}
}
</script>
<style lang="scss">
.glsx-combi-formwrap {
/* .glsx-combi-form {
min-width: 922px;
} */
.glsx-combi-form .glsx-combi-form-block {
width: 100%;
}
.glsx-combi-form .isBlock {
display: block !important;
}
/* .glsx-combi-form .el-form-item {
width: 65%;
} */
@media screen and (max-width: 1062px) {
.glsx-combi-form .el-form-item--small {
width: 100%;
}
.glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%;
}
.search-list {
width: 100%;
}
}
@media screen and (min-width: 1062px) and (max-width: 1440px) {
.glsx-combi-form .el-form-item--small {
width: 50%;
}
.glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%;
}
.search-list {
width: 100%;
}
}
@media screen and (min-width: 1440px) and (max-width: 1720px) {
.glsx-combi-form .el-form-item--small {
width: 33.33%;
}
.glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%;
}
.search-list {
width: 100%;
}
}
@media screen and (min-width: 1720px) {
.glsx-combi-form .el-form-item--small {
width: 25%;
}
.glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%;
}
.search-list {
width: 100%;
}
}
// .glsx-combi-form .el-form-item--small {
// width: 100%;
// }
// .glsx-combi-form .el-form-item--small .el-form-item__content {
// width: 100%;
// }
// .glsx-combi-form .el-form-item--small .el-form-item__content .search-item {
// width: 100%;
// }
// .glsx-combi-form .el-form-item--small .el-form-item__content .search-item .el-input {
// width: 100%;
// }
.glsx-combi-form .el-form-item--small.el-form-item {
margin: 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: 20px;
}
.glsx-combi-form .tips-icon {
position: absolute;
display: inline-block;
width: 12px;
height: 12px;
top: 3px;
right: 14px;
margin-right: 4px;
cursor: pointer;
border: 1px dotted #7f7f7f;
border-radius: 50%;
}
.glsx-combi-form .tips-icon::before {
content: '?';
position: absolute;
width: 8px;
height: 8px;
top: -8px;
left: 1px;
font-size: 10px;
}
/* .glsx-combi-form .tips {
margin: 0;
} */
.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;
}
.glsx-combi-form .activity-Input {
position: absolute;
top: 0;
left: 0;
}
.glsx-combi-form .muti-imgs {
display: inline-block;
position: relative;
}
.activity-img .add {
position: absolute;
top: 40%;
font-size: 40px;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.activity-img .number {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
#selectlabel {
.el-select {
width: 100% !important;
.el-input__inner {
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
}
}
}
.select-inp {
.el-input__inner {
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
}
}
.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;
}
}
</style>
import GLSearch from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GLSearch.install = function(Vue) {
Vue.component(GLSearch.name, GLSearch)
}
// 默认导出组件
export default GLSearch
\ No newline at end of file \ No newline at end of file
<!-- <content> -->
<GLSearch @onOk="handleOkFn" @onRest="handleRestFn">
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-input size="small" v-model="input" placeholder="请输入内容"></el-input>
</GLSearchItem>
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-select v-model="value" size="small" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</GLSearchItem>
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-date-picker size="small" v-model="value1" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</GLSearchItem>
<GLSearchItem>
<el-select v-model="selvalue" placeholder="请选择" size="small" slot="name">
<el-option v-for="item in seloptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
<el-input size="small" v-model="input" placeholder="请输入内容"></el-input>
</GLSearchItem>
</GLSearch>
<el-button type="warning" @click="toggleShow(1)">显示代码</el-button>
```js {mixin:true}
{
data() {
return {
demo1: true,
//gl-search数据
input: '',
options: [
{
value: '选项1',
label: '黄金糕'
},
{
value: '选项2',
label: '双皮奶'
},
{
value: '选项3',
label: '蚵仔煎'
},
{
value: '选项4',
label: '龙须面'
},
{
value: '选项5',
label: '北京烤鸭'
}
],
value: '',
value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
seloptions: [
{
value: '选项1',
label: '黄金糕'
},
{
value: '选项2',
label: '双皮奶'
},
{
value: '选项3',
label: '蚵仔煎北京烤鸭'
},
{
value: '选项4',
label: '龙须面北京烤鸭'
},
{
value: '选项5',
label: '北京烤鸭北京烤鸭'
}
],
selvalue: ''
}
},
methods:{
toggleShow(num){
// console.log(123)
this['demo' + num] = !this['demo' + num]
},
//gl-search 方法
handleOkFn() {
console.log('您点击了确定')
},
handleRestFn() {
console.log('您点击了取消')
}
}
}
```
# 用来作为 markdown 代码的示例部分
<div v-if="demo1">
```vue
<template>
<GLSearch @onOk="handleOkFn" @onRest="handleRestFn">
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-input size="small" v-model="input" placeholder="请输入内容"></el-input>
</GLSearchItem>
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-select v-model="value" size="small" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</GLSearchItem>
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-date-picker size="small" v-model="value1" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</GLSearchItem>
<GLSearchItem>
<el-select v-model="selvalue" placeholder="请选择" size="small" slot="name">
<el-option v-for="item in seloptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
<el-input size="small" v-model="input" placeholder="请输入内容"></el-input>
</GLSearchItem>
</GLSearch>
</template>
<script>
import {GLSearch, GLSearchItem} from 'glsx-components'
// 全局引入一次css即可
import 'glsx-components/dist/glsx-components.css'
export default {
data() {
return {
//gl-search数据
input: '',
options: [
{
value: '选项1',
label: '黄金糕'
},
{
value: '选项2',
label: '双皮奶'
},
{
value: '选项3',
label: '蚵仔煎'
},
{
value: '选项4',
label: '龙须面'
},
{
value: '选项5',
label: '北京烤鸭'
}
],
value: '',
value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
seloptions: [
{
value: '选项1',
label: '黄金糕'
},
{
value: '选项2',
label: '双皮奶'
},
{
value: '选项3',
label: '蚵仔煎北京烤鸭'
},
{
value: '选项4',
label: '龙须面北京烤鸭'
},
{
value: '选项5',
label: '北京烤鸭北京烤鸭'
}
],
selvalue: ''
}
},
methods: {
handleOkFn() {
console.log('您点击了确定')
},
handleRestFn() {
console.log('您点击了取消')
}
}
}
</script>
```
</div>
<!-- </content> -->
<template>
<div class="gl-search" id="gl-search" :class="{ transTo: !expand }">
<div class="search-list">
<!-- 默认插槽 -->
<slot></slot>
<!-- <div class="search-item">
<div class="name">我是文本输入框</div>
<div class="input">
<el-input
size="small"
v-model="input"
placeholder="请输入内容"
></el-input>
</div>
</div> -->
<!-- <div class="search-item">
<div class="name">我是文本输入框</div>
<div class="input">
<el-input
size="small"
v-model="input"
placeholder="请输入内容"
></el-input>
</div>
</div> -->
<!-- <div class="search-item">
<div class="name">我是文本输入框</div>
<div class="input">
<el-input
size="small"
v-model="input"
placeholder="请输入内容"
></el-input>
</div>
</div>
<div class="search-item">
<div class="name">我是文本输入框</div>
<div class="input">
<el-input
size="small"
v-model="input"
placeholder="请输入内容"
></el-input>
</div>
</div> -->
</div>
<div class="gl-operate">
<div class="operate">
<el-button size="small" type="primary" @click="handleOk">查询</el-button>
<el-button size="small" @click="handleRest">重置</el-button>
<el-button type="text" size="small" @click="expandFn" v-if="hasExpand">
<span>{{ !expand ? '展开' : '收起' }}</span>
<i class="expand" :class="classIcon"></i>
</el-button>
<!-- <i class="el-icon-arrow-down expand"></i> -->
<!-- <i class="el-icon-arrow-up"></i> -->
</div>
</div>
</div>
</template>
<script>
export default {
name: 'GLSearch',
props: {},
data() {
return {
// input: '',
expand: false,
itemNum: 0,
time: null,
hasExpand: false
}
},
created() {},
mounted() {
this.getItemNum()
// 判断宽度按,是否显示展开收起
this.getClientWith()
window.addEventListener('resize', this.getClientWith, false)
},
computed: {
classIcon() {
return !this.expand ? 'el-icon-arrow-down' : 'el-icon-arrow-up'
}
},
methods: {
// 展开收起
expandFn() {
this.expand = !this.expand
},
// 获取item 输入框 的个数
getItemNum() {
const items = document.getElementById('gl-search').getElementsByClassName('search-item').length
this.itemNum = items
},
// 判断是否有展开收起标志
ifHasExpand(nowCol) {
if (this.itemNum > nowCol) {
return true
}
return false
},
// 监听函数
getClientWith() {
if (this.time) clearTimeout(this.time)
this.time = setTimeout(() => {
const clientWidth = document.documentElement.clientWidth
// console.log('clientWidth: ', clientWidth)
if (clientWidth <= 800) {
// 1列
this.hasExpand = this.ifHasExpand(1)
} else if (clientWidth <= 1440 && clientWidth > 800) {
// 2列
this.hasExpand = this.ifHasExpand(2)
} else if (clientWidth <= 1720 && clientWidth > 1440) {
// 3列
this.hasExpand = this.ifHasExpand(3)
} else {
// 4列
this.hasExpand = this.ifHasExpand(4)
}
}, 300)
},
handleOk() {
// 点击确定的回调
this.$emit('onOk')
},
handleRest() {
// 点击重置的回调
this.$emit('onRest')
}
},
components: {},
watch: {},
beforeDestroy() {
window.removeEventListener('resize', this.getClientWith, false)
this.time = null
}
}
</script>
<style lang="scss">
.gl-search {
&.transTo {
height: 52px;
}
display: flex;
justify-content: space-between;
overflow: hidden;
// @media screen and (max-width: 1062px) {
// .search-list {
// .search-item {
// width: 100%;
// }
// }
// }
// @media screen and (min-width: 1062px) and (max-width: 1440px) {
// .search-list {
// .search-item {
// width: 100%;
// }
// }
// }
// @media screen and (min-width: 1440px) and (max-width: 1720px) {
// .search-list {
// .search-item {
// width: 100%;
// }
// }
// }
// @media screen and (min-width: 1720px) {
// .search-list {
// .search-item {
// width: 100%;
// }
// }
// }
.search-list {
.search-item {
width: 100%;
}
}
.search-list {
flex: 1;
display: flex;
flex-wrap: wrap;
.search-item {
// flex: 1;
// padding-right: 12px;
margin-bottom: 20px;
min-width: 276px;
display: flex;
align-items: center;
box-sizing: border-box;
.name {
width: 112px;
text-align: right;
font-size: 14px;
font-weight: 400;
color: #666;
}
.input {
flex: 1;
// width:100%;
}
.el-input {
width: 100%;
}
.el-select {
width: 100%;
}
.el-date-editor {
width: 100%;
}
}
}
.gl-operate {
display: flex;
align-items: flex-end;
.operate {
text-align: left;
width: 190px;
margin-bottom: 20px;
.expand {
font-size: 14px;
}
.el-button + .el-button {
margin-left: 8px;
}
}
}
}
</style>
import GLSearchItem from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GLSearchItem.install = function(Vue) {
Vue.component(GLSearchItem.name, GLSearchItem)
}
// 默认导出组件
export default GLSearchItem
\ No newline at end of file \ No newline at end of file
<template>
<div :style="{ 'padding-right': spacer + 'px' }" class="search-item">
<div class="name">
<!-- {{ label }} -->
<!-- name 插槽 -->
<slot name="name"></slot>
</div>
<div class="input">
<!-- 默认插槽 -->
<slot></slot>
<!-- <el-input
size="small"
v-model="input"
placeholder="请输入内容"
></el-input> -->
</div>
</div>
</template>
<script>
export default {
name: 'GLSearchItem',
props: {
// 每个项间隙
spacer: {
type: Number,
default: 12
}
},
data () {
return {}
},
created () {},
mounted () {},
computed: {},
methods: {},
components: {},
watch: {}
}
</script>
<template> <template>
<div class="basic-panel"> <div class="basic-panel">
<el-tooltip class="item" effect="dark" :content="content" placement="top" v-show="tooltipStatus"> <el-popover placement="top" popper-class="base-popper" trigger="hover" :content="content" v-if="tooltipStatus">
<div class="basic-title-s">{{ content }}</div> <div class="basic-title" slot="reference">{{ content | ellipsis(this) }}</div>
</el-tooltip> </el-popover>
<div class="basic-title" v-show="!tooltipStatus">{{ content }}</div> <div class="basic-title" v-else>{{ content | ellipsis(this) }}</div>
</div> </div>
</template> </template>
<script> <script>
...@@ -14,9 +14,9 @@ export default { ...@@ -14,9 +14,9 @@ export default {
type: String, type: String,
default: '' default: ''
}, },
titleWid: { textLength: {
type: Number, type: Number,
default: 100 default: 8
} }
}, },
data() { data() {
...@@ -24,28 +24,26 @@ export default { ...@@ -24,28 +24,26 @@ export default {
tooltipStatus: false tooltipStatus: false
} }
}, },
watch: { filters: {
content: { ellipsis(value,that) {
handler(value) { console.log(value,that)
const title = document.querySelector('.basic-title') if (value.length > that.textLength) {
console.log(title, value) that.tooltipStatus = true
if (title.innerText == value) { return value.slice(0, that.textLength) + '...'
this.tooltipStatus = false }
} else { return value
this.tooltipStatus = true
}
},
deep: true
} }
}, },
mounted() { mounted() {
const title = document.querySelector('.basic-title-s') // this.$nextTick(() => {
console.log(title.innerText, this.content) // const title = document.querySelector('.basic-title-s')
if (title.innerText == this.content) { // console.log(title.innerText, this.content)
this.tooltipStatus = false // if (title.innerText == this.content) {
} else { // this.tooltipStatus = false
this.tooltipStatus = true // } else {
} // this.tooltipStatus = true
// }
// })
} }
} }
</script> </script>
...@@ -54,11 +52,4 @@ export default { ...@@ -54,11 +52,4 @@ export default {
.basic-panel { .basic-panel {
display: inline-block; display: inline-block;
} }
.basic-title,.basic-title-s {
width: 100%;
display: inline-block;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
</style> </style>
.vdr {
touch-action: none;
position: absolute;
box-sizing: border-box;
border: 1px dashed black;
}
.handle {
box-sizing: border-box;
position: absolute;
width: 10px;
height: 10px;
background: #EEE;
border: 1px solid #333;
}
.handle-tl {
top: -10px;
left: -10px;
cursor: nw-resize;
}
.handle-tm {
top: -10px;
left: 50%;
margin-left: -5px;
cursor: n-resize;
}
.handle-tr {
top: -10px;
right: -10px;
cursor: ne-resize;
}
.handle-ml {
top: 50%;
margin-top: -5px;
left: -10px;
cursor: w-resize;
}
.handle-mr {
top: 50%;
margin-top: -5px;
right: -10px;
cursor: e-resize;
}
.handle-bl {
bottom: -10px;
left: -10px;
cursor: sw-resize;
}
.handle-bm {
bottom: -10px;
left: 50%;
margin-left: -5px;
cursor: s-resize;
}
.handle-br {
bottom: -10px;
right: -10px;
cursor: se-resize;
}
@media only screen and (max-width: 768px) {
[class*="handle-"]:before {
content: '';
left: -10px;
right: -10px;
bottom: -10px;
top: -10px;
position: absolute;
}
}
<template>
<div
:style="style"
:class="[{
[classNameActive]: enabled,
[classNameDragging]: dragging,
[classNameResizing]: resizing,
[classNameDraggable]: draggable,
[classNameResizable]: resizable
}, className]"
@mousedown="elementMouseDown"
@touchstart="elementTouchDown"
>
<div
v-for="handle in actualHandles"
:key="handle"
:class="[classNameHandle, classNameHandle + '-' + handle]"
:style="{display: enabled ? 'block' : 'none'}"
@mousedown.stop.prevent="handleDown(handle, $event)"
@touchstart.stop.prevent="handleTouchDown(handle, $event)"
>
<slot :name="handle"></slot>
</div>
<slot></slot>
</div>
</template>
<script>
import { matchesSelectorToParentElements, getComputedSize, addEvent, removeEvent } from '../../utils/dom'
import { computeWidth, computeHeight, restrictToBounds, snapToGrid } from '../../utils/fns'
const events = {
mouse: {
start: 'mousedown',
move: 'mousemove',
stop: 'mouseup'
},
touch: {
start: 'touchstart',
move: 'touchmove',
stop: 'touchend'
}
}
const userSelectNone = {
userSelect: 'none',
MozUserSelect: 'none',
WebkitUserSelect: 'none',
MsUserSelect: 'none'
}
const userSelectAuto = {
userSelect: 'auto',
MozUserSelect: 'auto',
WebkitUserSelect: 'auto',
MsUserSelect: 'auto'
}
let eventsFor = events.mouse
export default {
replace: true,
name: 'vue-draggable-resizable',
props: {
className: {
type: String,
default: 'vdr'
},
classNameDraggable: {
type: String,
default: 'draggable'
},
classNameResizable: {
type: String,
default: 'resizable'
},
classNameDragging: {
type: String,
default: 'dragging'
},
classNameResizing: {
type: String,
default: 'resizing'
},
classNameActive: {
type: String,
default: 'active'
},
classNameHandle: {
type: String,
default: 'handle'
},
disableUserSelect: {
type: Boolean,
default: true
},
enableNativeDrag: {
type: Boolean,
default: false
},
preventDeactivation: {
type: Boolean,
default: false
},
active: {
type: Boolean,
default: false
},
draggable: {
type: Boolean,
default: true
},
resizable: {
type: Boolean,
default: true
},
lockAspectRatio: {
type: Boolean,
default: false
},
w: {
type: [Number, String],
default: 200,
validator: (val) => {
if (typeof val === 'number') {
return val > 0
}
return val === 'auto'
}
},
h: {
type: [Number, String],
default: 200,
validator: (val) => {
if (typeof val === 'number') {
return val > 0
}
return val === 'auto'
}
},
minWidth: {
type: Number,
default: 0,
validator: (val) => val >= 0
},
minHeight: {
type: Number,
default: 0,
validator: (val) => val >= 0
},
maxWidth: {
type: Number,
default: null,
validator: (val) => val >= 0
},
maxHeight: {
type: Number,
default: null,
validator: (val) => val >= 0
},
x: {
type: Number,
default: 0
},
y: {
type: Number,
default: 0
},
z: {
type: [String, Number],
default: 'auto',
validator: (val) => (typeof val === 'string' ? val === 'auto' : val >= 0)
},
handles: {
type: Array,
default: () => ['tl', 'tm', 'tr', 'mr', 'br', 'bm', 'bl', 'ml'],
validator: (val) => {
const s = new Set(['tl', 'tm', 'tr', 'mr', 'br', 'bm', 'bl', 'ml'])
return new Set(val.filter(h => s.has(h))).size === val.length
}
},
dragHandle: {
type: String,
default: null
},
dragCancel: {
type: String,
default: null
},
axis: {
type: String,
default: 'both',
validator: (val) => ['x', 'y', 'both'].includes(val)
},
grid: {
type: Array,
default: () => [1, 1]
},
customId: {
type: [String,Number],
default: ''
},
parent: {
type: Boolean,
default: false
},
scale: {
type: [Number, Array],
default: 1,
validator: (val) => {
if (typeof val === 'number') {
return val > 0
}
return val.length === 2 && val[0] > 0 && val[1] > 0
}
},
onDragStart: {
type: Function,
default: () => true
},
onDrag: {
type: Function,
default: () => true
},
onResizeStart: {
type: Function,
default: () => true
},
onResize: {
type: Function,
default: () => true
}
},
data: function () {
return {
left: this.x,
top: this.y,
right: null,
bottom: null,
width: null,
height: null,
widthTouched: false,
heightTouched: false,
aspectFactor: null,
parentWidth: null,
parentHeight: null,
minW: this.minWidth,
minH: this.minHeight,
maxW: this.maxWidth,
maxH: this.maxHeight,
handle: null,
enabled: this.active,
resizing: false,
dragging: false,
dragEnable: false,
resizeEnable: false,
zIndex: this.z
}
},
created: function () {
// eslint-disable-next-line
if (this.maxWidth && this.minWidth > this.maxWidth) console.warn('[Vdr warn]: Invalid prop: minWidth cannot be greater than maxWidth')
// eslint-disable-next-line
if (this.maxWidth && this.minHeight > this.maxHeight) console.warn('[Vdr warn]: Invalid prop: minHeight cannot be greater than maxHeight')
this.resetBoundsAndMouseState()
},
mounted: function () {
if (!this.enableNativeDrag) {
this.$el.ondragstart = () => false
}
const [parentWidth, parentHeight] = this.getParentSize()
this.parentWidth = parentWidth
this.parentHeight = parentHeight
const [width, height] = getComputedSize(this.$el)
this.aspectFactor = (this.w !== 'auto' ? this.w : width) / (this.h !== 'auto' ? this.h : height)
this.width = this.w !== 'auto' ? this.w : width
this.height = this.h !== 'auto' ? this.h : height
this.right = this.parentWidth - this.width - this.left
this.bottom = this.parentHeight - this.height - this.top
if (this.active) {
this.$emit('activated')
}
addEvent(document.documentElement, 'mousedown', this.deselect)
addEvent(document.documentElement, 'touchend touchcancel', this.deselect)
addEvent(window, 'resize', this.checkParentSize)
},
beforeDestroy: function () {
removeEvent(document.documentElement, 'mousedown', this.deselect)
removeEvent(document.documentElement, 'touchstart', this.handleUp)
removeEvent(document.documentElement, 'mousemove', this.move)
removeEvent(document.documentElement, 'touchmove', this.move)
removeEvent(document.documentElement, 'mouseup', this.handleUp)
removeEvent(document.documentElement, 'touchend touchcancel', this.deselect)
removeEvent(window, 'resize', this.checkParentSize)
},
methods: {
resetBoundsAndMouseState () {
this.mouseClickPosition = { mouseX: 0, mouseY: 0, x: 0, y: 0, w: 0, h: 0 }
this.bounds = {
minLeft: null,
maxLeft: null,
minRight: null,
maxRight: null,
minTop: null,
maxTop: null,
minBottom: null,
maxBottom: null
}
},
checkParentSize () {
if (this.parent) {
const [newParentWidth, newParentHeight] = this.getParentSize()
this.parentWidth = newParentWidth
this.parentHeight = newParentHeight
this.right = this.parentWidth - this.width - this.left
this.bottom = this.parentHeight - this.height - this.top
}
},
getParentSize () {
if (this.parent) {
const style = window.getComputedStyle(this.$el.parentNode, null)
return [
parseInt(style.getPropertyValue('width'), 10),
parseInt(style.getPropertyValue('height'), 10)
]
}
return [null, null]
},
elementTouchDown (e) {
eventsFor = events.touch
this.elementDown(e)
},
elementMouseDown (e) {
eventsFor = events.mouse
this.elementDown(e)
},
elementDown (e) {
if (e instanceof MouseEvent && e.which !== 1) {
return
}
const target = e.target || e.srcElement
if (this.$el.contains(target)) {
if (this.onDragStart(e) === false) {
return
}
if (
(this.dragHandle && !matchesSelectorToParentElements(target, this.dragHandle, this.$el)) ||
(this.dragCancel && matchesSelectorToParentElements(target, this.dragCancel, this.$el))
) {
this.dragging = false
return
}
if (!this.enabled) {
this.enabled = true
this.$emit('activated',this.customId)
this.$emit('update:active', true)
}
if (this.draggable) {
this.dragEnable = true
}
this.mouseClickPosition.mouseX = e.touches ? e.touches[0].pageX : e.pageX
this.mouseClickPosition.mouseY = e.touches ? e.touches[0].pageY : e.pageY
this.mouseClickPosition.left = this.left
this.mouseClickPosition.right = this.right
this.mouseClickPosition.top = this.top
this.mouseClickPosition.bottom = this.bottom
if (this.parent) {
this.bounds = this.calcDragLimits()
}
addEvent(document.documentElement, eventsFor.move, this.move)
addEvent(document.documentElement, eventsFor.stop, this.handleUp)
}
},
calcDragLimits () {
return {
minLeft: this.left % this.grid[0],
maxLeft: Math.floor((this.parentWidth - this.width - this.left) / this.grid[0]) * this.grid[0] + this.left,
minRight: this.right % this.grid[0],
maxRight: Math.floor((this.parentWidth - this.width - this.right) / this.grid[0]) * this.grid[0] + this.right,
minTop: this.top % this.grid[1],
maxTop: Math.floor((this.parentHeight - this.height - this.top) / this.grid[1]) * this.grid[1] + this.top,
minBottom: this.bottom % this.grid[1],
maxBottom: Math.floor((this.parentHeight - this.height - this.bottom) / this.grid[1]) * this.grid[1] + this.bottom
}
},
deselect (e) {
const target = e.target || e.srcElement
const regex = new RegExp(this.className + '-([trmbl]{2})', '')
if (!this.$el.contains(target) && !regex.test(target.className)) {
if (this.enabled && !this.preventDeactivation) {
this.enabled = false
this.$emit('deactivated')
this.$emit('update:active', false)
}
removeEvent(document.documentElement, eventsFor.move, this.handleResize)
}
this.resetBoundsAndMouseState()
},
handleTouchDown (handle, e) {
eventsFor = events.touch
this.handleDown(handle, e)
},
handleDown (handle, e) {
if (e instanceof MouseEvent && e.which !== 1) {
return
}
if (this.onResizeStart(handle, e) === false) {
return
}
if (e.stopPropagation) e.stopPropagation()
// Here we avoid a dangerous recursion by faking
// corner handles as middle handles
if (this.lockAspectRatio && !handle.includes('m')) {
this.handle = 'm' + handle.substring(1)
} else {
this.handle = handle
}
this.resizeEnable = true
this.mouseClickPosition.mouseX = e.touches ? e.touches[0].pageX : e.pageX
this.mouseClickPosition.mouseY = e.touches ? e.touches[0].pageY : e.pageY
this.mouseClickPosition.left = this.left
this.mouseClickPosition.right = this.right
this.mouseClickPosition.top = this.top
this.mouseClickPosition.bottom = this.bottom
this.bounds = this.calcResizeLimits()
addEvent(document.documentElement, eventsFor.move, this.handleResize)
addEvent(document.documentElement, eventsFor.stop, this.handleUp)
},
calcResizeLimits () {
let minW = this.minW
let minH = this.minH
let maxW = this.maxW
let maxH = this.maxH
const aspectFactor = this.aspectFactor
const [gridX, gridY] = this.grid
const width = this.width
const height = this.height
const left = this.left
const top = this.top
const right = this.right
const bottom = this.bottom
if (this.lockAspectRatio) {
if (minW / minH > aspectFactor) {
minH = minW / aspectFactor
} else {
minW = aspectFactor * minH
}
if (maxW && maxH) {
maxW = Math.min(maxW, aspectFactor * maxH)
maxH = Math.min(maxH, maxW / aspectFactor)
} else if (maxW) {
maxH = maxW / aspectFactor
} else if (maxH) {
maxW = aspectFactor * maxH
}
}
maxW = maxW - (maxW % gridX)
maxH = maxH - (maxH % gridY)
const limits = {
minLeft: null,
maxLeft: null,
minTop: null,
maxTop: null,
minRight: null,
maxRight: null,
minBottom: null,
maxBottom: null
}
if (this.parent) {
limits.minLeft = left % gridX
limits.maxLeft = left + Math.floor((width - minW) / gridX) * gridX
limits.minTop = top % gridY
limits.maxTop = top + Math.floor((height - minH) / gridY) * gridY
limits.minRight = right % gridX
limits.maxRight = right + Math.floor((width - minW) / gridX) * gridX
limits.minBottom = bottom % gridY
limits.maxBottom = bottom + Math.floor((height - minH) / gridY) * gridY
if (maxW) {
limits.minLeft = Math.max(limits.minLeft, this.parentWidth - right - maxW)
limits.minRight = Math.max(limits.minRight, this.parentWidth - left - maxW)
}
if (maxH) {
limits.minTop = Math.max(limits.minTop, this.parentHeight - bottom - maxH)
limits.minBottom = Math.max(limits.minBottom, this.parentHeight - top - maxH)
}
if (this.lockAspectRatio) {
limits.minLeft = Math.max(limits.minLeft, left - top * aspectFactor)
limits.minTop = Math.max(limits.minTop, top - left / aspectFactor)
limits.minRight = Math.max(limits.minRight, right - bottom * aspectFactor)
limits.minBottom = Math.max(limits.minBottom, bottom - right / aspectFactor)
}
} else {
limits.minLeft = null
limits.maxLeft = left + Math.floor((width - minW) / gridX) * gridX
limits.minTop = null
limits.maxTop = top + Math.floor((height - minH) / gridY) * gridY
limits.minRight = null
limits.maxRight = right + Math.floor((width - minW) / gridX) * gridX
limits.minBottom = null
limits.maxBottom = bottom + Math.floor((height - minH) / gridY) * gridY
if (maxW) {
limits.minLeft = -(right + maxW)
limits.minRight = -(left + maxW)
}
if (maxH) {
limits.minTop = -(bottom + maxH)
limits.minBottom = -(top + maxH)
}
if (this.lockAspectRatio && (maxW && maxH)) {
limits.minLeft = Math.min(limits.minLeft, -(right + maxW))
limits.minTop = Math.min(limits.minTop, -(maxH + bottom))
limits.minRight = Math.min(limits.minRight, -left - maxW)
limits.minBottom = Math.min(limits.minBottom, -top - maxH)
}
}
return limits
},
move (e) {
if (this.resizing) {
this.handleResize(e)
} else if (this.dragEnable) {
this.handleDrag(e)
}
},
handleDrag (e) {
const axis = this.axis
const grid = this.grid
const bounds = this.bounds
const mouseClickPosition = this.mouseClickPosition
const tmpDeltaX = axis && axis !== 'y' ? mouseClickPosition.mouseX - (e.touches ? e.touches[0].pageX : e.pageX) : 0
const tmpDeltaY = axis && axis !== 'x' ? mouseClickPosition.mouseY - (e.touches ? e.touches[0].pageY : e.pageY) : 0
const [deltaX, deltaY] = snapToGrid(grid, tmpDeltaX, tmpDeltaY, this.scale)
const left = restrictToBounds(mouseClickPosition.left - deltaX, bounds.minLeft, bounds.maxLeft)
const top = restrictToBounds(mouseClickPosition.top - deltaY, bounds.minTop, bounds.maxTop)
if (this.onDrag(left, top) === false) {
return
}
const right = restrictToBounds(mouseClickPosition.right + deltaX, bounds.minRight, bounds.maxRight)
const bottom = restrictToBounds(mouseClickPosition.bottom + deltaY, bounds.minBottom, bounds.maxBottom)
this.left = left
this.top = top
this.right = right
this.bottom = bottom
this.$emit('dragging', this.left, this.top)
this.dragging = true
},
moveHorizontally (val) {
// should calculate with scale 1.
const [deltaX, _] = snapToGrid(this.grid, val, this.top, 1)
const left = restrictToBounds(deltaX, this.bounds.minLeft, this.bounds.maxLeft)
this.left = left
this.right = this.parentWidth - this.width - left
},
moveVertically (val) {
// should calculate with scale 1.
const [_, deltaY] = snapToGrid(this.grid, this.left, val, 1)
const top = restrictToBounds(deltaY, this.bounds.minTop, this.bounds.maxTop)
this.top = top
this.bottom = this.parentHeight - this.height - top
},
handleResize (e) {
let left = this.left
let top = this.top
let right = this.right
let bottom = this.bottom
const mouseClickPosition = this.mouseClickPosition
const lockAspectRatio = this.lockAspectRatio
const aspectFactor = this.aspectFactor
const tmpDeltaX = mouseClickPosition.mouseX - (e.touches ? e.touches[0].pageX : e.pageX)
const tmpDeltaY = mouseClickPosition.mouseY - (e.touches ? e.touches[0].pageY : e.pageY)
if (!this.widthTouched && tmpDeltaX) {
this.widthTouched = true
}
if (!this.heightTouched && tmpDeltaY) {
this.heightTouched = true
}
const [deltaX, deltaY] = snapToGrid(this.grid, tmpDeltaX, tmpDeltaY, this.scale)
if (this.handle.includes('b')) {
bottom = restrictToBounds(
mouseClickPosition.bottom + deltaY,
this.bounds.minBottom,
this.bounds.maxBottom
)
if (this.lockAspectRatio && this.resizingOnY) {
right = this.right - (this.bottom - bottom) * aspectFactor
}
} else if (this.handle.includes('t')) {
top = restrictToBounds(
mouseClickPosition.top - deltaY,
this.bounds.minTop,
this.bounds.maxTop
)
if (this.lockAspectRatio && this.resizingOnY) {
left = this.left - (this.top - top) * aspectFactor
}
}
if (this.handle.includes('r')) {
right = restrictToBounds(
mouseClickPosition.right + deltaX,
this.bounds.minRight,
this.bounds.maxRight
)
if (this.lockAspectRatio && this.resizingOnX) {
bottom = this.bottom - (this.right - right) / aspectFactor
}
} else if (this.handle.includes('l')) {
left = restrictToBounds(
mouseClickPosition.left - deltaX,
this.bounds.minLeft,
this.bounds.maxLeft
)
if (this.lockAspectRatio && this.resizingOnX) {
top = this.top - (this.left - left) / aspectFactor
}
}
const width = computeWidth(this.parentWidth, left, right)
const height = computeHeight(this.parentHeight, top, bottom)
if (this.onResize(this.handle, left, top, width, height) === false) {
return
}
this.left = left
this.top = top
this.right = right
this.bottom = bottom
this.width = width
this.height = height
this.$emit('resizing', this.left, this.top, this.width, this.height)
this.resizing = true
},
changeWidth (val) {
// should calculate with scale 1.
const [newWidth, _] = snapToGrid(this.grid, val, 0, 1)
let right = restrictToBounds(
(this.parentWidth - newWidth - this.left),
this.bounds.minRight,
this.bounds.maxRight
)
let bottom = this.bottom
if (this.lockAspectRatio) {
bottom = this.bottom - (this.right - right) / this.aspectFactor
}
const width = computeWidth(this.parentWidth, this.left, right)
const height = computeHeight(this.parentHeight, this.top, bottom)
this.right = right
this.bottom = bottom
this.width = width
this.height = height
},
changeHeight (val) {
// should calculate with scale 1.
const [_, newHeight] = snapToGrid(this.grid, 0, val, 1)
let bottom = restrictToBounds(
(this.parentHeight - newHeight - this.top),
this.bounds.minBottom,
this.bounds.maxBottom
)
let right = this.right
if (this.lockAspectRatio) {
right = this.right - (this.bottom - bottom) * this.aspectFactor
}
const width = computeWidth(this.parentWidth, this.left, right)
const height = computeHeight(this.parentHeight, this.top, bottom)
this.right = right
this.bottom = bottom
this.width = width
this.height = height
},
handleUp (e) {
this.handle = null
this.resetBoundsAndMouseState()
this.dragEnable = false
this.resizeEnable = false
if (this.resizing) {
this.resizing = false
this.$emit('resizestop', this.left, this.top, this.width, this.height)
}
if (this.dragging) {
this.dragging = false
this.$emit('dragstop', this.left, this.top)
}
removeEvent(document.documentElement, eventsFor.move, this.handleResize)
}
},
computed: {
style () {
return {
transform: `translate(${this.left}px, ${this.top}px)`,
width: this.computedWidth,
height: this.computedHeight,
zIndex: this.zIndex,
...(this.dragging && this.disableUserSelect ? userSelectNone : userSelectAuto)
}
},
actualHandles () {
if (!this.resizable) return []
return this.handles
},
computedWidth () {
if (this.w === 'auto') {
if (!this.widthTouched) {
return 'auto'
}
}
return this.width + 'px'
},
computedHeight () {
if (this.h === 'auto') {
if (!this.heightTouched) {
return 'auto'
}
}
return this.height + 'px'
},
resizingOnX () {
return (Boolean(this.handle) && (this.handle.includes('l') || this.handle.includes('r')))
},
resizingOnY () {
return (Boolean(this.handle) && (this.handle.includes('t') || this.handle.includes('b')))
},
isCornerHandle () {
return (Boolean(this.handle) && ['tl', 'tr', 'br', 'bl'].includes(this.handle))
}
},
watch: {
active (val) {
this.enabled = val
if (val) {
this.$emit('activated')
} else {
this.$emit('deactivated')
}
},
z (val) {
if (val >= 0 || val === 'auto') {
this.zIndex = val
}
},
x (val) {
if (this.resizing || this.dragging) {
return
}
if (this.parent) {
this.bounds = this.calcDragLimits()
}
this.moveHorizontally(val)
},
y (val) {
if (this.resizing || this.dragging) {
return
}
if (this.parent) {
this.bounds = this.calcDragLimits()
}
this.moveVertically(val)
},
lockAspectRatio (val) {
if (val) {
this.aspectFactor = this.width / this.height
} else {
this.aspectFactor = undefined
}
},
minWidth (val) {
if (val > 0 && val <= this.width) {
this.minW = val
}
},
minHeight (val) {
if (val > 0 && val <= this.height) {
this.minH = val
}
},
maxWidth (val) {
this.maxW = val
},
maxHeight (val) {
this.maxH = val
},
w (val) {
if (this.resizing || this.dragging) {
return
}
if (this.parent) {
this.bounds = this.calcResizeLimits()
}
this.changeWidth(val)
},
h (val) {
if (this.resizing || this.dragging) {
return
}
if (this.parent) {
this.bounds = this.calcResizeLimits()
}
this.changeHeight(val)
}
}
}
</script>
<template>
<div
class="scrm-footer-panel"
:style="{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<slot></slot>
</div>
</template>
<script>
export default {
name: 'glsx-footer',
props: {
className: {
type: String,
default: '.base-container-right'
}
},
data() {
return {
footerLeft: 0,
footerWidth: 0
}
},
methods: {
resize() {
this.footerLeft = document.querySelector(this.className).offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
}
},
destroyed() {
window.removeEventListener('resize', this.resize)
},
mounted() {
this.resize()
window.addEventListener('resize', this.resize)
}
}
</script>
<style lang="scss">
.scrm-footer-panel {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 0px;
height: 64px;
background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
</style>
...@@ -11,8 +11,10 @@ import Vue from 'vue' ...@@ -11,8 +11,10 @@ import Vue from 'vue'
// 导入权限按钮 // 导入权限按钮
import _button from '@/components/glsx-button/index' import _button from '@/components/glsx-button/index'
import _title from '@/components/basic-title/index' import _title from '@/components/basic-title/index'
// import _footer from '@/components/glsx-footer/index'
Vue.component('basic-dialog', () => Vue.component('basic-dialog', () =>
import('./basic-dialog/index.vue')) import('./basic-dialog/index.vue'))
Vue.component('GLButton', _button) Vue.component('GLButton', _button)
Vue.component('GLTitle', _title) Vue.component('GLTitle', _title)
// Vue.component('GLFooter', _footer)
// Vue.component('glsx-table', glsxTable) // Vue.component('glsx-table', glsxTable)
\ No newline at end of file \ No newline at end of file
<template>
<div class="tag-main">
<el-dialog bigTitle="选择标签" :visible.sync="dialogVisible" width="50%" :before-close="handleClose">
<div class="tag-panel">
<div class="tag-panel-select">
<div class="tag-title">预选标签</div>
<div class="tag-select-box">
<div class="tag-box-header">
<el-input size="small" v-model="labelGroupName" placeholder="请输入搜索内容" clearable @keydown.enter.native="handleSearch"></el-input>
<el-button size="small" type="primary" @click="handleSearch">查询</el-button>
<el-button size="small" @click="handleReset">重置</el-button>
</div>
<div class="checkbox-group-box" v-loading="loading" :style="{ height: heightBox + 'px' }">
<div style="margin-bottom: 8px" class="checkbox-box" v-for="(item, index) in labelTreeRets" :key="index" @click.self="item.checked = !item.checked">
<span class="el-tree-node__expand-icon el-icon-caret-right" :class="{ expanded: item.checked }" @click.self="item.checked = !item.checked"></span>
{{ item.labelGroup.name }}
<el-tag :size="size">{{ item.labelType }}</el-tag>
<el-radio-group class="tag-group" v-model="item.tagChecked" v-if="item.checked" @change="handleCheckedTag">
<div v-for="(itm, idx) in item.labelList" :key="idx" class="radio-tag">
<el-tooltip effect="dark" placement="top" :disabled="itm.name.length < 8">
<el-radio :disabled="isLabelType(item.labelType)" class="radio-text" :label="itm">{{ itm.name }}</el-radio>
<!-- <el-radio :label="itm">{{ itm.name.length > 4 ? itm.name.slice(0, 3) + '...' : itm.name }}</el-radio> -->
<div slot="content">{{ itm.name }}</div>
</el-tooltip>
</div>
</el-radio-group>
</div>
</div>
</div>
</div>
<div class="tag-panel-selected">
<div class="tag-title">已选标签</div>
<div class="tag-select-box">
<div class="tag-box-header">标签名称({{ selectNum }}项)</div>
<div class="tag-selected-box" :style="{ height: heightBox + 'px' }">
<template v-for="item in labelTreeRetSelect">
<el-tag :title="item.tagChecked.name" v-if="item.tagChecked" type="info" class="tag-selected-item" :key="item.tagChecked" closable :disable-transitions="false" @close="remove(item, idx)">
{{ item.tagChecked.name }}
</el-tag>
</template>
</div>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<!-- <a class="dialog-jump" @click="jumpUrl" v-if="this.$globalState.session.accountLevel == 4 && this.$globalState.session.merchantModel == 2">没有意向标签?点我创建</a> -->
<el-button size="small" @click="dialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelect">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { utils } from 'glsx-common'
import util from '@/utils/util'
export default {
name: 'activityModel',
data() {
return {
loading: false,
heightBox: 200,
dialogVisible: false,
labelGroupName: '',
selectNum: 0,
searchStatus: false,
labelTreeRetSelect: [],
labelTreeRets: [
// {
// labelGroup: { id: '109', name: '湖口123' },
// labelList: [
// { id: '372', name: '12345678' },
// { id: '371', name: '7654321' },
// { id: '370', name: '1234567' }
// ],
// checked: false,
// tagChecked: [],
// isIndeterminate: false,
// checkAll: false
// },
// {
// labelGroup: { id: '65', name: '自店标签111' },
// labelList: [
// { id: '179', name: '标签44' },
// { id: '178', name: '标签33' },
// { id: '176', name: '标签1112' }
// ],
// checked: false,
// tagChecked: [],
// isIndeterminate: false,
// checkAll: false
// }
]
}
},
watch: {
labelTreeRetSelect: {
handler() {
this.selectNum = 0
this.labelType = []
console.log(new Date())
this.labelTreeRetSelect.forEach(item => {
if (item.tagChecked) {
this.selectNum++
if (!this.labelType.includes(item.labelType)) {
this.labelType.push(item.labelType)
}
}
})
this.$nextTick(() => {
console.log(new Date())
})
},
deep: true
}
},
methods: {
// 选择标签
handleCheckedTag() {
this.labelTreeRets.forEach(item => {
this.labelTreeRetSelect.forEach(tag => {
if (tag.labelGroup.id == item.labelGroup.id && item.tagChecked) {
let labelId = item.tagChecked ? item.tagChecked.id : ''
let index = tag.labelList.findIndex(iem => iem.id == labelId)
tag.tagChecked = tag.labelList[index]
}
})
})
},
isLabelType(label) {
return this.labelType.length > 0 && !this.labelType.includes(label)
},
jumpUrl() {
util.openUrl(location.origin + '/custom/tagsManage/index')
this.dialogVisible = false
},
init(item) {
this.labelGroupName = ''
this.dialogVisible = true
this.querylabeltree(item)
},
handleSearch() {
this.searchStatus = true
this.querylabeltree()
},
querylabeltree(selectItem) {
this.loading = true
this.$apis.channel
.querylabeltree({
labelTreeReq: {
pageNum: 1,
pageSize: 1000,
shopId: this.$globalState.session.merchantId,
labelGroupName: this.labelGroupName,
edition: this.$globalState.session.merchantModel
}
})
.then(res => {
if (selectItem) {
console.log(res.labelTreeRets)
this.labelTreeRets = res.labelTreeRets.map(item => {
return {
labelType: item.labelType == '企业标签' ? (this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签') : item.labelType,
labelGroup: item.labelGroup,
labelList: item.labelList,
checked: false,
tagChecked: null,
isIndeterminate: false,
checkAll: false
}
})
//回显
selectItem.forEach(item => {
this.labelTreeRets.forEach(tag => {
if (item.labelGroup.id == tag.labelGroup.id) {
let labelId = item.labelList[0].id
let index = tag.labelList.findIndex(iem => iem.id == labelId)
console.log(index)
// tag.tagChecked = item.tagChecked
tag.tagChecked = tag.labelList[index]
}
})
})
this.labelTreeRetSelect = utils.deepClone(this.labelTreeRets)
} else {
this.labelTreeRets = res.labelTreeRets.map(item => {
return {
labelType: item.labelType == '企业标签' ? (this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签') : item.labelType,
labelGroup: item.labelGroup,
labelList: item.labelList,
checked: false,
tagChecked: null,
isIndeterminate: false,
checkAll: false
}
})
this.labelTreeRetSelect.forEach(item => {
this.labelTreeRets.forEach(tag => {
if (tag.labelGroup.id == item.labelGroup.id && item.tagChecked) {
let labelId = item.tagChecked ? item.tagChecked.id : ''
let index = tag.labelList.findIndex(iem => iem.id == labelId)
tag.tagChecked = tag.labelList[index]
// }
}
})
})
// labelTreeRets.forEach(item => {
// this.labelTreeRets.forEach(tag => {
// if (item.labelGroup.id == tag.labelGroup.id) {
// let labelId = item.tagChecked ? item.tagChecked.id : ''
// let index = tag.labelList.findIndex(iem => iem.id == labelId)
// tag.tagChecked = tag.labelList[index]
// }
// })
// })
if (this.labelTreeRetSelect.length == 0) {
this.labelTreeRetSelect = utils.deepClone(this.labelTreeRets)
}
}
this.$nextTick(() => {
this.loading = false
})
})
},
remove(item, idx) {
item.tagChecked = null
this.labelTreeRetSelect.forEach(item => {
this.labelTreeRets.forEach(tag => {
if (tag.labelGroup.id == item.labelGroup.id) {
if (item.tagChecked) {
let labelId = item.tagChecked ? item.tagChecked.id : ''
let index = tag.labelList.findIndex(iem => iem.id == labelId)
tag.tagChecked = tag.labelList[index]
} else {
tag.tagChecked = null
}
}
})
})
},
//选中
handleSelect() {
this.dialogVisible = false
let labelTreeRets = this.labelTreeRetSelect
.map(item => {
if (item.tagChecked) {
return {
labelGroup: item.labelGroup,
labelType: item.labelType,
labelList: [item.tagChecked]
}
}
})
.filter(item => item)
console.log(labelTreeRets)
this.$emit('tagScreened', labelTreeRets)
},
handleReset() {
this.labelGroupName = ''
this.querylabeltree()
}
},
mounted() {
let clientHeight = document.documentElement.clientHeight
this.heightBox = clientHeight - 0.15 * clientHeight - 350
}
}
</script>
<style lang="scss" scoped>
// ::v-deep .el-tag{
// color: red !important;
// }
.dialog-jump {
color: #5850ff;
float: left;
line-height: 24px;
text-decoration: underline;
cursor: pointer;
}
.tag-panel {
display: flex;
.tag-panel-select {
width: 60%;
/deep/ {
.el-checkbox__label {
width: 100%;
vertical-align: middle;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
word-wrap: break-word;
}
}
}
.tag-panel-selected {
width: 40%;
margin-left: 10px;
.tag-box-header {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
padding-left: 20px !important;
}
}
.tag-title {
font-size: 16px;
font-weight: 400;
color: #333333;
line-height: 22px;
}
.tag-select-box {
margin-top: 10px;
border-radius: 2px;
border: 1px solid #eeeeee;
padding: 6px;
.tag-box-header {
box-sizing: border-box;
display: flex;
height: 56px;
align-items: center;
border-bottom: 1px solid #eeeeee;
margin: -6px;
margin-bottom: 10px;
padding: 0px 6px;
/deep/ {
.el-input {
width: 60%;
margin-right: 10px;
}
}
}
.tag-selected-item {
margin: 0px 6px 6px 0px;
height: 26px;
line-height: 24px;
font-size: 14px;
color: #666;
// text-overflow: ellipsis;
// overflow: hidden;
// white-space: nowrap;
}
.el-tree-node__expand-icon {
color: #5850ff;
font-size: 16px;
}
.tag-group {
margin-left: 26px;
display: flex;
flex-wrap: wrap;
.radio-tag {
display: inline-block;
width: 50%;
.el-radio {
margin: 8px 0;
display: inline-flex;
align-items: center;
/deep/.el-radio__label {
display: inline-block;
max-width: 120px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
word-wrap: break-word;
}
}
}
}
}
}
.checkbox-group-box {
overflow: auto;
.checkbox-box {
cursor: pointer;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
line-height: 20px;
/deep/ {
.el-tag {
color: #aaa5fa !important;
font-size: 12px;
border: none;
background: rgba($color: #5850ff, $alpha: 0.1);
}
}
}
}
.tag-selected-box {
min-height: 200px;
overflow-y: auto;
}
</style>
<!--
* @Description:
* @Author: huyue
* @Date: 2022-05-24 18:18:53
* @LastEditors: huyue
* @LastEditTime: 2022-06-14 18:21:41
-->
<template>
<div>
<GLDialog title="人群筛选" :hasFooter="true" :visible.sync="crowdVisible" mode="big">
<div class="member-wrapper">
<div class="member-left">
<div class="member-title">
人群列表
</div>
<div class="member-content">
<el-form :inline="true" class="member-form" :model="searchForm" @submit.native.prevent>
<el-form-item label="人群名称" style="margin-bottom: 0" size="small">
<el-input :size="size" v-model.trim="searchForm.keyword" @keyup.enter.native="search" clearable placeholder="请输入关键字搜索"></el-input>
</el-form-item>
<el-form-item label style="margin-bottom: 0;margin-left:10px" size="small">
<el-button type="primary" :size="size" @click="search">搜索</el-button>
</el-form-item>
</el-form>
<div class="table-content">
<GLTable v-loading="loading" ref="crowdTable" :tableData="tableData" @refreshTable="getCrowdList" :tableTotal="tableTotal" :layout="layout" :tableParams="crowdTableParams" :hasNum="true" :pageConf="pageConf" :noDataImg="url" @selectionTable="handleSelectionTable" @row-click="rowClick"></GLTable>
</div>
</div>
</div>
<div class="member-right">
<div class="member-title">已选</div>
<div class="member-name">人群({{ innerTags.length }}项)</div>
<div class="input-tag-wrapper">
<div class="tag-box">
<el-tag v-for="(tag, idx) in innerTags" :key="idx" type="info" closable :disable-transitions="false" @close="remove(tag, idx)">
{{ tag.crowdName }}
</el-tag>
</div>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button style="width: 68px;" size="small" @click="crowdVisible = false">取 消</el-button>
<el-button style="width: 68px;" size="small" type="primary" @click.native="handleConfirm">确 定</el-button>
</span>
</GLDialog>
</div>
</template>
<script>
// import url from '@/assets/empty.png'
export default {
name: 'SelectCrowd',
data() {
return {
url: 0,
crowdVisible: false,
searchForm: { keyword: '' },
innerTags: [],
inner: [],
tableCrowdData: [
{
name: 'asda'
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
layout: 'sizes, prev, pager, next, jumper, ->, total',
tableData: [],
tableTotal: 0,
crowdTableParams: {
checkSelectKey: 'id',
checkSelectVal: [],
hasNum: false,
listName: 'crowdUnitList',
// 行数据的key
mutiSelectUniqueKey: 'crowdId',
// 多选ref的名称
mutiSelectName: 'crowdlist',
tableColumns: [
{
label: '人群名称',
prop: 'crowdName'
},
{
label: '人群描述',
prop: 'crowdDesc',
width: '200',
line: 1
},
{
label: '人数',
prop: 'total'
}
]
}
}
},
methods: {
init(val) {
this.inner = this.$common.utils.deepClone(val)
this.innerTags = this.$common.utils.deepClone(val)
this.crowdVisible = true
this.searchForm.keyword = ''
this.$nextTick(() => {
this.$refs.crowdTable.$refs.crowdlistMutiTable.clearSelection()
this.$refs.crowdTable.page.pageNum = 1
this.getCrowdList()
})
},
// this.$refs.crowdTable.tableHeightValues = '250'
getCrowdList(page = { pageNum: 1, pageSize: 10 }) {
this.$refs.crowdTable.page = page
var params = {
req: {
keyword: this.searchForm.keyword,
merchantId: this.$globalState.session.merchantId,
crowdType: 3,
filterType: 2,
pageSize: page.pageSize,
pageNum: page.pageNum
}
}
this.$apis.channel.queryCrowdtree(params).then(res => {
this.tableData = res.crowdUnitList
this.tableTotal = res.total
// console.log(this.inner)
// console.log(this.tableData)
// this.tableData.forEach(item => {
// this.inner.forEach((itm, index) => {
// if (itm.crowdId == item.crowdId) {
// this.rowClick(item)
// }
// })
// })
this.recoverySelected()
})
},
// selectionTable(val) {
// this.innerTags = []
// for (let i = 0; i < val.length; i++) {
// const tagArr = this.innerTags.map(item => item.crowdId + '')
// console.log(tagArr)
// if (!tagArr.includes(val[i].crowdId)) {
// this.innerTags.push(val[i])
// }
// console.log(this.innerTags)
// }
// },
// 选择/取消
handleSelectionTable(val) {
var list = JSON.parse(JSON.stringify(this.innerTags))
this.innerTags = []
val.forEach(item => {
if (this.innerTags.findIndex(k => k.crowdId == item.crowdId) == '-1') {
this.innerTags.push(item)
}
})
list.forEach(item => {
if (this.tableData.findIndex(k => k.crowdId == item.crowdId) == '-1' && this.innerTags.findIndex(k => k.crowdId == item.crowdId) == '-1') {
this.innerTags.push(item)
}
})
},
// 恢复选择
addSelected() {
this.$nextTick(() => {
var list = JSON.parse(JSON.stringify(this.innerTags))
if (list && list.length) {
list.forEach(row => {
var idx = this.tableData.findIndex(k => k.crowdId == row.crowdId)
if (idx != -1) {
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(this.tableData[idx], true)
}
})
}
})
},
recoverySelected() {
// 翻页,去掉已选项
var selectedData = this.$refs.crowdTable.mutiSelectArr.crowdlist
var deleteList = []
this.addSelected()
if (selectedData) {
selectedData.forEach(item => {
if (this.innerTags.findIndex(subItem => subItem.crowdId == item.crowdId) == -1) {
deleteList.push(item)
}
})
this.deleteSelected(deleteList)
}
},
// 删除选中
deleteSelected(deleteList) {
this.$nextTick(() => {
deleteList.forEach(row => {
var idx = this.tableData.findIndex(k => k.crowdId == row.crowdId)
if (idx != -1) {
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(this.tableData[idx], false)
}
})
})
},
remove(item) {
var idx = this.innerTags.findIndex(k => k.crowdId == item.crowdId)
this.innerTags.splice(idx, 1)
if (this.tableData.map(k => k.crowdId).includes(item.crowdId)) {
var i = this.tableData.findIndex(k => k.crowdId == item.crowdId)
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(this.tableData[i])
}
},
rowClick(row) {
this.$refs.crowdTable.$refs.crowdlistMutiTable.toggleRowSelection(row)
},
search() {
this.getCrowdList({ pageNum: 1, pageSize: 10 })
},
handleConfirm() {
// console.log(this.innerTags)
this.$emit('crowdData', this.innerTags)
this.crowdVisible = false
this.searchForm = { keyword: {} }
}
}
}
</script>
<style lang="scss" scoped>
.member-wrapper {
display: flex;
.member-title {
font-size: 16px;
color: #333;
font-weight: 500;
line-height: 22px;
margin-bottom: 6px;
span {
display: inline-block;
padding-left: 5px;
font-size: 12px;
color: #999;
font-weight: 500;
}
}
.member-left {
width: 800px;
.member-content {
border: 1px solid #eee;
padding-bottom: 20px;
/deep/ {
.el-table {
// height: 40vh;
overflow-y: auto;
}
}
.member-form {
padding: 10px 20px;
}
.table-content {
max-height: 500px;
overflow: auto;
border-top: 1px solid #eee;
}
}
.member-checked {
text-align: right;
margin-top: 10px;
}
}
.member-right {
width: 286px;
margin-left: 14px;
.member-name {
font-size: 14px;
color: #333;
line-height: 20px;
padding: 18px;
border: 1px solid #eee;
}
}
}
.tag-box {
height: 100%;
width: 100%;
}
.input-tag-wrapper {
position: relative;
font-size: 14px;
border: 1px solid #eee;
border-top: none;
box-sizing: border-box;
color: #606266;
display: inline-block;
padding: 8px 10px;
line-height: 32px;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 100%;
height: calc(100% - 86px);
display: flex;
align-items: center;
max-height: 500px;
overflow: auto;
// margin-bottom: 10px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
/deep/ input {
/* input { */
/* background-color: red!important; 调试用的样式 */
outline: none !important;
border: none !important;
}
/deep/ .el-input {
min-width: 150px;
width: auto;
flex: 1;
}
}
.el-tag {
margin-right: 10px;
line-height: 22px;
margin-bottom: 5px;
height: 24px;
background: #fafbfe !important;
}
/deep/ {
.el-dialog__title {
font-weight: 600;
}
.el-dialog__header {
padding: 20px;
}
.el-dialog__headerbtn {
height: 30px;
.el-dialog__close {
width: 24px;
height: 24px;
}
}
.el-pagination {
padding-left: 20px;
border-top: 1px solid #e8e8ea;
padding-top: 16px;
}
.el-table:before {
display: none;
}
}
</style>
<template> <template>
<div class="square-main" v-loading="loading"> <div class="square-main" v-loading="loading">
<el-dialog title="选择跟进专员" :visible.sync="dialogVisible" width="50%" :before-close="handleClose"> <GLDialog title="选择跟进专员" :hasFooter="true" :visible.sync="dialogVisible">
<el-form :inline="true" :model="tableSearchForm"> <el-form :inline="true" :model="tableSearchForm">
<el-form-item size="small" label="员工"> <el-form-item size="small" label="员工">
<el-input v-model="tableSearchForm.staffName" placeholder="请输入员工姓名"></el-input> <el-input v-model="tableSearchForm.staffName" placeholder="请输入员工姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item size="small"> <el-form-item size="small" class="emp-form-btn">
<el-button type="primary" @click="handleSearch">查询</el-button> <el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<GLTable ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams" @refreshTable="handleSearch" @selectionTable="selectionTable"></GLTable> <GLTable v-if="dialogVisible" ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams" @refreshTable="handleSearch" @selectionTable="selectionTable"></GLTable>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<a class="dialog-jump" @click="jumpUrl">新增专员</a> <a class="dialog-jump" @click="jumpUrl">新增专员</a>
<el-button size="small" @click="handleCancel">取 消</el-button> <el-button size="small" @click="handleCancel">取 消</el-button>
<el-button size="small" type="primary" @click.native="handleSelect">确 定</el-button> <el-button size="small" type="primary" @click.native="handleSelect">确 定</el-button>
</span> </span>
</el-dialog> </GLDialog>
</div> </div>
</template> </template>
<script> <script>
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
import util from '@/utils/util'
export default { export default {
name: 'selectEmp', name: 'selectEmp',
data() { data() {
...@@ -60,7 +62,7 @@ export default { ...@@ -60,7 +62,7 @@ export default {
}, },
methods: { methods: {
jumpUrl() { jumpUrl() {
this.$history.push('/home/followUp/index') util.openUrl(location.origin + '/settings/followUp/index')
}, },
getFollower() { getFollower() {
var params = { var params = {
...@@ -99,11 +101,11 @@ export default { ...@@ -99,11 +101,11 @@ export default {
handleClose() { handleClose() {
this.handleCancel() this.handleCancel()
}, },
handleCancel: utils.debounce(function () { handleCancel: utils.debounce(function() {
this.dialogVisible = false this.dialogVisible = false
this.$refs.table.$refs.salelistMutiTable.clearSelection() this.$refs.table.$refs.salelistMutiTable.clearSelection()
}, 300), }, 300),
handleSelect: utils.debounce(function () { handleSelect: utils.debounce(function() {
this.loading = true this.loading = true
let selectEmp = this.selectEmp.map(item => { let selectEmp = this.selectEmp.map(item => {
return { return {
...@@ -123,11 +125,14 @@ export default { ...@@ -123,11 +125,14 @@ export default {
}, 300) }, 300)
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.emp-form-btn {
margin-left: 20px;
}
.dialog-jump { .dialog-jump {
color: #5850FF; color: #5850ff;
float: left; float: left;
line-height: 24px; line-height: 24px;
text-decoration: underline; text-decoration: underline;
...@@ -147,4 +152,4 @@ export default { ...@@ -147,4 +152,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template> <template>
<div class="tag-main"> <div class="tag-main">
<el-dialog title="选择标签" :visible.sync="dialogVisible" width="70%" :before-close="handleClose"> <GLDialog bigTitle="选择标签" :hasFooter="true" :visible.sync="dialogVisible" mode="big">
<div class="tag-panel"> <div class="tag-panel">
<div class="tag-panel-select"> <div class="tag-panel-select">
<div class="tag-title">预选标签</div> <div class="tag-title">预选标签</div>
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
<el-input size="small" v-model="labelGroupName" placeholder="请输入搜索内容"></el-input> <el-input size="small" v-model="labelGroupName" placeholder="请输入搜索内容"></el-input>
<el-button size="small" type="primary" @click="handleSearch">查询</el-button> <el-button size="small" type="primary" @click="handleSearch">查询</el-button>
</div> </div>
<div class="checkbox-group-box" :style="{ 'height': heightBox + 'px' }"> <div class="checkbox-group-box" :style="{ height: heightBox + 'px' }" v-loading="loading">
<div style="margin-bottom: 8px" v-for="(item, index) in labelTreeRets" :key="index"> <div style="margin-bottom: 8px" v-for="(item, index) in labelTreeRets" :key="index">
<span class="el-tree-node__expand-icon el-icon-caret-right" :class="{ expanded: item.checked }" @click="item.checked = !item.checked"></span> <span class="el-tree-node__expand-icon el-icon-caret-right" :class="{ expanded: item.checked }" @click.self="item.checked = !item.checked"></span>
<el-checkbox :indeterminate="item.isIndeterminate" v-model="item.checkAll" @change="handleCheckAllChange(item.checkAll, index)">{{ item.labelGroup.name }}({{ item.tagChecked.length }}/{{ item.labelList.length }} 项)</el-checkbox> <el-checkbox :indeterminate="item.isIndeterminate" v-model="item.checkAll" @change="handleCheckAllChange(item.checkAll, index)">{{ item.labelGroup.name }}({{ item.tagChecked.length }}/{{ item.labelList.length }} 项)</el-checkbox>
<div style="margin: 15px 0"></div> <div style="margin: 15px 0"></div>
<el-checkbox-group class="tag-group" v-model="item.tagChecked" @change="handleCheckedChange(item.tagChecked, index)" v-show="item.checked"> <el-checkbox-group class="tag-group" v-model="item.tagChecked" @change="handleCheckedChange(item.tagChecked, index)" v-if="item.checked">
<el-checkbox v-for="(itm, idx) in item.labelList" :label="itm" :key="idx">{{ itm.name }}</el-checkbox> <el-checkbox v-for="(itm, idx) in item.labelList" :label="itm" :key="idx">{{ itm.name }}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
<div class="tag-title">已选标签</div> <div class="tag-title">已选标签</div>
<div class="tag-select-box"> <div class="tag-select-box">
<div class="tag-box-header">标签名称({{ selectNum }}项)</div> <div class="tag-box-header">标签名称({{ selectNum }}项)</div>
<div class="tag-selected-box" :style="{ 'height': heightBox + 'px' }"> <div class="tag-selected-box" :style="{ height: heightBox + 'px' }">
<template v-for="item in labelTreeRetSelect"> <template v-for="item in labelTreeRetSelect">
<template v-for="(tag, idx) in item.tagChecked"> <template v-for="(tag, idx) in item.tagChecked">
<el-tag :title="tag.name" type='info' class="tag-selected-item" :key="idx" v-if="tag" closable :disable-transitions="false" @close="remove(item, idx)"> <el-tag :title="tag.name" type="info" class="tag-selected-item" :key="idx" v-if="tag" closable :disable-transitions="false" @close="remove(item, idx)">
{{ tag.name }} {{ tag.name }}
</el-tag> </el-tag>
</template> </template>
...@@ -38,52 +38,31 @@ ...@@ -38,52 +38,31 @@
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<a class="dialog-jump" @click="jumpUrl">没有意向标签?点我创建</a> <a class="dialog-jump" @click="jumpUrl" v-if="this.$globalState.session.accountLevel == 4 && this.$globalState.session.merchantModel == 2">没有意向标签?点我创建</a>
<el-button size="small" @click="dialogVisible = false">取 消</el-button> <el-button size="small" @click="handleClose">
取 消
</el-button>
<el-button size="small" type="primary" @click="handleSelect">确 定</el-button> <el-button size="small" type="primary" @click="handleSelect">确 定</el-button>
</span> </span>
</el-dialog> </GLDialog>
</div> </div>
</template> </template>
<script> <script>
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
import util from '@/utils/util'
export default { export default {
name: 'activityModel', name: 'activityModel',
data() { data() {
return { return {
loading: false,
heightBox: 200, heightBox: 200,
dialogVisible: false, dialogVisible: false,
labelGroupName: '', labelGroupName: '',
selectNum: 0, selectNum: 0,
searchStatus: false, searchStatus: false,
labelTreeRetSelect: [], labelTreeRetSelect: [],
labelTreeRets: [ labelTreeRets: []
{
labelGroup: { id: '109', name: '湖口123' },
labelList: [
{ id: '372', name: '12345678' },
{ id: '371', name: '7654321' },
{ id: '370', name: '1234567' }
],
checked: false,
tagChecked: [],
isIndeterminate: false,
checkAll: false
},
{
labelGroup: { id: '65', name: '自店标签111' },
labelList: [
{ id: '179', name: '标签44' },
{ id: '178', name: '标签33' },
{ id: '176', name: '标签1112' }
],
checked: false,
tagChecked: [],
isIndeterminate: false,
checkAll: false
}
]
} }
}, },
watch: { watch: {
...@@ -99,7 +78,8 @@ export default { ...@@ -99,7 +78,8 @@ export default {
}, },
methods: { methods: {
jumpUrl() { jumpUrl() {
this.$history.push('/custom/tagsManage/index') util.openUrl(location.origin + '/custom/tagsManage/index')
this.dialogVisible = false
}, },
init(item) { init(item) {
this.labelGroupName = '' this.labelGroupName = ''
...@@ -111,6 +91,7 @@ export default { ...@@ -111,6 +91,7 @@ export default {
this.querylabeltree() this.querylabeltree()
}, },
querylabeltree(selectItem) { querylabeltree(selectItem) {
this.loading = true
this.$apis.channel this.$apis.channel
.querylabeltree({ .querylabeltree({
labelTreeReq: { labelTreeReq: {
...@@ -118,7 +99,8 @@ export default { ...@@ -118,7 +99,8 @@ export default {
pageSize: 1000, pageSize: 1000,
shopId: this.$globalState.session.merchantId, shopId: this.$globalState.session.merchantId,
labelGroupName: this.labelGroupName, labelGroupName: this.labelGroupName,
labelTypesStr: '自店标签,企业标签' labelTypesStr: '自店标签,企业标签',
edition: this.$globalState.session.merchantModel
} }
}) })
.then(res => { .then(res => {
...@@ -147,19 +129,14 @@ export default { ...@@ -147,19 +129,14 @@ export default {
} }
}) })
}) })
this.labelTreeRets.forEach(item => {
this.labelTreeRetSelect.forEach(itm => {
if (itm.labelGroup.id == item.labelGroup.id) {
item.tagChecked = utils.deepClone(itm.tagChecked)
}
})
})
this.labelTreeRets.forEach((item, index) => { this.labelTreeRets.forEach((item, index) => {
this.$nextTick(() => { this.$nextTick(() => {
this.handleCheckedChange(item.tagChecked, index) this.handleCheckedChange(item.tagChecked, index, 1)
}) })
}) })
this.labelTreeRetSelect = utils.deepClone(this.labelTreeRets) this.$nextTick(() => {
this.labelTreeRetSelect = utils.deepClone(this.labelTreeRets)
})
} else { } else {
this.labelTreeRets = res.labelTreeRets.map(item => { this.labelTreeRets = res.labelTreeRets.map(item => {
return { return {
...@@ -191,14 +168,27 @@ export default { ...@@ -191,14 +168,27 @@ export default {
this.labelTreeRetSelect = utils.deepClone(this.labelTreeRets) this.labelTreeRetSelect = utils.deepClone(this.labelTreeRets)
} }
} }
this.$nextTick(() => {
this.loading = false
})
}) })
}, },
remove(item, idx) { handleClose() {
item.tagChecked.splice(idx, 1) this.labelTreeRetSelect = []
this.dialogVisible = false
},
remove(items, idx) {
items.tagChecked.splice(idx, 1)
this.labelTreeRets.forEach(item => { this.labelTreeRets.forEach(item => {
this.labelTreeRetSelect.forEach(itm => { this.labelTreeRetSelect.forEach(itm => {
if (item.labelGroup.id == itm.labelGroup.id) { if (item.labelGroup.id == itm.labelGroup.id) {
item.tagChecked = utils.deepClone(itm.tagChecked) let tagChecked = []
itm.tagChecked.forEach(x => {
tagChecked.push(x.id)
})
this.$nextTick(() => {
item.tagChecked = item.labelList.filter(i => tagChecked.includes(i.id))
})
} }
if (item.tagChecked.length == 0) { if (item.tagChecked.length == 0) {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -207,10 +197,9 @@ export default { ...@@ -207,10 +197,9 @@ export default {
} }
}) })
}) })
this.labelTreeRets.forEach((item, index) => { this.labelTreeRets.forEach((item, index) => {
this.$nextTick(() => { this.$nextTick(() => {
this.handleCheckedChange(item.tagChecked, index) this.handleCheckedChange(item.tagChecked, index, 1)
}) })
}) })
}, },
...@@ -270,11 +259,11 @@ export default { ...@@ -270,11 +259,11 @@ export default {
this.heightBox = clientHeight - 0.15 * clientHeight - 350 this.heightBox = clientHeight - 0.15 * clientHeight - 350
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dialog-jump { .dialog-jump {
color: #5850FF; color: #5850ff;
float: left; float: left;
line-height: 24px; line-height: 24px;
text-decoration: underline; text-decoration: underline;
...@@ -367,4 +356,4 @@ export default { ...@@ -367,4 +356,4 @@ export default {
.tag-selected-box { .tag-selected-box {
min-height: 200px; min-height: 200px;
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template>
<div class="ly-emotion">
<slot></slot>
</div>
</template>
<script>
import emoji from '@/utils/emo'
export default {
name: 'ly-emotion',
mounted() {
const name = this.$el.innerHTML
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(name)) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
let imgHTML = `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
this.$nextTick(() => {
this.$el.innerHTML = imgHTML
})
}
}
</script>
<style scoped>
.ly-emotion {
display: inline-block;
}
.ly-static-emotion {
width: 24px;
height: 24px;
display: inline-block;
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="square-main"> <div class="square-main">
<el-dialog title="选择活动" :visible.sync="dialogVisible" width="70%" :before-close="handleClose"> <el-dialog title="选择活动" :visible.sync="dialogVisible" width="1088px" :before-close="handleClose">
<div class="model-panel"> <div class="model-panel" v-loading="loading">
<div class="model-panel-tab"> <div class="model-panel-tab">
<label>活动类型:</label> <label>活动类型:</label>
<el-tabs v-model="activeName" @tab-click="handleClick" type="card"> <el-tabs v-model="activeName" @tab-click="handleClick" type="card">
...@@ -9,46 +9,54 @@ ...@@ -9,46 +9,54 @@
<el-tab-pane label="权益套餐" name="4"></el-tab-pane> <el-tab-pane label="权益套餐" name="4"></el-tab-pane>
<el-tab-pane label="商城券" name="2"></el-tab-pane> <el-tab-pane label="商城券" name="2"></el-tab-pane>
<el-tab-pane label="秒杀活动" name="5"></el-tab-pane> <el-tab-pane label="秒杀活动" name="5"></el-tab-pane>
<el-tab-pane label="无忧服务" name="6" v-if="openFlag"></el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
<div class="model-item-panel" v-if="modelList.length > 0" v-loading="loading"> <div class="model-item-panel" v-if="modelList.length > 0">
<div class="model-item" :class="{ checked: selectItem == item }" v-for="(item, index) in modelList" :key="index" @click="handleSelectItem(item)"> <div class="model-item" :class="{ checked: selectItem == item }" v-for="(item, index) in modelList" :key="index" @click="handleSelectItem(item)">
<div class="model-item-title" :title="item.equityName" v-show="activeName == 3">{{ item.equityName }}</div> <div class="model-item-title" :title="item.equityName" v-show="activeName == 3">{{ item.equityName }}</div>
<div class="model-item-title" :title="item.couponName" v-show="activeName == 2">{{ item.couponName }}</div> <div class="model-item-title" :title="item.couponName" v-show="activeName == 2">{{ item.couponName }}</div>
<div class="model-item-title" :title="item.couponName" v-show="activeName == 1">{{ item.couponName }}</div> <div class="model-item-title" :title="item.couponName" v-show="activeName == 6">{{ item.equityName }}</div>
<div class="model-item-title" :title="item.packageName" v-show="activeName == 4">{{ item.packageName }}</div> <div class="model-item-title" :title="item.packageName" v-show="activeName == 4">{{ item.packageName }}</div>
<div class="model-item-title" :title="item.activityName" v-show="activeName == 5">{{ item.activityName }}</div> <div class="model-item-title" :title="item.activityName" v-show="activeName == 5">{{ item.activityName }}</div>
<div class="model-item-content" v-show="activeName == 1 || activeName == 4"></div> <div class="model-item-content" v-show="activeName == 3">领取方式:免费领用</div>
<div class="model-item-content" v-show="activeName == 2">剩余数量:{{ item.residueAmount }}</div> <div class="model-item-content" v-show="activeName == 4">领取方式:付费购买</div>
<div class="model-item-content" v-show="activeName == 1">剩余数量:{{ item.remainAmount }}</div> <div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 6">有效期:{{ item.effectiveDays }}天</div>
<div class="model-item-content" v-show="activeName == 3">价格:{{ item.goodPrice }}元</div>
<div class="model-item-content" v-show="activeName == 4">价格:{{ item.packagePrice }}元</div>
<div class="model-item-content" v-show="activeName == 5"></div>
<div class="model-item-content" v-show="activeName == 5"></div>
<div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 1">有效期:{{ item.effectiveDays }}天</div>
<div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 3">有效期:无限制</div> <div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 3">有效期:无限制</div>
<div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 2">有效期:{{ item.effectiveStartTime ? item.effectiveStartTime.split(' ')[0] : '' }}~{{ item.effectiveEndTime ? item.effectiveEndTime.split(' ')[0] : '' }}</div> <div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 2">有效期:{{ item.effectiveStartTime ? item.effectiveStartTime.split(' ')[0] : '' }}~{{ item.effectiveEndTime ? item.effectiveEndTime.split(' ')[0] : '' }}</div>
<div class="model-item-content" v-show="activeName == 6">获取方式:需先购买无忧服务套餐</div>
<div class="model-item-content" v-show="activeName == 6">获取限制:每个服务套餐限领一次</div>
<div class="model-item-content" v-show="activeName == 3">有效期:{{ item.effectivedDay }}天</div> <div class="model-item-content" v-show="activeName == 3"></div>
<div class="model-item-content model-item-contents" v-show="activeName == 3">
试用天数:
<span>{{ item.freeDay }}天</span>
</div>
<div class="model-item-content" v-show="activeName == 2"> <div class="model-item-content" v-show="activeName == 2">
类型: 使用途径:
<span>{{ item.discountType == 2 ? '折扣券' : item.discountType == 3 ? '代金券' : item.discountType == 4 ? '兑换券' : '' }}</span> {{ item.useChannel == 1 ? '线上商品' : '到店核销' }}
</div> </div>
<div class="model-item-content" v-show="activeName == 1"> <div class="model-item-content model-item-weight" v-show="activeName == 6">
类型: 赠送天数:
<span>精品券</span> <span>{{ item.effectiveType == 2 ? item.effectivedDay + '天' : '永久有效' }}</span>
</div> </div>
<div class="model-item-content" v-show="activeName == 3"> <div class="model-item-content" v-show="activeName == 4 || activeName == 5"></div>
类型: <div class="model-item-content model-item-contents" v-show="activeName == 4">
<span>权益卡</span> 销售价格:
<span>{{ item.packagePrice }}元</span>
</div> </div>
<div class="model-item-content" v-show="activeName == 4"> <div class="model-item-content" v-if="activeName == 5">
类型: 开始时间:
<span>权益套餐</span> {{ item.startTime }}
</div> </div>
<div class="model-item-content" v-if="activeName == 5"> <div class="model-item-content" v-if="activeName == 5">
活动时间: 结束时间:
{{ item.startTime.split(' ')[0] }}-{{ item.endTime.split(' ')[0] }} {{ item.endTime }}
</div>
<div class="model-item-content model-item-contents" v-show="activeName == 2">
数量:
<span>{{ item.residueAmount }}</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -56,28 +64,34 @@ ...@@ -56,28 +64,34 @@
<img src="@/assets/img/empty.png" /> <img src="@/assets/img/empty.png" />
<div class="empty-item">暂无数据</div> <div class="empty-item">暂无数据</div>
</div> </div>
<el-pagination v-if="activeName != 3" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[12, 24, 36, 48]" :page-size="pageSize" :total="tableTotal" layout="total, sizes, prev, pager, next, jumper"></el-pagination> <el-pagination v-if="activeName != 3 && activeName != 6" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[12, 24, 36, 48]" :page-size="pageSize" :total="tableTotal" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible = false">取 消</el-button> <el-button size="small" @click="dialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelect">确 定</el-button> <el-button size="small" type="primary" @click="handleSelect" v-show="modelList.length">确 定</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && activeName == 2 && memberMenu">立即添加</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && activeName == 4 && couponMenu">立即添加</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && activeName == 5 && activityMenu">立即添加</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import util from '@/utils/util'
export default { export default {
name: 'ActivityModel', name: 'ActivityModel',
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
couponMenu: false,
loading: false, loading: false,
activeName: '3', activeName: '3',
modelList: [], modelList: [],
pageNum: 1, pageNum: 1,
pageSize: 12, pageSize: 12,
tableTotal: 0, tableTotal: 0,
openFlag: 0,
selectItem: { selectItem: {
id: '' id: ''
} }
...@@ -86,7 +100,7 @@ export default { ...@@ -86,7 +100,7 @@ export default {
methods: { methods: {
handleSelectItem(item) { handleSelectItem(item) {
this.selectItem = item this.selectItem = item
if(item.equityClassId) { if (item.equityClassId) {
this.selectItem.id = item.equityClassId this.selectItem.id = item.equityClassId
} }
console.log(this.selectItem) console.log(this.selectItem)
...@@ -100,7 +114,7 @@ export default { ...@@ -100,7 +114,7 @@ export default {
return return
} }
this.dialogVisible = false this.dialogVisible = false
this.$emit('selectActivity', { marketingId: this.selectItem.id, marketingType: this.activeName, marketingName: this.activeName == 3 ? this.selectItem.equityName : this.activeName == 4 ? this.selectItem.packageName : this.activeName == 5 ? this.selectItem.activityName : this.selectItem.couponName }) this.$emit('selectActivity', { marketingId: this.selectItem.id ? this.selectItem.id : this.selectItem.equityClassId, marketingType: this.activeName, marketingName: this.activeName == 3 ? this.selectItem.equityName : this.activeName == 4 ? this.selectItem.packageName : this.activeName == 5 ? this.selectItem.activityName : this.activeName == 2 ? this.selectItem.couponName : this.selectItem.equityName })
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.pageSize = val this.pageSize = val
...@@ -110,13 +124,29 @@ export default { ...@@ -110,13 +124,29 @@ export default {
this.pageNum = val this.pageNum = val
this.getModelList() this.getModelList()
}, },
handleOpen() {
let url
switch (this.activeName) {
case '2':
url = '/marketing/couponManage/index'
break
case '4':
url = '/marketing/memberCenter/setmealAddUpdate?%24title=%25E5%2588%259B%25E5%25BB%25BA%25E5%25A5%2597%25E9%25A4%2590'
break
case '5':
url = '/marketing/seckillActivity/editActivity/1'
break
}
util.openUrl(location.origin + url)
this.dialogVisible = false
},
getModelList() { getModelList() {
this.modelList = [] this.modelList = []
this.loading = true this.loading = true
let market = '' let market = ''
switch (this.activeName) { switch (this.activeName) {
case '1': case '6':
market = 'getCoupon' market = 'merchant'
break break
case '2': case '2':
market = 'getMerchant' market = 'getMerchant'
...@@ -141,15 +171,19 @@ export default { ...@@ -141,15 +171,19 @@ export default {
} }
if (this.activeName == 2) { if (this.activeName == 2) {
params.discountTypes = [2, 3, 4] params.discountTypes = [2, 3, 4]
params.directionalFlag = 1 // 1所有人可用2定向礼包专用3关联优惠券
params.validType = 'valid' params.validType = 'valid'
} }
if (this.activeName == 5) { if (this.activeName == 5) {
params.currentPage = this.pageNum params.currentPage = this.pageNum
params.activityStatus = 2 params.activityStatus = 2
} }
if (this.activeName == 6) {
params.merchantId = this.$globalState.session.merchantId
}
this.$apis.marketing[market](params) this.$apis.marketing[market](params)
.then(res => { .then(res => {
if (this.activeName == 3) { if (this.activeName == 3 || this.activeName == 6) {
this.modelList = res this.modelList = res
} else { } else {
this.modelList = res.list ? res.list : res.data this.modelList = res.list ? res.list : res.data
...@@ -161,7 +195,40 @@ export default { ...@@ -161,7 +195,40 @@ export default {
this.loading = false this.loading = false
}) })
}, },
merchantOpen() {
let channel = null
if (location.host == 'scrm.cgacar.com') {
channel = 2
}
this.$apis.marketing.merchantOpen({ merchantId: this.$globalState.session.merchantId, channel }).then(res => {
this.openFlag = res.openFlag
})
},
init() { init() {
this.merchantOpen()
this.couponMenu = false
this.activityMenu = false
this.memberMenu = false
const menu = JSON.parse(sessionStorage['SCRM_BASE_MENULIST'])
menu.forEach(item => {
if (item.name == 'marketing') {
if (!item.children) {
return
}
item.children.forEach(itm => {
console.log(itm.path)
if (itm.path == '/couponManage/index') {
this.couponMenu = true
}
if (itm.path == '/seckillActivity/index') {
this.activityMenu = true
}
if (itm.path == '^') {
this.memberMenu = true
}
})
}
})
this.dialogVisible = true this.dialogVisible = true
this.getModelList() this.getModelList()
this.selectItem = {} this.selectItem = {}
...@@ -171,9 +238,16 @@ export default { ...@@ -171,9 +238,16 @@ export default {
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.square-main {
/deep/ {
.el-dialog__footer {
text-align: center;
}
}
}
.model-panel { .model-panel {
.model-panel-tab { .model-panel-tab {
display: flex; display: flex;
...@@ -229,27 +303,33 @@ export default { ...@@ -229,27 +303,33 @@ export default {
} }
} }
.model-item-panel { .model-item-panel {
display: grid; // display: grid;
grid-template-columns: repeat(4, 25%); // grid-template-columns: repeat(4, 25%);
grid-row-gap: 10px; // grid-row-gap: 10px;
height: 38vh; max-height: 38vh;
padding: 10px;
overflow: auto; overflow: auto;
text-align: center; display: flex;
flex-wrap: wrap;
align-items: stretch;
flex-direction: row;
.model-item { .model-item {
width: 240px;
margin-right: 24px;
margin-bottom: 24px;
padding: 12px 16px;
position: relative; position: relative;
height: 128px; height: 128px;
background: #ffffff; background: #ffffff;
border-radius: 4px; border-radius: 4px;
border: 2px solid #e6e6e6; border: 1px solid #e6e6e6;
padding: 14px 24px; padding: 14px 24px;
box-sizing: border-box; box-sizing: border-box;
margin-right: 10px;
&:nth-child(4n) { &:nth-child(4n) {
margin-right: 0px; margin-right: 0px;
} }
&.checked { &.checked {
border: 2px solid #5850ff; background: rgba(88, 80, 255, 0.1);
border: 1px solid #5850ff;
} }
&-qrcode { &-qrcode {
position: absolute; position: absolute;
...@@ -273,16 +353,26 @@ export default { ...@@ -273,16 +353,26 @@ export default {
font-size: 12px; font-size: 12px;
font-weight: 400; font-weight: 400;
color: #666666; color: #666666;
line-height: 17px; line-height: 16px;
height: 16px;
margin-top: 6px; margin-top: 6px;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
&.model-item-weight {
line-height: 20px;
height: 20px;
}
span { span {
color: #5850ff; color: #5850ff;
font-size: 20px;
} }
} }
&-contents {
line-height: 22px;
height: 22px;
}
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template>
<div>
<div class="emotion-box" :style="{ height: height + 'px' }">
<div class="emotion-box-line" v-for="(line, i) in list" :key="i">
<emotion class="emotion-item" v-for="(item, i) in line" :key="i" @click.native="clickHandler(item)">{{ item }}</emotion>
</div>
</div>
</div>
</template>
<script>
import emoji from '@/utils/emo'
import Emotion from './Emotion'
export default {
props: {
height: {
type: Number,
default: 200
}
},
data() {
return {
list: emoji
}
},
methods: {
clickHandler(i) {
let emotion = `${i}`
this.$emit('emotion', emotion)
}
},
components: {
Emotion
}
}
</script>
<style scoped lang="scss">
.emotion-box {
z-index: 2004;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.15);
width: 300px;
box-sizing: border-box;
padding: 5px;
overflow: hidden;
overflow-y: auto;
}
.emotion-box-line {
display: flex;
}
.emotion-item {
flex: 1;
text-align: center;
cursor: pointer;
/deep/ {
img {
width: 24px;
-webkit-user-select: none;
cursor: default;
pointer-events: none;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<!-- 素材弹窗 -->
<template>
<glsx-dialog title="选择素材" :isVisible.sync="isMaterialVisible" width="1088px" @confirmDialog="handleMaterialConfirm" @closeDialog="handleMaterialClose" class="relateStore">
<GLCombiForm ref="showSearch" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="model-panel">
<div class="model-item-panel" v-if="modelList.length > 0" v-loading="loading">
<div class="model-item" :class="{ checked: selectItem.id == item.id }" v-for="(item, index) in modelList" :key="index" @click="handleSelectItem(item)">
<el-tooltip effect="dark" placement="top" :content="item.materialContentRpcResponse.materialName" :disabled="item.materialContentRpcResponse.materialName.length < 16">
<!-- <span class="hide-content">{{ item.materialContentRpcResponse.materialName }}</span> -->
<div class="model-item-title" :title="item.materialContentRpcResponse.materialName">{{ item.materialContentRpcResponse ? item.materialContentRpcResponse.materialName : '-' }}</div>
</el-tooltip>
<!-- <img :src="item.materialContentRpcResponse.materialUrl" /> -->
<!-- 素材内容 -->
<!-- <div slot="materialContentRpcResponse" slot-scope="scope" style="text-align: center"> -->
<!-- 素材为PDF -->
<span v-if="item.materialType == 1" class="material-content">
<!-- <el-tooltip effect="dark" placement="top" :content="item.materialContentRpcResponse.materialName" :disabled="item.materialContentRpcResponse.materialName.length < 16">
<span class="hide-content">{{ item.materialContentRpcResponse.materialName }}</span>
</el-tooltip> -->
<img class="img-pdf" src="@/assets/material/pdf.png" alt="" />
<p class="model-item-content">{{ item.materialContentRpcResponse.materialName }}.png</p>
</span>
<!-- 素材为自定义链接 -->
<!-- <span v-if="item.materialType == 2"></span> -->
<!-- 图文 -->
<span v-if="item.materialType == 3" class="material-content">
<!-- <el-tooltip effect="dark" placement="top" :content="item.materialContentRpcResponse.materialName" :disabled="item.materialContentRpcResponse.materialName.length < 16">
<span>{{ item.materialContentRpcResponse.materialName }}</span>
</el-tooltip> -->
<!-- <el-popover placement="top" trigger="click">
<div>
<img style="width: 72px; height: 72px;" v-if="item.materialContentRpcResponse.materialUrl" :src="item.materialContentRpcResponse.materialUrl" alt="" />
<img class="img-material" v-else src="@/assets/material/car.png" alt="" />
</div>
<span slot="reference">
<img v-if="item.materialContentRpcResponse.materialUrl" class="img-material" :src="item.materialContentRpcResponse.materialUrl" />
<img v-else class="img-material" src="@/assets/material/car.png" alt="" />
</span>
</el-popover> -->
<img v-if="item.materialContentRpcResponse.materialUrl" class="img-material" :src="item.materialContentRpcResponse.materialUrl" />
<img v-else class="img-material" src="@/assets/material/car.png" alt="" />
</span>
</div>
<!-- </div> -->
</div>
<div class="model-item-empty" v-else v-loading="loading">
<img src="@/assets/img/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[12, 24, 36, 48]" :page-size="pageSize" :total="tableTotal" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
</glsx-dialog>
</template>
<script>
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'materialModel',
data() {
return {
searchForm: {
groupId: '',
materialType: ''
},
searchFormData: [
{
label: '素材分组',
name: 'groupId',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'materialGroupName',
optionsName: 'groupList'
},
{
label: '素材类型',
name: 'materialType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'materialTypeList'
}
],
// selectedData: [],
// selectingData: [],
// needTip: ['editProduct'],
modelList: [],
selectItem: {
id: ''
},
// 分页
pageNum: 1,
pageSize: 12,
tableTotal: 0,
baseData: {
groupList: [],
materialTypeList: [
{
confId: 1,
confName: 'PDF'
},
// {
// confId: 2,
// confName: '自定义链接'
// },
{
confId: 3,
confName: '图文'
}
]
}
}
},
props: {
isMaterialVisible: {
type: Boolean,
default: false
}
},
components: {
glsxDialog
},
created() {
this.getBaseData()
},
mounted() {
this.getModelList()
},
methods: {
getBaseData() {
this.$apis.sop.getGroupListApi({}).then(res => {
this.baseData.groupList = res
this.getOptionsList('searchFormData')
})
},
handleSelectItem(item) {
this.selectItem = item
},
getModelList() {
var params = {
...this.searchForm,
status: 0,
pageNum: this.pageNum,
pageSize: this.pageSize
}
this.$apis.sop.getMaterialListApi(params).then(res => {
this.modelList = res.data
this.tableTotal = res.count
let tableData = []
this.modelList.forEach(item => {
if (item.materialType != 3) {
item.materialContentRpcResponse.materialUrl = ''
}
if (item.materialType == 3) {
let html = decodeURIComponent(item.materialContentRpcResponse.materialUrl)
let imgHtml = html.match(/<img.*?(?:>|\/>)/g)
if (imgHtml) {
let imgSrc = imgHtml[0].match('<img[^<>]*? src="([^<>]*?)"')
item.materialContentRpcResponse.materialUrl = imgSrc[1]
} else {
item.materialContentRpcResponse.materialUrl = ''
}
}
tableData.push(item)
})
})
},
handleReset() {
this.searchForm = {
groupId: '',
materialType: ''
}
this.handleSearch()
},
handleSearch() {
this.pageNum = 1
this.getModelList()
},
handleSizeChange(val) {
this.pageSize = val
this.getModelList()
},
handleCurrentChange(val) {
this.pageNum = val
this.getModelList()
},
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)
}
}
})
}
},
handleMaterialConfirm() {
this.$emit('handleMaterialConfirm', {
objectId: this.selectItem.id,
objectType: 10,
objectName: this.selectItem.materialContentRpcResponse.materialName,
additionalType: 1
})
},
handleMaterialClose() {
this.$emit('handleMaterialClose')
}
}
}
</script>
<style lang="scss" scoped>
.relateStore {
/deep/ {
.gl-operate {
margin-left: 10px;
}
}
}
.model-panel {
.model-panel-tab {
display: flex;
align-items: center;
margin-bottom: 18px;
label {
font-size: 16px;
font-weight: 400;
color: #000000;
line-height: 24px;
}
/deep/ {
.el-checkbox:last-of-type {
margin-right: 8px;
}
.el-tabs__nav {
border: 0;
}
.el-tabs__header {
border: 0;
background-color: #f4f6fc;
margin: 0px;
}
.el-tabs__item {
border: none;
width: 180px;
height: 32px;
line-height: 32px;
margin: 2px;
text-align: center;
}
.el-tabs__item.is-active {
background-color: #fff;
border-radius: 4px;
font-weight: 600;
}
.el-pagination {
padding: 5px;
}
}
}
.model-item-empty {
> img {
display: block;
margin: 50px auto 0px;
width: 60px;
height: auto;
}
.empty-item {
text-align: center;
font-size: 14px;
font-weight: 400;
color: #000000;
line-height: 22px;
margin-bottom: 30px;
}
}
.model-item-panel {
display: grid;
grid-template-columns: repeat(4, 25%);
grid-row-gap: 10px;
max-height: 38vh;
overflow: auto;
display: flex;
flex-wrap: wrap;
align-items: stretch;
flex-direction: row;
.model-item {
width: 100%;
// margin-right: 24px;
margin-bottom: 24px;
padding: 12px 16px;
position: relative;
text-align: center;
// height: 128px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e6e6e6;
padding: 14px 24px;
box-sizing: border-box;
&:nth-child(4n) {
margin-right: 0px;
}
&.checked {
background: rgba(88, 80, 255, 0.1);
border: 1px solid #5850ff;
}
&-qrcode {
position: absolute;
right: 10px;
bottom: 10px;
width: 60px;
height: 60px;
border: 1px solid #979797;
}
&-title {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
margin-bottom: 5px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.img-pdf {
width: 40px;
height: 40px;
margin-top: 10px;
}
.img-material {
width: 72px;
height: 72px;
}
&-content {
font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 16px;
height: 16px;
margin-top: 6px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
&.model-item-weight {
line-height: 20px;
height: 20px;
}
span {
color: #5850ff;
font-size: 20px;
}
}
&-contents {
line-height: 22px;
height: 22px;
}
}
}
}
</style>
<template> <template>
<div class="w-textarea" ref="wTextarea"> <div class="w-textarea" ref="wTextarea">
<div contenteditable="true" class="w-textarea_input" ref="wTextareaContent" :id="contentId" @click="inputClick($event)" @focus="isLocked = true" @blur="isLocked = false" @keydown.delete="handleDelete($event)" @input="handleInput($event.target)"></div> <div contenteditable="true" class="w-textarea_input" ref="wTextareaContent" :id="contentId" @click="inputClick($event)" @focus="onFocus" @blur="onBlur" @keydown="textareaKeydown($event)" @input="handleInput($event.target)"></div>
<!-- <div class="w-textarea_tools" v-if="tools.length > 0 || maxlength"> <!-- <div class="w-textarea_tools" v-if="tools.length > 0 || maxlength">
<button <button
class="w-textarea_tools__item" class="w-textarea_tools__item"
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
</template> </template>
<script> <script>
import emoji from '@/utils/emo'
export default { export default {
name: 'wTextarea', name: 'wTextarea',
data() { data() {
...@@ -31,6 +32,7 @@ export default { ...@@ -31,6 +32,7 @@ export default {
contentId: `content${this.getGuid()}`, contentId: `content${this.getGuid()}`,
// 输入的时候锁定,禁止更新innerHTML // 输入的时候锁定,禁止更新innerHTML
isLocked: false, isLocked: false,
isInsert: false,
// 记录当前选中tag的ID // 记录当前选中tag的ID
currentTagId: null, currentTagId: null,
// 当前光标位置 // 当前光标位置
...@@ -108,6 +110,50 @@ export default { ...@@ -108,6 +110,50 @@ export default {
// 处理后需要调用 addTag() 或者 addLink() 将内容传回来 // 处理后需要调用 addTag() 或者 addLink() 将内容传回来
this.$emit('add', type) this.$emit('add', type)
}, },
textareaKeydown(event) {
if (event.keyCode == 13) {
this.insertHtml('<br>')
let nn = document.createElement('br')
document.querySelector('.w-textarea_input').appendChild(nn)
return false
}
},
/*换行*/
insertHtml(html) {
var sel, range
if (window.getSelection) {
// IE9 或 非IE浏览器
sel = window.getSelection()
if (sel.getRangeAt && sel.rangeCount) {
range = sel.getRangeAt(0)
range.deleteContents()
// Range.createContextualFragment() would be useful here but is
// non-standard and not supported in all browsers (IE9, for one)
var el = document.createElement('div')
el.innerHTML = html
var frag = document.createDocumentFragment(),
node,
lastNode
while ((node = el.firstChild)) {
lastNode = frag.appendChild(node)
}
range.insertNode(frag)
// Preserve the selection
if (lastNode) {
range = range.cloneRange()
range.setStartAfter(lastNode)
range.collapse(true)
sel.removeAllRanges()
sel.addRange(range)
}
}
} else if (document.selection && document.selection.type != 'Control') {
// IE < 9
document.selection.createRange().pasteHTML(html)
}
this.currentText = document.querySelector('.w-textarea_input').innerHTML
this.$emit('updateText', this.currentText)
},
addTag(text) { addTag(text) {
// 创建模版标签 // 创建模版标签
let node = document.createElement(this.tag) let node = document.createElement(this.tag)
...@@ -173,12 +219,42 @@ export default { ...@@ -173,12 +219,42 @@ export default {
node.target = 'blank' node.target = 'blank'
this.insertNode(node) this.insertNode(node)
}, },
addImg(url) {
// 创建a标签
let node = document.createElement('img')
node.src = url
// node.setAttribute('ondragstart', 'return false;')
this.insertNode(node)
},
onFocus() {
this.isLocked = true
this.isInsert = true
},
onBlur() {
this.isLocked = false
},
insertNode(node) { insertNode(node) {
// 在内容中插入标签 // 在内容中插入标签
// 删掉选中的内容(如有) // 删掉选中的内容(如有)
if (this.savedRange.startContainer) {
this.insertNodeFirst(node)
} else {
document.querySelector('.w-textarea_input').focus()
setTimeout(() => {
this.insertNodeFirst(node)
document.querySelector('.w-textarea_input').blur()
}, 100)
}
},
insertNodeFirst(node) {
this.savedRange.deleteContents() this.savedRange.deleteContents()
// 插入链接 // 插入链接
this.savedRange.insertNode(node) if (this.isInsert) {
this.savedRange.insertNode(node)
} else {
document.querySelector('.w-textarea_input').appendChild(node)
}
this.isInsert = false
// 更新双向绑定数据 // 更新双向绑定数据
let target = this.$refs.wTextareaContent let target = this.$refs.wTextareaContent
if (navigator.userAgent.indexOf('Firefox') > 0 || navigator.userAgent.indexOf('QQBrowser') > 0) { if (navigator.userAgent.indexOf('Firefox') > 0 || navigator.userAgent.indexOf('QQBrowser') > 0) {
...@@ -186,7 +262,20 @@ export default { ...@@ -186,7 +262,20 @@ export default {
} else { } else {
this.updateData(target.innerHTML) this.updateData(target.innerHTML)
} }
this.currentText = target.innerText let htm = target.innerHTML
const list = emoji.flat(Infinity)
const cutImg = htm
.replace(/<img src="https:\/\/img01.glsx.com.cn\/weapp\/resource\/saas\/scrm\/emoji\//g, '')
.replace(/<wise.+?(?:<\/wise>)/g, '@昵称')
.replace(/<br>/g, '\n')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function(str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg
this.currentText = replaceImg.substring(0, 600)
console.log(this.currentText)
this.$emit('updateText', this.currentText) this.$emit('updateText', this.currentText)
}, },
placeCaretAtEnd(el) { placeCaretAtEnd(el) {
...@@ -209,7 +298,21 @@ export default { ...@@ -209,7 +298,21 @@ export default {
handleInput(target) { handleInput(target) {
// 即时更新数据 // 即时更新数据
this.updateData(target.innerHTML) this.updateData(target.innerHTML)
this.currentText = target.innerText let htm = target.innerHTML
console.log(htm)
const list = emoji.flat(Infinity)
const cutImg = htm
.replace(/<img src="https:\/\/img01.glsx.com.cn\/weapp\/resource\/saas\/scrm\/emoji\//g, '')
.replace(/<wise.+?(?:<\/wise>)/g, '@昵称')
.replace(/<br>/g, '\n')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function(str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg
this.currentText = replaceImg.substring(0, 600)
console.log(this.currentText)
this.$emit('updateText', this.currentText) this.$emit('updateText', this.currentText)
}, },
handleDelete(e) { handleDelete(e) {
...@@ -241,11 +344,11 @@ export default { ...@@ -241,11 +344,11 @@ export default {
} else { } else {
this.currentTagId = null this.currentTagId = null
} }
}, },
getGuid() { getGuid() {
return 1
// 生成随机ID // 生成随机ID
return `r${new Date().getTime()}d${Math.ceil(Math.random() * 1000)}` // return `r${new Date().getTime()}d${Math.ceil(Math.random() * 1000)}`
}, },
selectHandler() { selectHandler() {
// 监听选定文本的变动 // 监听选定文本的变动
...@@ -284,6 +387,13 @@ export default { ...@@ -284,6 +387,13 @@ export default {
cursor: default; cursor: default;
-webkit-user-modify: read-only !important; -webkit-user-modify: read-only !important;
} }
img {
width: 24px;
height: 24px;
-webkit-user-select: none;
cursor: default;
pointer-events: none;
}
.active { .active {
background: #dcdfe6; background: #dcdfe6;
} }
...@@ -361,4 +471,4 @@ $textColor: #666; ...@@ -361,4 +471,4 @@ $textColor: #666;
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -45,20 +45,25 @@ ...@@ -45,20 +45,25 @@
<div class="btn-group"> <div class="btn-group">
<div class="add-btn" v-for="item in btnList" :key="item.id"> <div class="add-btn" v-for="item in btnList" :key="item.id">
<!-- <i class="el-icon-circle-plus-outline"></i> --> <!-- <i class="el-icon-circle-plus-outline"></i> -->
<img :src="require(`@/assets/img/guestCustom/add-${item.type}.png`)" alt /> <img :src="require(`@/assets/img/guestCustom/add-${item.type}.png`)" alt v-if="item.id == 1" @click="selectEmotion" />
<span>{{ item.name }}</span> <img :src="require(`@/assets/img/guestCustom/add-${item.type}.png`)" v-else alt />
<span v-if="item.id == 1" @click.stop="selectEmotion">{{ item.name }}</span>
<span v-else>{{ item.name }}</span>
<input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input upload-img" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" /> <input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input upload-img" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" />
<input v-else-if="item.type == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'video/*'" @change="e => handleVideoChange(e, item)" /> <input v-else-if="item.type == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'video/*'" @change="e => handleVideoChange(e, item)" />
<el-link v-else style="opacity: 0" @click="handleFun(item.funName)">{{ item.name }}</el-link> <el-link v-else-if="item.type == 'nickname' || item.type == 'acivity' || item.type == 'material'" style="opacity: 0" @click="handleFun(item.funName)">{{ item.name }}</el-link>
</div> </div>
</div> </div>
</div> </div>
<div v-show="emotionStatus" class="emotion-panel"><emotion class="emotion-panel-box" @emotion="handleEmotion" :height="376"></emotion></div>
<div class="tips-text"> <div class="tips-text">
<img src="@/assets/img/guestCustom/tips.png" class="tips-icon" alt /> <img src="@/assets/img/guestCustom/tips.png" class="tips-icon" alt />
<span>如在企业微信管理后台已为所选员工设置了欢迎语,则此处设置的将不生效。</span> <span @click="selectEmotion">如在企业微信管理后台已为所选员工设置了欢迎语,则此处设置的将不生效。</span>
</div> </div>
</div> </div>
<ActivityModel ref="activity" @selectActivity="selectActivity"></ActivityModel> <ActivityModel ref="activity" @selectActivity="selectActivity"></ActivityModel>
<!-- <material-model v-if="isMaterialVisible" :isMaterialVisible.sync="isMaterialVisible" @handleMaterialConfirm="handleMaterialConfirm" @handleMaterialClose="handleMaterialClose"></material-model> -->
</div> </div>
</template> </template>
<script> <script>
...@@ -71,28 +76,34 @@ const ATT_TYPE = { ...@@ -71,28 +76,34 @@ const ATT_TYPE = {
FILE: 6, FILE: 6,
ACTIVITY: 7 ACTIVITY: 7
} }
// import E from 'wangeditor' import emoji from '@/utils/emo'
import ActivityModel from './activityModel' import ActivityModel from './activityModel'
// import materialModel from './materialModel'
import Emotion from './emotionWords'
import wTextarea from './tag-textarea' import wTextarea from './tag-textarea'
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
export default { export default {
name: 'WelcomeWords', name: 'WelcomeWords',
components: { components: {
ActivityModel, ActivityModel,
// materialModel,
Emotion,
wTextarea wTextarea
}, },
props: { eventBus: Object }, props: { eventBus: Object },
data() { data() {
return { return {
loading: false, loading: false,
emotionStatus: false,
isMaterialVisible: false,
btnList: [ btnList: [
// { {
// id: 1, id: 1,
// name: '表情', name: '表情',
// funcName: '', funcName: '',
// type: 'expression', type: 'expression',
// limitSize: 10 limitSize: 10
// }, },
{ {
id: 2, id: 2,
name: '图片', name: '图片',
...@@ -106,6 +117,12 @@ export default { ...@@ -106,6 +117,12 @@ export default {
type: 'nickname', type: 'nickname',
funName: 'nickname' funName: 'nickname'
}, },
// {
// id: 5,
// name: '素材',
// type: 'material',
// funName: 'material'
// },
{ {
id: 4, id: 4,
name: '活动', name: '活动',
...@@ -140,6 +157,20 @@ export default { ...@@ -140,6 +157,20 @@ export default {
this.eventBus.$emit('update', this.previewList) this.eventBus.$emit('update', this.previewList)
}, },
methods: { methods: {
selectEmotion() {
this.emotionStatus = !this.emotionStatus
},
handleEmotion(i) {
this.emotionStatus = false
const list = emoji.flat(Infinity)
let index = list.indexOf(i) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
this.$refs.textContent.addImg(`https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png`)
},
updateText(val) { updateText(val) {
this.textInput(val) this.textInput(val)
}, },
...@@ -208,11 +239,33 @@ export default { ...@@ -208,11 +239,33 @@ export default {
}) })
} }
}, },
// 素材
handleMaterialConfirm(val) {
console.log(val)
// additionalType 附加对象类型(1素材,2活动,3优惠券,4朋友券模板)
// objectType 对象类型(1朋友圈模板-单图文,2朋友圈模板-多图文,3朋友圈模板-文字+视频,4朋友圈模板-文字,5优惠券-商城券,6活动-权益卡使用,7活动-权益套餐,8活动-秒杀活动,10-素材)
this.editForm.object = JSON.parse(JSON.stringify(val))
this.editRule.eventContent[0].required = true
this.editForm.pushChannelType = ''
this.previewList = [
{
attContent: val,
additionalType: val.additionalType
}
]
this.handleMaterialClose()
},
handleMaterialClose() {
this.isMaterialVisible = !this.isMaterialVisible
},
handleFun(name) { handleFun(name) {
if (name == 'nickname') { if (name == 'nickname') {
this.$refs.textContent.addTag('@昵称') this.$refs.textContent.addTag('@昵称')
} else if (name == 'activity') { } else if (name == 'activity') {
this.$refs.activity.init() this.$refs.activity.init()
} else if (name == 'material') {
this.handleMaterialClose()
} }
}, },
close(index) { close(index) {
...@@ -220,6 +273,7 @@ export default { ...@@ -220,6 +273,7 @@ export default {
this.eventBus.$emit('update', this.previewList) this.eventBus.$emit('update', this.previewList)
}, },
textInput(val) { textInput(val) {
val = val.replace(/&nbsp;/g, '')
const hasText = this.previewList.some(item => item.attType == 1) const hasText = this.previewList.some(item => item.attType == 1)
if (hasText) { if (hasText) {
this.$set(this.previewList, 0, { this.$set(this.previewList, 0, {
...@@ -255,35 +309,7 @@ export default { ...@@ -255,35 +309,7 @@ export default {
} }
} }
}, },
insertHtmlAtCaret(html) { changeInput: utils.debounce(function() {
var sel, range, frag
if (window.getSelection) {
sel = window.getSelection()
if (sel.getRangeAt && sel.rangeCount) {
range = sel.getRangeAt(0)
range.deleteContents()
var el = document.createElement('span')
el.innerHTML = '<span contenteditable="false" class="nickname">@昵称<i class="el-icon-error"></i></span>'
// var el = document.createElement('div')
// el.innerHTML = html
frag = document.createDocumentFragment()
var node
var lastNode
while ((node = el.firstChild)) {
lastNode = frag.appendChild(node)
}
range.insertNode(frag)
if (lastNode) {
range = range.cloneRange()
range.setEndAfter(lastNode)
range.collapse(true)
sel.removeAllRanges()
sel.addRange(range)
}
}
}
},
changeInput: utils.debounce(function () {
console.log(document.getElementById('editor').childNodes) console.log(document.getElementById('editor').childNodes)
var allNodes = document.getElementById('editor').childNodes var allNodes = document.getElementById('editor').childNodes
var str = '' var str = ''
...@@ -302,10 +328,21 @@ export default { ...@@ -302,10 +328,21 @@ export default {
this.previewList = val this.previewList = val
this.eventBus.$emit('update', this.previewList) this.eventBus.$emit('update', this.previewList)
const obj = val.find(item => item.attType == 1) const obj = val.find(item => item.attType == 1)
let attContent = obj.attContent.replaceAll('[@昵称]', '<wise id="1">@昵称</wise>') let attContent = obj.attContent.replace(/\[@昵称\]/g, '<wise id="1" contenteditable="false">@昵称</wise>')
const htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function(res) {
let word = res.replace(/\[|\]/gi, '')
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(word)) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
return `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
})
document.querySelector('.w-textarea_input').focus() document.querySelector('.w-textarea_input').focus()
setTimeout(() => { setTimeout(() => {
document.querySelector('.w-textarea_input').innerHTML = attContent document.querySelector('.w-textarea_input').innerHTML = htm
}, 100) }, 100)
} }
} }
...@@ -315,6 +352,14 @@ export default { ...@@ -315,6 +352,14 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.welcome-box { .welcome-box {
} }
.emotion-panel {
position: relative;
height: 0px;
&-box {
position: absolute;
top: -415px;
}
}
.content-bg { .content-bg {
background-color: #f7f7f7; background-color: #f7f7f7;
} }
......
...@@ -12,12 +12,31 @@ module.exports = { ...@@ -12,12 +12,31 @@ module.exports = {
response: { response: {
data_key: 'data', data_key: 'data',
message_key: 'message', message_key: 'message',
code_key: 'code', code_key: ['code', 'returnCode'],
code_success_value: '0', code_success_value: '0',
errId_logout_value: '21',
code_message_map: {} code_message_map: {}
}, },
request: { request: {
baseURL: 'http://192.168.1.254', baseURL: 'http://scrm.dev.glsx.com.cn',
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
request_tag: {
baseURL: 'http://ismv.branch.glsx.com.cn',
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
request_common: {
baseURL: 'https://qcdidicb.glsx.net:7060',
// 设置超时时间 // 设置超时时间
timeout: 180000, timeout: 180000,
// 携带凭证 // 携带凭证
...@@ -31,7 +50,13 @@ module.exports = { ...@@ -31,7 +50,13 @@ module.exports = {
format: 'json', format: 'json',
source: '' source: ''
}, },
sign_common: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0',
format: 'json',
source: ''
},
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b', secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
cdn: 'https://www.xxx.cn/static' cdn: 'https://www.xxx.cn/static'
} }
\ No newline at end of file \ No newline at end of file
...@@ -12,15 +12,16 @@ let cfg = require('./conf.js') ...@@ -12,15 +12,16 @@ let cfg = require('./conf.js')
import { Http } from 'glsx-common' import { Http } from 'glsx-common'
let timeout = 30000 //超时时间 let timeout = 30000 //超时时间
export const fetchConfig = function(isEnv = true) { export const fetchConfig = function(isEnv = true) {
// if (isEnv) { if (isEnv) {
// let { request } = cfg let { request } = cfg
// Object.assign(request, { timeout }) Object.assign(request, { timeout })
// return Promise.resolve(cfg) return Promise.resolve(cfg)
// } }
return new Http({request: { timeout: 100000}}).get(' https://oss-config.test.glsx.com.cn/mock/618a32851072f92988f05a17/drainage/config') return new Http({ request: { timeout: 100000 } }).get('https://oss-config.test.glsx.com.cn/mock/618a32851072f92988f05a17/drainage/config')
// return new Http({ request: { timeout: 100000 } }).get('https://oss-config.dev.glsx.com.cn/mock/618a32851072f92988f05a17/drainage/config')
} }
export const config = { export const config = {
install(vue, cfg) {
vue.prototype.$config = cfg
}
}
\ No newline at end of file \ No newline at end of file
install(vue, cfg) {
vue.prototype.$config = cfg
}
}
...@@ -10,12 +10,18 @@ ...@@ -10,12 +10,18 @@
import Vue from 'vue' import Vue from 'vue'
import apis from './api' import apis from './api'
import './public-path' import './public-path'
import './components'
import filters from './utils/filters'
// import 'glsx-components/dist/glsx-components.css' // import 'glsx-components/dist/glsx-components.css'
import { start } from '@/setup' import { start } from '@/setup'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$apis = apis Vue.prototype.$apis = apis
//过滤器统一处理预加载
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
start() start()
export { bootstrap, mount, unmount } export { bootstrap, mount, unmount } from '@/setup'
from '@/setup'
export const http = params => Vue.prototype.$http(params) export const http = params => Vue.prototype.$http(params)
export const http_common = params => Vue.prototype.$http_common(params)
\ No newline at end of file \ No newline at end of file
export const http_common = params => Vue.prototype.$http_common(params)
export const http_tag = params => Vue.prototype.$http_tag(params)
const ATT_TYPE = {
TEXT: 1,
IMAGE: 2,
VEDIO: 3,
URL: 4,
MINIPROGRAM: 5,
FILE: 6,
ACTIVITY: 7,
MATERIAL: 10
}
export default {
data() {
return {
btnList: [
{
name: '表情',
funcName: '',
type: 'expression',
limitSize: 10
},
{
name: '图片',
funcName: '',
type: 'img',
// togetherItem: [ATT_TYPE.TEXT], //只允许文本和图片
// limitSize: 10, //限制图片大小
// limitNum: 2, //限制图片数量
// limitWidth: 10000, //限制单张图片宽度
// limitHeight: 10000,//限制单张图片高度
// Isdraggable: true, //图片拖拽
uploadApi: this.$apis.common.pictureUpload
},
{
name: '昵称',
type: 'nickname',
funName: 'nickname'
},
{
name: '活动',
type: 'activity',
funName: 'activity',
funParams: [
{
itemName: '权益卡试用',
itemValue: 3,
itemType: 'card',
getInterfaceApi: this.$apis.welcomeword.getCard,
params: {
tryAble: 1,
merchantId: this.$globalState.session.merchantId
}
},
{
itemName: '权益套餐',
itemValue: 4,
itemType: 'package',
getInterfaceApi: this.$apis.welcomeword.getPackage,
params: {}
},
{
itemName: '商城券',
itemValue: 2,
itemType: 'coupon',
getInterfaceApi: this.$apis.welcomeword.getMerchant,
params: {
discountTypes: [2, 3, 4],
directionalFlag: 1, // 1所有人可用2定向礼包专用3关联优惠券
validType: 'valid'
}
},
{
itemName: '秒杀活动',
itemValue: 5,
itemType: 'activity',
getInterfaceApi: this.$apis.welcomeword.getActivity,
params: {
activityStatus: 2,
currentPage: 1
}
},
{
itemName: '无忧服务',
itemValue: 6,
itemType: 'merchant',
getInterfaceApi: this.$apis.welcomeword.merchant,
merchantOpen: {
merchantOpenApi: this.$apis.welcomeword.merchantOpen,
params: {
merchantId: this.$globalState.session.merchantId
}
},
params: {
merchantId: this.$globalState.session.merchantId
}
}
]
},
{
name: '素材',
type: 'material',
funName: 'material',
groupListApi: this.$apis.welcomeword.getGroupListApi,
materialListApi: this.$apis.welcomeword.getMaterialListApi
// videoNo: true,
// pdfNo: true
}
// {
// name: '模板',
// type: 'message',
// funName: 'message',
// getSearchApi: this.$apis.welcomeword.createdNameList,
// templateApi: this.$apis.welcomeword.templatePage,
// templateUpdateApi: this.$apis.welcomeword.templateUpdate,
// templateSaveApi: this.$apis.welcomeword.templateSave,
// templateDetailApi: this.$apis.welcomeword.templateDetail
// }
]
}
}
}
const staticRoutes = Object.freeze([{ const staticRoutes = Object.freeze([
{
name: 'channel', name: 'channel',
path: '/channel/index', path: '/channel/index',
component: resolve => require([`@/views/channel/index.vue`], resolve), component: resolve => require([`@/views/channel/index.vue`], resolve),
meta: {}, meta: {}
}, { },
{
name: 'channel', name: 'channel',
path: '/channel/store/:id/:codeUuid/:codeState', path: '/channel/store/:id/:codeUuid/:codeState',
component: resolve => require([`@/views/channel/store.vue`], resolve), component: resolve => require([`@/views/channel/store.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'addCode', name: 'addCode',
path: '/channel/addCode/:id/:codeUuid', path: '/channel/addCode/:id/:codeUuid',
component: resolve => require([`@/views/channel/addCode.vue`], resolve), component: resolve => require([`@/views/channel/addCode.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'poster', name: 'poster',
path: '/channel/poster/:id', path: '/channel/poster/:id',
component: resolve => require([`@/views/channel/poster.vue`], resolve), component: resolve => require([`@/views/channel/poster.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'square', name: 'square',
path: '/square/index', path: '/square/index',
component: resolve => require([`@/views/square/index.vue`], resolve), component: resolve => require([`@/views/square/index.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'import', name: 'import',
path: '/square/import', path: '/square/import',
component: resolve => require([`@/views/square/import.vue`], resolve), component: resolve => require([`@/views/square/import.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'customDetail',
path: '/square/customDetail',
component: resolve => require([`@/views/square/customDetail.vue`], resolve),
meta: {}
},
{
name: 'importResult', name: 'importResult',
path: '/square/importResult/:id', path: '/square/importResult/:id',
component: resolve => require([`@/views/square/importResult.vue`], resolve), component: resolve => require([`@/views/square/importResult.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'drainage', name: 'drainage',
path: '/square/drainage', path: '/square/drainage',
component: resolve => require([`@/views/square/drainage.vue`], resolve), component: resolve => require([`@/views/square/drainage.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'market', name: 'market',
path: '/market/index', path: '/market/index',
component: resolve => require([`@/views/market/index.vue`], resolve), component: resolve => require([`@/views/market/index.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'config', name: 'config',
path: '/market/config/:id?', path: '/market/config',
component: resolve => require([`@/views/market/config.vue`], resolve), component: resolve => require([`@/views/market/config.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'configDetail',
path: '/market/configDetail/:id?',
component: resolve => require([`@/views/market/configDetail.vue`], resolve),
meta: {}
},
{
name: 'effect',
path: '/market/effect/:id?',
component: resolve => require([`@/views/market/effect.vue`], resolve),
meta: {}
},
{
name: 'overview', name: 'overview',
path: '/overview/index', path: '/overview/index',
component: resolve => require([`@/views/overview/index.vue`], resolve), component: resolve => require([`@/views/overview/index.vue`], resolve),
meta: {} meta: {}
}, { },
{
name: 'friends', name: 'friends',
path: '/friends/index/:id', path: '/friends/index/:id',
component: resolve => require([`@/views/friends/index.vue`], resolve), component: resolve => require([`@/views/friends/index.vue`], resolve),
meta: { permissions: ['新增'] } meta: { permissions: ['新增'] }
}])
export default staticRoutes
\ No newline at end of file \ No newline at end of file
}
])
export default staticRoutes
...@@ -2,49 +2,56 @@ import Vue from 'vue' ...@@ -2,49 +2,56 @@ import Vue from 'vue'
// import { message } from '@/plugins/element.js' // import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config' import { fetchConfig } from '@/config'
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import { GLTable} from 'glsx-components' //权限按钮 (根据权限动态创建) import { GLTable, GLButton, GLFooter, GLCombiForm, GLDialog } from 'glsx-components' //权限按钮 (根据权限动态创建)
import GLButton from 'glsx-components/src/packages/Button' import GLEditor from 'glsx-components/src/packages/Editor' //权限按钮 (根据权限动态创建)
import GLFull from '@/components/GLFull'
import { getRoutes } from '@/router' import { getRoutes } from '@/router'
import render from './render' import render from './render'
Vue.use(ElementUI) Vue.use(ElementUI)
Vue.use(GLTable) Vue.use(GLTable)
Vue.use(GLFooter)
Vue.use(GLCombiForm)
Vue.use(GLDialog)
// Vue.use(GLFull)
// import GLTable from '@/components/glsx-table/index' // import GLTable from '@/components/glsx-table/index'
// Vue.component('GLTable', GLTable) Vue.component('GLEditor', GLEditor)
import 'glsx-components/src/theme/theme.scss' Vue.component('GLFull', GLFull)
// import 'glsx-components/src/theme/theme.scss'
import 'glsx-components/dist/glsx-components.css'
import '@/assets/css/common.scss' import '@/assets/css/common.scss'
let routes = [] let routes = []
let router = null let router = null
let instance = null let instance = null
export async function bootstrap({ name, id, history, common, messenger, globalState,routerBase }) { export async function bootstrap({ name, id, history, common, messenger, globalState, routerBase }) {
const { response, request, sign, secret, request_common, sign_common } = await fetchConfig() const { response, request, sign, secret, request_common, sign_common, request_tag } = await fetchConfig(false)
Vue.prototype.$history = history Vue.prototype.$history = history
Vue.prototype.$messenger = messenger Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState Vue.prototype.$globalState = globalState
Vue.prototype.$common = common Vue.prototype.$common = common
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: ElementUI.Message.error, headers: { token: globalState.session.token } }) Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: ElementUI.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.$http_tag = new common.Http({ response, request: request_tag, sign, secret, alert: ElementUI.Message.error, headers: { token: globalState.session.token } })
const routesData = common.utils.deepClone(globalState.routers) 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 } })
routes = getRoutes(routesData) const routesData = common.utils.deepClone(globalState.routers)
subscribe({ messenger }) routes = getRoutes(routesData)
console.log(routes,routesData) subscribe({ messenger })
Vue.use(GLButton, { routes, routerBase}) Vue.use(GLButton, { routes, routerBase })
} }
export async function mount(props) { export async function mount(props) {
console.log('11111', props) console.log('11111', props)
const insts = render(props.routerBase, routes) const insts = render(props.routerBase, routes)
router = insts.router router = insts.router
instance = insts.vm instance = insts.vm
} }
export async function unmount() { export async function unmount() {
instance.$destroy() instance.$destroy()
instance.$el.innerHTML = '' instance.$el.innerHTML = ''
instance = null instance = null
router = null router = null
} }
function subscribe({ messenger }) { function subscribe({ messenger }) {
messenger.subscribe(v => {
console.log(`监听到子应用${v.from}发来消息:`, v)
})
}
\ No newline at end of file \ No newline at end of file
messenger.subscribe(v => {
console.log(`监听到子应用${v.from}发来消息:`, v)
})
}
...@@ -12,19 +12,19 @@ import Vue from 'vue' ...@@ -12,19 +12,19 @@ import Vue from 'vue'
import store from '@/store' import store from '@/store'
import { VueRouter } from '@/router' import { VueRouter } from '@/router'
const render = (base, routes) => { const render = (base, routes) => {
const router = new VueRouter({ const router = new VueRouter({
base, base,
routes, routes,
mode: 'history' mode: 'history'
}) })
router.afterEach(() => { router.afterEach(() => {
document.querySelector("#app").scrollTop = 0; document.querySelector('#app').scrollTop = 0
}) })
const vm = new Vue({ const vm = new Vue({
router, router,
store, store,
render: h => h(App) render: h => h(App)
}).$mount('#app') }).$mount('#app')
return { router, vm } return { router, vm }
} }
export default render
\ No newline at end of file \ No newline at end of file
export default render
...@@ -17,6 +17,7 @@ const modules = modulesFiles.keys().reduce( ...@@ -17,6 +17,7 @@ const modules = modulesFiles.keys().reduce(
const value = modulesFiles(modulePath) const value = modulesFiles(modulePath)
result.getters[moduleName] = state => state[moduleName] result.getters[moduleName] = state => state[moduleName]
result.modules[moduleName] = value.default result.modules[moduleName] = value.default
console.log(result)
return result return result
}, },
{ modules: {}, getters: {} } { modules: {}, getters: {} }
......
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
importData: { importData: {},
uploadInfo: null
}
}, },
mutations: { mutations: {
SET_IMPORT(state, data) { SET_IMPORT(state, data) {
state.importData = data state.importData = data
}, },
SET_UPLOAD_INFO(state, data) {
state.uploadInfo = data
}
}, },
actions: { actions: {
setImport({ commit }, data) { setImport({ commit }, data) {
commit('SET_IMPORT', data) commit('SET_IMPORT', data)
}, },
setUploadInfo({ commit }, data) {
commit('SET_UPLOAD_INFO', data)
}
} }
} }
import { isFunction } from './fns' import { isFunction } from './fns'
export function matchesSelectorToParentElements (el, selector, baseNode) { export function matchesSelectorToParentElements(el, selector, baseNode) {
let node = el let node = el
const matchesSelectorFunc = [ const matchesSelectorFunc = ['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'].find(func => isFunction(node[func]))
'matches',
'webkitMatchesSelector',
'mozMatchesSelector',
'msMatchesSelector',
'oMatchesSelector'
].find(func => isFunction(node[func]))
if (!isFunction(node[matchesSelectorFunc])) return false if (!isFunction(node[matchesSelectorFunc])) return false
...@@ -22,16 +16,13 @@ export function matchesSelectorToParentElements (el, selector, baseNode) { ...@@ -22,16 +16,13 @@ export function matchesSelectorToParentElements (el, selector, baseNode) {
return false return false
} }
export function getComputedSize ($el) { export function getComputedSize($el) {
const style = window.getComputedStyle($el) const style = window.getComputedStyle($el)
return [ return [parseFloat(style.getPropertyValue('width'), 10), parseFloat(style.getPropertyValue('height'), 10)]
parseFloat(style.getPropertyValue('width'), 10),
parseFloat(style.getPropertyValue('height'), 10)
]
} }
export function addEvent (el, event, handler) { export function addEvent(el, event, handler) {
if (!el) { if (!el) {
return return
} }
...@@ -44,7 +35,7 @@ export function addEvent (el, event, handler) { ...@@ -44,7 +35,7 @@ export function addEvent (el, event, handler) {
} }
} }
export function removeEvent (el, event, handler) { export function removeEvent(el, event, handler) {
if (!el) { if (!el) {
return return
} }
......
const emoji = [
['微笑', '撇嘴', '色', '发呆', '得意', '流泪', '害羞', '闭嘴'],
['睡', '大哭', '尴尬', '发怒', '调皮', '呲牙', '惊讶', '难过'],
['酷', '囧', '抓狂', '吐', '微笑', '愉快', '白眼', '傲慢'],
['饥饿', '困', '惊恐', '流汗', '憨笑', '大兵', '奋斗', '咒骂'],
['疑问', '嘘', '晕', '折磨', '衰', '骷髅', '敲打', '再见'],
['擦汗', '抠鼻', '鼓掌', '糗大了', '坏笑', '左哼哼', '右哼哼', '哈欠'],
['鄙视', '委屈', '快哭了', '阴险', '亲亲', '吓', '可怜', '菜刀'],
['西瓜', '啤酒', '篮球', '乒乓', '咖啡', '饭', '猪头', '玫瑰'],
['凋谢', '示爱', '爱心', '心碎', '蛋糕', '闪电', '炸弹', '刀'],
['足球', '瓢虫', '便便', '月亮', '太阳', '礼物', '拥抱', '强'],
['弱', '握手', '胜利', '抱拳', '勾引', '拳头', '差劲', '爱你'],
['NO', 'OK', '爱情', '飞吻', '跳跳', '发抖', '怄火', '转圈'],
['磕头', '回头', '跳绳', '投降', '挥手', '激动', '街舞', '左太极'],
['右太极', '嘿哈', '捂脸', '奸笑', '机智', '皱眉', '耶', '社会社会'],
['让我看看', '666', '红包', '蜡烛', '烟花', '福', '庆祝', '爆竹']
]
export default emoji
//过滤器
/* eslint-disable */
const overThousandFilter = val => {
if (typeof val != 'number') {
return 0
}
if (val < 1000) return val
let a = val + ''
let b = a.split('')
b.splice(-3, 0, ',')
return b.join('')
}
export default {
overThousandFilter
}
export function isFunction (func) { export function isFunction(func) {
return (typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]') return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]'
} }
export function snapToGrid (grid, pendingX, pendingY, scale = 1) { export function snapToGrid(grid, pendingX, pendingY, scale = 1) {
const [scaleX, scaleY] = typeof scale === 'number' ? [scale, scale] : scale const [scaleX, scaleY] = typeof scale === 'number' ? [scale, scale] : scale
const x = Math.round((pendingX / scaleX) / grid[0]) * grid[0] const x = Math.round(pendingX / scaleX / grid[0]) * grid[0]
const y = Math.round((pendingY / scaleY) / grid[1]) * grid[1] const y = Math.round(pendingY / scaleY / grid[1]) * grid[1]
return [x, y] return [x, y]
} }
export function getSize (el) { export function getSize(el) {
const rect = el.getBoundingClientRect() const rect = el.getBoundingClientRect()
return [ return [parseInt(rect.width), parseInt(rect.height)]
parseInt(rect.width),
parseInt(rect.height)
]
} }
export function computeWidth (parentWidth, left, right) { export function computeWidth(parentWidth, left, right) {
return parentWidth - left - right return parentWidth - left - right
} }
export function computeHeight (parentHeight, top, bottom) { export function computeHeight(parentHeight, top, bottom) {
return parentHeight - top - bottom return parentHeight - top - bottom
} }
export function restrictToBounds (value, min, max) { export function restrictToBounds(value, min, max) {
if (min !== null && value < min) { if (min !== null && value < min) {
return min return min
} }
......
/*
* JavaScript MD5
* https://github.com/blueimp/JavaScript-MD5
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*
* Based on
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/* global define */
;(function ($) {
'use strict'
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safeAdd (x, y) {
var lsw = (x & 0xffff) + (y & 0xffff)
var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
return (msw << 16) | (lsw & 0xffff)
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function bitRotateLeft (num, cnt) {
return (num << cnt) | (num >>> (32 - cnt))
}
/*
* These functions implement the four basic operations the algorithm uses.
*/
function md5cmn (q, a, b, x, s, t) {
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b)
}
function md5ff (a, b, c, d, x, s, t) {
return md5cmn((b & c) | (~b & d), a, b, x, s, t)
}
function md5gg (a, b, c, d, x, s, t) {
return md5cmn((b & d) | (c & ~d), a, b, x, s, t)
}
function md5hh (a, b, c, d, x, s, t) {
return md5cmn(b ^ c ^ d, a, b, x, s, t)
}
function md5ii (a, b, c, d, x, s, t) {
return md5cmn(c ^ (b | ~d), a, b, x, s, t)
}
/*
* Calculate the MD5 of an array of little-endian words, and a bit length.
*/
function binlMD5 (x, len) {
/* append padding */
x[len >> 5] |= 0x80 << (len % 32)
x[((len + 64) >>> 9 << 4) + 14] = len
var i
var olda
var oldb
var oldc
var oldd
var a = 1732584193
var b = -271733879
var c = -1732584194
var d = 271733878
for (i = 0; i < x.length; i += 16) {
olda = a
oldb = b
oldc = c
oldd = d
a = md5ff(a, b, c, d, x[i], 7, -680876936)
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586)
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819)
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330)
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897)
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426)
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341)
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983)
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416)
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417)
c = md5ff(c, d, a, b, x[i + 10], 17, -42063)
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162)
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682)
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101)
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290)
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329)
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510)
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632)
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713)
b = md5gg(b, c, d, a, x[i], 20, -373897302)
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691)
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083)
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335)
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848)
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438)
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690)
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961)
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501)
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467)
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784)
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473)
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734)
a = md5hh(a, b, c, d, x[i + 5], 4, -378558)
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463)
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562)
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556)
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060)
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353)
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632)
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640)
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174)
d = md5hh(d, a, b, c, x[i], 11, -358537222)
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979)
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189)
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487)
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835)
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520)
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651)
a = md5ii(a, b, c, d, x[i], 6, -198630844)
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415)
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905)
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055)
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571)
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606)
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523)
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799)
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359)
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744)
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380)
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649)
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070)
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379)
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259)
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551)
a = safeAdd(a, olda)
b = safeAdd(b, oldb)
c = safeAdd(c, oldc)
d = safeAdd(d, oldd)
}
return [a, b, c, d]
}
/*
* Convert an array of little-endian words to a string
*/
function binl2rstr (input) {
var i
var output = ''
var length32 = input.length * 32
for (i = 0; i < length32; i += 8) {
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff)
}
return output
}
/*
* Convert a raw string to an array of little-endian words
* Characters >255 have their high-byte silently ignored.
*/
function rstr2binl (input) {
var i
var output = []
output[(input.length >> 2) - 1] = undefined
for (i = 0; i < output.length; i += 1) {
output[i] = 0
}
var length8 = input.length * 8
for (i = 0; i < length8; i += 8) {
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32)
}
return output
}
/*
* Calculate the MD5 of a raw string
*/
function rstrMD5 (s) {
return binl2rstr(binlMD5(rstr2binl(s), s.length * 8))
}
/*
* Calculate the HMAC-MD5, of a key and some data (raw strings)
*/
function rstrHMACMD5 (key, data) {
var i
var bkey = rstr2binl(key)
var ipad = []
var opad = []
var hash
ipad[15] = opad[15] = undefined
if (bkey.length > 16) {
bkey = binlMD5(bkey, key.length * 8)
}
for (i = 0; i < 16; i += 1) {
ipad[i] = bkey[i] ^ 0x36363636
opad[i] = bkey[i] ^ 0x5c5c5c5c
}
hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8)
return binl2rstr(binlMD5(opad.concat(hash), 512 + 128))
}
/*
* Convert a raw string to a hex string
*/
function rstr2hex (input) {
var hexTab = '0123456789abcdef'
var output = ''
var x
var i
for (i = 0; i < input.length; i += 1) {
x = input.charCodeAt(i)
output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f)
}
return output
}
/*
* Encode a string as utf-8
*/
function str2rstrUTF8 (input) {
return unescape(encodeURIComponent(input))
}
/*
* Take string arguments and return either raw or hex encoded strings
*/
function rawMD5 (s) {
return rstrMD5(str2rstrUTF8(s))
}
function hexMD5 (s) {
return rstr2hex(rawMD5(s))
}
function rawHMACMD5 (k, d) {
return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d))
}
function hexHMACMD5 (k, d) {
return rstr2hex(rawHMACMD5(k, d))
}
function md5 (string, key, raw) {
if (!key) {
if (!raw) {
return hexMD5(string)
}
return rawMD5(string)
}
if (!raw) {
return hexHMACMD5(key, string)
}
return rawHMACMD5(key, string)
}
if (typeof define === 'function' && define.amd) {
define(function () {
return md5
})
} else if (typeof module === 'object' && module.exports) {
module.exports = md5
} else {
$.md5 = md5
}
})(this)
import MD5 from 'js-md5'
const sign = (params, noSignAttr = []) => {
delete params.sign
const secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const keys = Object.keys(params).sort()
var str = []
// for (const key in params) {
// if (typeof params[key] === 'object') params[key] = JSON.stringify(params[key])
// }
var obj = null
for (const key in params) {
obj = params[key]
if (obj === null || obj === undefined) {
obj = ''
} else if (typeof obj === 'object') {
obj = JSON.stringify(obj)
}
params[key] = obj
}
keys.forEach(e => {
!noSignAttr.includes(e) && str.push(e + params[e])
})
params.sign = MD5(secret + str.join('') + secret)
return params
}
export default sign
(function(factory){if(typeof exports==="object"){module.exports=factory()}else if(typeof define==="function"&&define.amd){define(factory)}else{var glob;try{glob=window}catch(e){glob=self}glob.SparkMD5=factory()}})(function(undefined){"use strict";var add32=function(a,b){return a+b&4294967295},hex_chr=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function cmn(q,a,b,x,s,t){a=add32(add32(a,q),add32(x,t));return add32(a<<s|a>>>32-s,b)}function md5cycle(x,k){var a=x[0],b=x[1],c=x[2],d=x[3];a+=(b&c|~b&d)+k[0]-680876936|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[1]-389564586|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[2]+606105819|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[3]-1044525330|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[4]-176418897|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[5]+1200080426|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[6]-1473231341|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[7]-45705983|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[8]+1770035416|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[9]-1958414417|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[10]-42063|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[11]-1990404162|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[12]+1804603682|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[13]-40341101|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[14]-1502002290|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[15]+1236535329|0;b=(b<<22|b>>>10)+c|0;a+=(b&d|c&~d)+k[1]-165796510|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[6]-1069501632|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[11]+643717713|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[0]-373897302|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[5]-701558691|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[10]+38016083|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[15]-660478335|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[4]-405537848|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[9]+568446438|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[14]-1019803690|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[3]-187363961|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[8]+1163531501|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[13]-1444681467|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[2]-51403784|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[7]+1735328473|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[12]-1926607734|0;b=(b<<20|b>>>12)+c|0;a+=(b^c^d)+k[5]-378558|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[8]-2022574463|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[11]+1839030562|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[14]-35309556|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[1]-1530992060|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[4]+1272893353|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[7]-155497632|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[10]-1094730640|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[13]+681279174|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[0]-358537222|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[3]-722521979|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[6]+76029189|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[9]-640364487|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[12]-421815835|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[15]+530742520|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[2]-995338651|0;b=(b<<23|b>>>9)+c|0;a+=(c^(b|~d))+k[0]-198630844|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[7]+1126891415|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[14]-1416354905|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[5]-57434055|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[12]+1700485571|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[3]-1894986606|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[10]-1051523|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[1]-2054922799|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[8]+1873313359|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[15]-30611744|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[6]-1560198380|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[13]+1309151649|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[4]-145523070|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[11]-1120210379|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[2]+718787259|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[9]-343485551|0;b=(b<<21|b>>>11)+c|0;x[0]=a+x[0]|0;x[1]=b+x[1]|0;x[2]=c+x[2]|0;x[3]=d+x[3]|0}function md5blk(s){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=s.charCodeAt(i)+(s.charCodeAt(i+1)<<8)+(s.charCodeAt(i+2)<<16)+(s.charCodeAt(i+3)<<24)}return md5blks}function md5blk_array(a){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=a[i]+(a[i+1]<<8)+(a[i+2]<<16)+(a[i+3]<<24)}return md5blks}function md51(s){var n=s.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk(s.substring(i-64,i)))}s=s.substring(i-64);length=s.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=s.charCodeAt(i)<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function md51_array(a){var n=a.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk_array(a.subarray(i-64,i)))}a=i-64<n?a.subarray(i-64):new Uint8Array(0);length=a.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=a[i]<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function rhex(n){var s="",j;for(j=0;j<4;j+=1){s+=hex_chr[n>>j*8+4&15]+hex_chr[n>>j*8&15]}return s}function hex(x){var i;for(i=0;i<x.length;i+=1){x[i]=rhex(x[i])}return x.join("")}if(hex(md51("hello"))!=="5d41402abc4b2a76b9719d911017c592"){add32=function(x,y){var lsw=(x&65535)+(y&65535),msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}}if(typeof ArrayBuffer!=="undefined"&&!ArrayBuffer.prototype.slice){(function(){function clamp(val,length){val=val|0||0;if(val<0){return Math.max(val+length,0)}return Math.min(val,length)}ArrayBuffer.prototype.slice=function(from,to){var length=this.byteLength,begin=clamp(from,length),end=length,num,target,targetArray,sourceArray;if(to!==undefined){end=clamp(to,length)}if(begin>end){return new ArrayBuffer(0)}num=end-begin;target=new ArrayBuffer(num);targetArray=new Uint8Array(target);sourceArray=new Uint8Array(this,begin,num);targetArray.set(sourceArray);return target}})()}function toUtf8(str){if(/[\u0080-\uFFFF]/.test(str)){str=unescape(encodeURIComponent(str))}return str}function utf8Str2ArrayBuffer(str,returnUInt8Array){var length=str.length,buff=new ArrayBuffer(length),arr=new Uint8Array(buff),i;for(i=0;i<length;i+=1){arr[i]=str.charCodeAt(i)}return returnUInt8Array?arr:buff}function arrayBuffer2Utf8Str(buff){return String.fromCharCode.apply(null,new Uint8Array(buff))}function concatenateArrayBuffers(first,second,returnUInt8Array){var result=new Uint8Array(first.byteLength+second.byteLength);result.set(new Uint8Array(first));result.set(new Uint8Array(second),first.byteLength);return returnUInt8Array?result:result.buffer}function hexToBinaryString(hex){var bytes=[],length=hex.length,x;for(x=0;x<length-1;x+=2){bytes.push(parseInt(hex.substr(x,2),16))}return String.fromCharCode.apply(String,bytes)}function SparkMD5(){this.reset()}SparkMD5.prototype.append=function(str){this.appendBinary(toUtf8(str));return this};SparkMD5.prototype.appendBinary=function(contents){this._buff+=contents;this._length+=contents.length;var length=this._buff.length,i;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk(this._buff.substring(i-64,i)))}this._buff=this._buff.substring(i-64);return this};SparkMD5.prototype.end=function(raw){var buff=this._buff,length=buff.length,i,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff.charCodeAt(i)<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.prototype.reset=function(){this._buff="";this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}};SparkMD5.prototype.setState=function(state){this._buff=state.buff;this._length=state.length;this._hash=state.hash;return this};SparkMD5.prototype.destroy=function(){delete this._hash;delete this._buff;delete this._length};SparkMD5.prototype._finish=function(tail,length){var i=length,tmp,lo,hi;tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(this._hash,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=this._length*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(this._hash,tail)};SparkMD5.hash=function(str,raw){return SparkMD5.hashBinary(toUtf8(str),raw)};SparkMD5.hashBinary=function(content,raw){var hash=md51(content),ret=hex(hash);return raw?hexToBinaryString(ret):ret};SparkMD5.ArrayBuffer=function(){this.reset()};SparkMD5.ArrayBuffer.prototype.append=function(arr){var buff=concatenateArrayBuffers(this._buff.buffer,arr,true),length=buff.length,i;this._length+=arr.byteLength;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk_array(buff.subarray(i-64,i)))}this._buff=i-64<length?new Uint8Array(buff.buffer.slice(i-64)):new Uint8Array(0);return this};SparkMD5.ArrayBuffer.prototype.end=function(raw){var buff=this._buff,length=buff.length,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i,ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff[i]<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.ArrayBuffer.prototype.reset=function(){this._buff=new Uint8Array(0);this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.ArrayBuffer.prototype.getState=function(){var state=SparkMD5.prototype.getState.call(this);state.buff=arrayBuffer2Utf8Str(state.buff);return state};SparkMD5.ArrayBuffer.prototype.setState=function(state){state.buff=utf8Str2ArrayBuffer(state.buff,true);return SparkMD5.prototype.setState.call(this,state)};SparkMD5.ArrayBuffer.prototype.destroy=SparkMD5.prototype.destroy;SparkMD5.ArrayBuffer.prototype._finish=SparkMD5.prototype._finish;SparkMD5.ArrayBuffer.hash=function(arr,raw){var hash=md51_array(new Uint8Array(arr)),ret=hex(hash);return raw?hexToBinaryString(ret):ret};return SparkMD5});
import MD5 from 'md5'
var w = {}
let uploadInfo = {}
let that = {}
const options = {
showprocess: true,
action: '',
tips: '',
size: 2,
url: '',
success: ''
}
that.config = {
id: '',
token: '',
app_key: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0',
format: 'json',
url: 'http://qcdidicb.glsx.com.cn:7060/router',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
}
/**
* 参数序列化
*/
uploadInfo.formRequestData = function(data) {
var _sendstr = null
if (data) {
_sendstr = ''
for (var i in data) {
_sendstr += (_sendstr ? '&' : '') + i + '=' + encodeURIComponent(data[i])
}
}
return _sendstr
}
/**
* 检查文件是否上传
*/
/**
* 文件切片
*/
uploadInfo.fileSlice = function(oParams) {
if (!oParams) {
return false
}
var o = options
var file = oParams.file
var cellBlod = []
var cell = Number(o.size) * 1024 * 1024 //单个分片的大小
var size = oParams.size //文件大小
var num = Math.ceil(size / cell) //计算分片的个数
if (num == 1) {
cellBlod.push(file)
} else {
for (var i = 0; i < num; i++) {
var s = i * cell
var e = (i + 1) * cell
var m = ''
if (file.slice) {
m = file.slice(s, e)
}
//兼容firefox
if (file.mozSlice) {
m = file.mozSlice(s, e)
}
// 兼容webkit
if (file.webkitSlice) {
m = file.webkitSlice(s, e)
}
cellBlod.push(m)
}
}
return cellBlod
}
/**
* 获取文件类型
*/
uploadInfo.getFileType = function(file) {
if (!file) {
return false
}
var arr = file.split('.')
return arr[arr.length - 1]
}
/**
* arrbuffer转换成base64
*/
uploadInfo.transformArrayBufferToBase64 = function(buffer) {
var binary = ''
var bytes = new Uint8Array(buffer)
for (var len = bytes.byteLength, i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i])
}
return window.btoa(binary)
}
/**
* 生成签名
*/
uploadInfo.createSign = function(params) {
var secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
var noSignAttr = []
delete params.sign
noSignAttr.push('refreshTable')
var keys = Object.keys(params).sort()
var str = []
var obj = null
for (const key in params) {
obj = params[key]
if (obj === null || obj === undefined) {
obj = ''
} else if (typeof obj === 'object') {
obj = JSON.stringify(obj)
}
params[key] = obj
}
keys.forEach(e => {
!noSignAttr.includes(e) && str.push(e + params[e])
})
params.sign = MD5(secret + str.join('') + secret)
return params
}
/**
* 获取参数
*/
uploadInfo.getParams = function(index, oInfo) {
var o = that.options
var k = that.config
var oParams = {}
var len = w.list.length
var size = Number(o.size * 1024 * 1024)
// console.log(o.size)
// console.log(w);
// console.log('个数:' + w.list.length);
// console.log('当前个数' + index)
if (len > 1 && index == len - 1) {
size = w.fileSize - o.size * 1024 * 1024 * (w.list.length - 2)
}
//只有一个分片
if (w.list.length == 1) {
size = w.fileSize
}
var spark = new MD5()
spark.append(oInfo)
oParams.app_key = k.app_key
oParams.v = k.v
oParams.timestamp = new Date().getTime()
oParams.format = k.format
oParams.source = '2323242323'
oParams.method = 'glsx.accounts.biz.common.uploadFileWithFileInfo'
oParams.token = w.token
oParams.number = index + 1
oParams.fileType = w.fileType
oParams.fileName = w.fileName
oParams.fileSize = w.fileSize
oParams.fileFragmentSize = size
oParams.fileUpSum = w.list.length
oParams.fileMD5 = w.fileMD5
oParams.fragmentMD5 = spark.end()
// for (let k in m) {
// oParams.append(k, m[k]);
// }
return uploadInfo.createSign(oParams)
}
export default uploadInfo
import { Message } from 'element-ui' import { Message } from 'element-ui'
let util = {} let util = {}
util.cloneText = function (message) { util.cloneText = function(message) {
let input = document.createElement('input') let input = document.createElement('input')
input.value = message input.value = message
document.body.appendChild(input) document.body.appendChild(input)
input.select() input.select()
input.setSelectionRange(0, input.value.length), document.execCommand('Copy') input.setSelectionRange(0, input.value.length), document.execCommand('Copy')
document.body.removeChild(input) document.body.removeChild(input)
Message.success('复制成功') Message.success('复制成功')
} }
util.getBeforeDate = function (sign = '-') { util.getBeforeDate = function(sign = '-') {
let day = new Date(); let day = new Date()
let month = day.getMonth() + 1; let month = day.getMonth() + 1
let date = day.getDate(); let date = day.getDate()
if (month < 10) month = '0' + month; if (month < 10) month = '0' + month
if (date < 10) date = '0' + date; if (date < 10) date = '0' + date
var s = day.getFullYear() + sign + month + sign + date; var s = day.getFullYear() + sign + month + sign + date
return s; return s
} }
util.getBeforeMonth = function (days) { util.getBeforeMonth = function(days) {
let month = new Date().getMonth() + 1; let month = new Date().getMonth() + 1
let year = new Date().getFullYear(); let year = new Date().getFullYear()
let arr = new Array(); let arr = new Array()
for (let i = 0; i < days; i++) { for (let i = 0; i < days; i++) {
if (month <= 0) { if (month <= 0) {
year = year - 1; year = year - 1
month = month + 12; month = month + 12
}
if (month < 10) month = '0' + month;
arr[i] = year + '年' + month + '月'
month--
} }
return arr; if (month < 10) month = '0' + month
arr[i] = year + '年' + month + '月'
month--
}
return arr
} }
/** /**
* 格式化时间 * 格式化时间
* @param {Array} time * @param {Array} time
*/ */
util.formatTime = function (time) { util.formatTime = function(time) {
return { return {
startTime: time ? time[0] + ' ' + '00:00:00' : '', startTime: time ? time[0] + ' ' + '00:00:00' : '',
endTime: time ? time[1] + ' ' + '23:59:59' : '' endTime: time ? time[1] + ' ' + '23:59:59' : ''
} }
} }
util.tringToDate = function (dateStr, separator) { util.tringToDate = function(dateStr, separator) {
if (!separator) { if (!separator) {
separator = "-"; separator = '-'
} }
var dateArr = dateStr.split(separator); var dateArr = dateStr.split(separator)
var year = parseInt(dateArr[0]); var year = parseInt(dateArr[0])
var month; var month
//处理月份为04这样的情况 //处理月份为04这样的情况
if (dateArr[1].indexOf("0") == 0) { if (dateArr[1].indexOf('0') == 0) {
month = parseInt(dateArr[1].substring(1)); month = parseInt(dateArr[1].substring(1))
} else { } else {
month = parseInt(dateArr[1]); month = parseInt(dateArr[1])
} }
var day = parseInt(dateArr[2]); var day = parseInt(dateArr[2])
var date = new Date(year, month - 1, day); var date = new Date(year, month - 1, day)
return date; return date
}
util.getDay = function(num, str = '-') {
var today = new Date()
var nowTime = today.getTime()
var ms = 24 * 3600 * 1000 * num
today.setTime(parseInt(nowTime + ms))
var oYear = today.getFullYear()
var oMoth = (today.getMonth() + 1).toString()
if (oMoth.length <= 1) oMoth = '0' + oMoth
var oDay = today.getDate().toString()
if (oDay.length <= 1) oDay = '0' + oDay
return oYear + str + oMoth + str + oDay
}
util.openUrl = function(url) {
const link = document.createElement('a')
link.href = url
link.target = '_blank'
link.rel = 'opener'
link.click()
}
util.downloadUrl = function(url) {
const link = document.createElement('a')
link.href = url
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
} }
util.getDay = function (num, str = '-') { util.getArrayIsSubset = (arr2, arr1) => {
var today = new Date(); return arr1.every(item => {
var nowTime = today.getTime(); return arr2.includes(item)
var ms = 24 * 3600 * 1000 * num; })
today.setTime(parseInt(nowTime + ms));
var oYear = today.getFullYear();
var oMoth = (today.getMonth() + 1).toString();
if (oMoth.length <= 1) oMoth = '0' + oMoth;
var oDay = today.getDate().toString();
if (oDay.length <= 1) oDay = '0' + oDay;
return oYear + str + oMoth + str + oDay;
} }
util.downloadIamge = function (imgsrc, name = new Date().getTime()) { util.downloadIamge = function(imgsrc, name = new Date().getTime()) {
//下载图片地址和图片名 //下载图片地址和图片名
var image = new Image(); var image = new Image()
// 解决跨域 Canvas 污染问题 // 解决跨域 Canvas 污染问题
image.setAttribute("crossOrigin", "anonymous"); image.setAttribute('crossOrigin', 'anonymous')
image.onload = function () { image.onload = function() {
var canvas = document.createElement("canvas"); var canvas = document.createElement('canvas')
canvas.width = image.width; canvas.width = image.width
canvas.height = image.height; canvas.height = image.height
var context = canvas.getContext("2d"); var context = canvas.getContext('2d')
context.drawImage(image, 0, 0, image.width, image.height); context.drawImage(image, 0, 0, image.width, image.height)
var url = canvas.toDataURL("image/png"); //得到图片的base64编码数据 var url = canvas.toDataURL('image/png') //得到图片的base64编码数据
var a = document.createElement("a"); // 生成一个a元素 var a = document.createElement('a') // 生成一个a元素
var event = new MouseEvent("click"); // 创建一个单击事件 var event = new MouseEvent('click') // 创建一个单击事件
a.download = name || "photo"; // 设置图片名称 a.download = name || 'photo' // 设置图片名称
a.href = url; // 将生成的URL设置为a.href属性 a.href = url // 将生成的URL设置为a.href属性
a.dispatchEvent(event); // 触发a的单击事件 a.dispatchEvent(event) // 触发a的单击事件
}; }
image.src = imgsrc; image.src = imgsrc
} }
export default util
\ No newline at end of file \ No newline at end of file
export default util
...@@ -32,10 +32,11 @@ ...@@ -32,10 +32,11 @@
<span>{{ taggingLength }}</span> <span>{{ taggingLength }}</span>
个标签 个标签
</span> </span>
<div class="form-tips">自动为通过该活码添加的客户打上所选标签</div>
<div class="el-input-tag input-tag-wrapper" v-show="taggingLength"> <div class="el-input-tag input-tag-wrapper" v-show="taggingLength">
<template v-if="tagging && tagging.length > 0"> <template v-if="tagging && tagging.length > 0">
<template v-for="(item,index) in tagging"> <template v-for="(item, index) in tagging">
<el-tag type="info" v-for="(tag, idx) in item.labelList" :key="idx" closable :disable-transitions="false" @close="removeTag(item, idx,index)"> <el-tag type="info" v-for="(tag, idx) in item.labelList" :key="idx" closable :disable-transitions="false" @close="removeTag(item, idx, index)">
{{ tag ? tag.name : '' }} {{ tag ? tag.name : '' }}
</el-tag> </el-tag>
</template> </template>
...@@ -56,6 +57,7 @@ ...@@ -56,6 +57,7 @@
<span>{{ staffInfo.length }}</span> <span>{{ staffInfo.length }}</span>
人 人
</span> </span>
<div class="form-tips">客户扫码后将添加所选专员为好友,选择多名专员则按ABAB的顺序添加客户</div>
<div class="el-input-tag input-tag-wrapper" v-show="staffInfo.length"> <div class="el-input-tag input-tag-wrapper" v-show="staffInfo.length">
<el-tag effect="plain" type="info" v-for="(tag, idx) in staffInfo" :key="idx" closable :disable-transitions="false" @close="removeStaff(idx)"> <el-tag effect="plain" type="info" v-for="(tag, idx) in staffInfo" :key="idx" closable :disable-transitions="false" @close="removeStaff(idx)">
<i class="el-icon-user-solid"></i> <i class="el-icon-user-solid"></i>
...@@ -77,20 +79,16 @@ ...@@ -77,20 +79,16 @@
<el-switch v-model="autoWelcome" active-color="#5850FF" inactive-color="#999999"></el-switch> <el-switch v-model="autoWelcome" active-color="#5850FF" inactive-color="#999999"></el-switch>
</div> </div>
<div class="welcome-box" v-show="autoWelcome"> <div class="welcome-box" v-show="autoWelcome">
<welcome-words :eventBus="eventBus" ref="welcome"></welcome-words> <!-- <welcome-words :eventBus="eventBus" ref="welcome"></welcome-words> -->
<GLEditor ref="welcome" :form="'customer'" :btnList="btnList" @previewWord="previewForm"></GLEditor>
</div> </div>
</div> </div>
</div> </div>
<div <GLFooter>
class="footer-panel"
:style="{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<el-button type="primary" @click="handleSave">提交</el-button> <el-button type="primary" @click="handleSave">提交</el-button>
<el-button @click="goback">取消</el-button> <el-button @click="goback">取消</el-button>
</div> </GLFooter>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisible = false" type="warning" content="当前有内容信息未保存,是否继续返回?" :visible.sync="dialogVisible" mode="small"></GLDialog>
<select-emp @selectTable="selectTable" ref="selectEmpForm"></select-emp> <select-emp @selectTable="selectTable" ref="selectEmpForm"></select-emp>
<select-tag ref="selectTagForm" @tagSelected="tagSelected"></select-tag> <select-tag ref="selectTagForm" @tagSelected="tagSelected"></select-tag>
</div> </div>
...@@ -98,16 +96,16 @@ ...@@ -98,16 +96,16 @@
<script> <script>
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
import Vue from 'vue'
import selectEmp from '@/components/selectEmp' import selectEmp from '@/components/selectEmp'
import selectTag from '@/components/selectTag' import selectTag from '@/components/selectTag'
import welcomeWords from '@/components/welcome/welcomeWords.vue' import word from '@/mixins/word'
export default { export default {
mixins: [word],
name: 'addCode', name: 'addCode',
components: { welcomeWords, selectEmp, selectTag }, components: { selectEmp, selectTag },
data() { data() {
return { return {
eventBus: new Vue(), dialogVisible: false,
addCodeForm: { addCodeForm: {
codeName: '', codeName: '',
codeRemark: '', codeRemark: '',
...@@ -121,6 +119,8 @@ export default { ...@@ -121,6 +119,8 @@ export default {
footerLeft: 0, footerLeft: 0,
footerWidth: 0, footerWidth: 0,
autoWelcome: true, autoWelcome: true,
editStatus: false,
previewListStart: [],
codeRules: { codeRules: {
codeName: [{ required: true, message: '请输入渠道名称', trigger: 'blur' }] codeName: [{ required: true, message: '请输入渠道名称', trigger: 'blur' }]
} }
...@@ -133,18 +133,50 @@ export default { ...@@ -133,18 +133,50 @@ export default {
this.tagging.forEach(item => { this.tagging.forEach(item => {
this.taggingLength += item.labelList.length this.taggingLength += item.labelList.length
}) })
this.editStatus = true
},
deep: true
},
addCodeForm: {
handler() {
this.editStatus = true
},
deep: true
},
staffInfo: {
handler() {
this.editStatus = true
}, },
deep: true deep: true
} }
}, },
methods: { methods: {
goback() { goback() {
this.previewListStart.forEach(item => {
this.$refs.welcome.previewList.forEach(itm => {
if (item.attType == itm.attType) {
if (typeof item.attContent != 'object' && item.attContent != itm.attContent) {
this.editStatus = true
}
if (typeof item.attContent == 'object' && item.attContent.marketingName != itm.attContent.marketingName) {
this.editStatus = true
}
}
})
})
if (this.editStatus || (this.$refs.welcome.previewList.length > 0 && !this.codeId)) {
this.dialogVisible = true
} else {
this.$router.push('/channel/index')
}
},
handleSure() {
this.$router.push('/channel/index') this.$router.push('/channel/index')
}, },
removeTag(item, idx,index) { removeTag(item, idx, index) {
item.labelList.splice(idx, 1) item.labelList.splice(idx, 1)
if(item.labelList.length == 0) { if (item.labelList.length == 0) {
this.tagging.splice(index,1) this.tagging.splice(index, 1)
} }
}, },
removeStaff(index) { removeStaff(index) {
...@@ -168,7 +200,7 @@ export default { ...@@ -168,7 +200,7 @@ export default {
tagSelected(item) { tagSelected(item) {
this.tagging = item this.tagging = item
}, },
handleSave: utils.debounce(function () { handleSave: utils.debounce(function() {
if (this.staffInfo.length == 0) { if (this.staffInfo.length == 0) {
this.staffStatus = true this.staffStatus = true
return return
...@@ -250,29 +282,40 @@ export default { ...@@ -250,29 +282,40 @@ export default {
}) })
this.tagging = taggingList this.tagging = taggingList
this.autoWelcome = res.autoWelcome ? true : false this.autoWelcome = res.autoWelcome ? true : false
const previewList = res.welcomeInfo.map(item => { if (res.welcomeInfo.length != 0) {
if (item.attType == 7) item.attContent = JSON.parse(item.attContent) const previewList = res.welcomeInfo.map(item => {
return item if (item.attType == 7) item.attContent = JSON.parse(item.attContent)
return item
})
this.$refs.welcome.updateList(previewList)
}
this.$nextTick(() => {
this.editStatus = false
this.previewListStart = this.$common.utils.deepClone(this.$refs.welcome.previewList)
}) })
this.$refs.welcome.updateList(previewList)
}) })
} }
// resize() {
// this.footerLeft = document.querySelector('.base-container-right').offsetLeft
// this.footerWidth = document.documentElement.clientWidth - this.footerLeft
// }
}, },
// destroyed() {
// window.removeEventListener('resize', this.resize)
// },
mounted() { mounted() {
const { id, codeUuid } = this.$route.params const { id, codeUuid } = this.$route.params
if (id != -1) { if (id) {
this.codeId = id this.codeId = id
this.detailChannelCode(id, codeUuid) this.detailChannelCode(id, codeUuid)
} }
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.channel-main-welcome { .channel-main-welcome {
margin: 20px 0px 60px; margin: 20px 0px 16px;
.welcome-panel { .welcome-panel {
margin: 10px; margin: 10px;
padding: 0px 20px 20px; padding: 0px 20px 20px;
...@@ -361,4 +404,4 @@ export default { ...@@ -361,4 +404,4 @@ export default {
margin-bottom: 5px; margin-bottom: 5px;
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template> <template>
<div> <div>
<div class="form-header"> <div class="form-header">
<el-button type="primary" size="small" icon="el-icon-add" @click="handleAddCode">新建渠道活码</el-button> <GLButton type="primary" size="small" icon="el-icon-add" @click="handleAddCode" fn="新增活码">新建渠道活码</GLButton>
</div> </div>
<div class="form-panel scrm-box-f"> <div class="form-panel scrm-box-f">
<el-form :inline="true" :model="tableSearchForm" class="follow-form-item"> <GLCombiForm :rowNumber="1" ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<el-row> <GLTable v-loading="loading" ref="table" @refreshTable="handleSearch" :searchForm="tableSearchForm" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams">
<el-form-item size="small" label="渠道名称或备注">
<el-input size="small" v-model="tableSearchForm.codeNameAndRemark" placeholder="请输入渠道名称或备注"></el-input>
</el-form-item>
<el-form-item size="small" style="float: right">
<el-button @click="handleReset">重置</el-button>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-row>
</el-form>
<GLTable ref="table" :searchForm="tableSearchForm" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams">
<div class="table-btns" slot="optionBtns" slot-scope="scope"> <div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">数据</el-button> <GLButton type="text" @click="handleDetail(scope.scope)" fn="到店咨询客户数据">数据</GLButton>
<el-button type="text" @click="handleEdit(scope.scope)">修改</el-button> <GLButton type="text" @click="handleEdit(scope.scope)" fn="活码编辑">修改</GLButton>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button> <el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
<el-button type="text" @click="handleAddPoster(scope.scope)">活码海报</el-button> <GLButton type="text" @click="handleAddPoster(scope.scope)" fn="活码海报">活码海报</GLButton>
</div>
<div slot="yesterdayNum" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope, 'day')" v-if="scope.scope.yesterdayNum">{{ scope.scope.yesterdayNum }}</div>
<div v-else>0</div>
</div>
<div slot="totalNum" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope)" v-if="scope.scope.totalNum">{{ scope.scope.totalNum }}</div>
<div v-else>0</div>
</div> </div>
<div slot="staffInfo" slot-scope="scope"> <div slot="staffInfo" slot-scope="scope">
<el-popover trigger="hover" placement="top" v-if="scope.scope.staffInfo.length > 3"> <el-popover trigger="hover" placement="top" v-if="staffNameSplit(scope.scope.staffName).length > 3">
<div class="accountType-row" v-for="(item, index) in scope.scope.staffInfo" :key="index"> <GLFull
<i class="el-icon-user-solid"></i> :labelWidth="110"
{{ item.staffName }} :label="item"
</div> textType="user"
:identi="
`text_${Math.random()
.toString()
.replace('.', '')}`
"
v-for="(item, index) in staffNameSplit(scope.scope.staffName)"
:key="index"
></GLFull>
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<div v-for="(item, index) in scope.scope.staffInfo" :key="index" v-show="index < 4"> <div v-for="(item, index) in staffNameSplit(scope.scope.staffName)" :key="index" v-show="index < 4">
<div class="accountType-row" > <template v-if="index == 3 && staffNameSplit(scope.scope.staffName).length > 3">
<i class="el-icon-user-solid"></i> <div class="accountType-row">
{{ index == 3 && scope.scope.staffInfo.length > 3 ? '...(' + scope.scope.staffInfo.length + ')' : item.staffName }} <i class="el-icon-user-solid"></i>
</div> <span>{{ '...(' + staffNameSplit(scope.scope.staffName).length + ')' }}</span>
</div>
</template>
<GLFull :labelWidth="110" :label="item" textType="user" v-if="index < 3"></GLFull>
</div> </div>
</div> </div>
</el-popover> </el-popover>
<div v-for="(item, index) in scope.scope.staffInfo" :key="index" v-else> <GLFull
<div class="accountType-row"> :labelWidth="110"
<i class="el-icon-user-solid"></i> :label="item"
{{ item.staffName }} textType="user"
</div> :identi="
</div> `text_${Math.random()
.toString()
.replace('.', '')}`
"
v-for="(item, index) in staffNameSplit(scope.scope.staffName)"
:key="index"
v-else
></GLFull>
<!-- <div v-for="(item, index) in staffNameSplit(scope.scope.staffName)" :key="index" v-else>
<div class="accountType-row">
<i class="el-icon-user-solid"></i>
<GLTitle :content="item" textLength="4"></GLTitle>
</div>
</div> -->
</div> </div>
<div slot="qrCode" slot-scope="scope"> <div slot="qrCode" slot-scope="scope">
<img :src="scope.scope.qrCode" style="width: 80px; height: 80px" /> <el-popover placement="bottom" width="400" trigger="click">
<img :src="scope.scope.qrCode" style="width: 360px; height: 360px" />
<img :src="scope.scope.qrCode" style="width: 80px; height: 80px" slot="reference" />
</el-popover>
<div class="download-link" @click="downloadIamge(scope.scope.qrCode)">下载二维码</div> <div class="download-link" @click="downloadIamge(scope.scope.qrCode)">下载二维码</div>
</div> </div>
<div slot="tagging" slot-scope="scope" class="tag-panel"> <div slot="tagging" slot-scope="scope" class="tag-panel">
<el-popover trigger="hover" placement="top" v-if="scope.scope.taggingList && scope.scope.taggingList.length > 3"> <el-popover trigger="hover" placement="top" v-if="scope.scope.taggingList && scope.scope.taggingList.length > 3">
<div :title="item.name" class="accountType-row accountType-row-tag" v-for="(item, index) in scope.scope.taggingList" :key="index"> <!-- <div :title="item.name" class="accountType-row accountType-row-tag" v-for="(item, index) in scope.scope.taggingList" :key="index">
{{ item ? item.name : '' }} {{ item.name.length > 8 ? item.name.substring(0, 8) + '...' : item.name }}
</div> </div> -->
<GLTitle :content="item.name" class="accountType-row accountType-row-tag" v-for="(item, index) in scope.scope.taggingList" :key="index"></GLTitle>
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<div v-for="(item, index) in scope.scope.taggingList" :key="index" v-show="index < 4"> <div v-for="(item, index) in scope.scope.taggingList" :key="index" v-show="index < 4">
<div :title="item.name" class="accountType-row accountType-row-tag"> {{ index == 3 && scope.scope.taggingList.length > 3 ? '...('+scope.scope.taggingList.length+')' : item ? item.name : '' }}</div> <div :title="item.name" class="accountType-row accountType-row-tag" v-if="index == 3 && scope.scope.taggingList.length > 3">{{ '...(' + scope.scope.taggingList.length + ')' }}</div>
<GLTitle :content="item.name" class="accountType-row accountType-row-tag" v-else></GLTitle>
</div> </div>
</div> </div>
</el-popover> </el-popover>
<template v-if="scope.scope.taggingList && scope.scope.taggingList.length <= 3 && scope.scope.taggingList.length > 0"> <template v-if="scope.scope.taggingList && scope.scope.taggingList.length <= 3 && scope.scope.taggingList.length > 0">
<div v-for="(item, index) in scope.scope.taggingList" :key="index"> <div v-for="(item, index) in scope.scope.taggingList" :key="index">
<div :title="item.name" class="accountType-row accountType-row-tag">{{ item ? item.name : '' }}</div> <GLTitle :content="item.name" class="accountType-row accountType-row-tag"></GLTitle>
<!-- <div :title="item.name" class="accountType-row accountType-row-tag">{{ item.name.length > 8 ? item.name.substring(0, 8) + '...' : item.name }}</div> -->
</div> </div>
</template> </template>
<div v-if="!scope.scope.taggingList || (scope.scope.taggingList && scope.scope.taggingList.length == 0)"> <div v-if="!scope.scope.taggingList || (scope.scope.taggingList && scope.scope.taggingList.length == 0)">--</div>
--
</div>
</div> </div>
<div slot="codeRemark" slot-scope="scope"> <div slot="codeRemark" slot-scope="scope">
<div class="codeName">{{ scope.scope.codeName }}</div> <div class="codeName">{{ scope.scope.codeName }}</div>
...@@ -74,16 +100,40 @@ ...@@ -74,16 +100,40 @@
</div> </div>
</GLTable> </GLTable>
</div> </div>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisibleDel = false" type="error" content="是否删除?" :visible.sync="dialogVisibleDel" mode="small"></GLDialog>
<emp-detail ref="empDetailForm"></emp-detail>
</div> </div>
</template> </template>
<script> <script>
import util from '@/utils/util' import util from '@/utils/util'
import empDetail from './empDetail.vue'
export default { export default {
components: { empDetail },
name: 'channelList', name: 'channelList',
data() { data() {
return { return {
tableSearchForm: {}, dialogVisibleDel: false,
selectItem: '',
loading: false,
tableSearchForm: {
staffName: '',
codeNameAndRemark: ''
},
searchFormData: [
{
label: '渠道名称或备注',
name: 'codeNameAndRemark',
type: 'input',
placeholder: '请输入渠道名称或备注'
},
{
label: '关联专员',
name: 'staffName',
type: 'input',
placeholder: '请输入关联专员'
}
],
tableData: [], tableData: [],
tableParams: { tableParams: {
listName: 'data', listName: 'data',
...@@ -97,12 +147,14 @@ export default { ...@@ -97,12 +147,14 @@ export default {
{ {
label: '今日新增客户数', label: '今日新增客户数',
prop: 'yesterdayNum', prop: 'yesterdayNum',
width: '120px' width: '130px',
addHtml: 'yesterdayNum'
}, },
{ {
label: '总新增客户数', label: '总新增客户数',
prop: 'totalNum', prop: 'totalNum',
width: '150px' width: '120px',
addHtml: 'totalNum'
}, },
{ {
label: '使用专员', label: '使用专员',
...@@ -125,12 +177,12 @@ export default { ...@@ -125,12 +177,12 @@ export default {
{ {
label: '创建时间', label: '创建时间',
prop: 'createdTime', prop: 'createdTime',
width: '160px' width: '180px'
}, },
{ {
label: '操作', label: '操作',
prop: 'optionBtns', prop: 'optionBtns',
width: '140px', width: '220px',
addHtml: 'optionBtns', addHtml: 'optionBtns',
fixed: 'right' fixed: 'right'
} }
...@@ -142,6 +194,9 @@ export default { ...@@ -142,6 +194,9 @@ export default {
} }
}, },
methods: { methods: {
staffNameSplit(name) {
return name ? name.split(',') : ''
},
handleDetail(scope) { handleDetail(scope) {
this.$router.push('/channel/store/' + scope.id + '/' + scope.codeUuid + '/' + scope.codeState) this.$router.push('/channel/store/' + scope.id + '/' + scope.codeUuid + '/' + scope.codeState)
}, },
...@@ -156,11 +211,14 @@ export default { ...@@ -156,11 +211,14 @@ export default {
this.listChannelCodeByPage() this.listChannelCodeByPage()
}, },
handleAddCode() { handleAddCode() {
this.$router.push('/channel/addCode/-1/-1') this.$router.push('/channel/addCode')
}, },
handleAddPoster(scope) { handleAddPoster(scope) {
this.$router.push('/channel/poster/' + scope.id) this.$router.push('/channel/poster/' + scope.id)
}, },
handleEmpDetail(scope, status) {
this.$refs.empDetailForm.init(scope, status)
},
downloadIamge(imgsrc) { downloadIamge(imgsrc) {
util.downloadIamge(imgsrc) util.downloadIamge(imgsrc)
}, },
...@@ -183,30 +241,28 @@ export default { ...@@ -183,30 +241,28 @@ export default {
}) })
.catch(() => {}) .catch(() => {})
}, },
handleDelete(scope) { handleSure() {
this.$confirm('是否删除?', '提示', { const { id, codeUuid, configId } = this.selectItem
confirmButtonText: '确定', this.$apis.channel
cancelButtonText: '取消', .deleteChannelCode({
type: 'warning' id,
}) codeUuid,
.then(() => { configId
this.$apis.channel })
.deleteChannelCode({ .then(res => {
id: scope.id, if (res) {
codeUuid: scope.codeUuid, this.$message({
configId: scope.configId type: 'success',
}) message: '删除成功!'
.then(res => {
if (res) {
this.$message({
type: 'success',
message: '删除成功!'
})
}
this.handleSearch()
}) })
}
this.handleSearch()
}) })
.catch(() => {}) this.dialogVisibleDel = false
},
handleDelete(scope) {
this.dialogVisibleDel = true
this.selectItem = scope
}, },
listChannelCodeByPage() { listChannelCodeByPage() {
const params = { const params = {
...@@ -214,18 +270,22 @@ export default { ...@@ -214,18 +270,22 @@ export default {
pageSize: this.$refs.table.page.pageSize, pageSize: this.$refs.table.page.pageSize,
pageNum: this.$refs.table.page.pageNum pageNum: this.$refs.table.page.pageNum
} }
this.loading = true
this.$apis.channel.listChannelCodeByPage(params).then(res => { this.$apis.channel.listChannelCodeByPage(params).then(res => {
this.loading = false
if (res) { if (res) {
this.tableData = res.data this.tableData = res.data
this.tableData.forEach(item => { this.tableData.forEach(item => {
this.$set(item, 'taggingList', []) this.$set(item, 'taggingList', [])
const tagging = eval(item.tagging) const tagging = eval(item.tagging)
tagging.forEach(itm => { if (tagging && tagging.length > 0) {
let name = itm.name.split(',') tagging.forEach(itm => {
name.forEach((tag, index) => { let name = itm.name.split(',')
item.taggingList.push({ name: tag }) name.forEach((tag, index) => {
item.taggingList.push({ name: tag })
})
}) })
}) }
}) })
this.tableTotal = res.count this.tableTotal = res.count
} }
...@@ -236,8 +296,12 @@ export default { ...@@ -236,8 +296,12 @@ export default {
this.listChannelCodeByPage() this.listChannelCodeByPage()
} }
} }
</script> </script>
<style>
.el-popover {
max-width: 800px;
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
.popover-panel { .popover-panel {
width: 1000px; width: 1000px;
...@@ -247,7 +311,7 @@ export default { ...@@ -247,7 +311,7 @@ export default {
} }
.form-panel { .form-panel {
padding: 20px; padding: 20px;
/deep/ .el-popover{ /deep/ .el-popover {
max-width: 1000px; max-width: 1000px;
} }
} }
...@@ -338,6 +402,10 @@ export default { ...@@ -338,6 +402,10 @@ export default {
} }
} }
} }
.link-dialog {
text-decoration: underline;
cursor: pointer;
}
.accountType-row { .accountType-row {
text-align: left; text-align: left;
position: relative; position: relative;
...@@ -352,7 +420,7 @@ export default { ...@@ -352,7 +420,7 @@ export default {
margin-right: 5px; margin-right: 5px;
&-tag { &-tag {
display: inline-block; display: inline-block;
border: 1px solid #e8e8ea; border: 1px solid #e8e8ea;
background: #fafbfe; background: #fafbfe;
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
...@@ -365,6 +433,7 @@ export default { ...@@ -365,6 +433,7 @@ export default {
} }
i { i {
color: #75acff; color: #75acff;
margin-right: 3px;
} }
// &::before { // &::before {
// content: ''; // content: '';
...@@ -377,4 +446,4 @@ export default { ...@@ -377,4 +446,4 @@ export default {
// top: 7px; // top: 7px;
// } // }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
</el-radio-group> </el-radio-group>
<el-form :inline="true" :model="tableSearchForm" class="follow-form-item" label-width="80px"> <el-form :inline="true" :model="tableSearchForm" class="follow-form-item" label-width="80px">
<el-form-item size="small" label="添加时间"> <el-form-item size="small" label="添加时间">
<el-date-picker :picker-options="pickerOptions" value-format="yyyy-MM-dd" v-model="createTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> <el-date-picker :picker-options="pickerOptions" @change="handleTime" value-format="yyyy-MM-dd" v-model="createTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item size="small" label="渠道名称"> <el-form-item size="small" label="渠道名称">
<el-input size="small" v-model="tableSearchForm.keyWord" placeholder="请输入渠道名称"></el-input> <el-input size="small" v-model="tableSearchForm.keyWord" placeholder="请输入渠道名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item size="small" style="float: right;margin-left: 40px"> <el-form-item size="small" style="float: right; margin-left: 40px">
<el-button type="primary" @click="handleSearch">查询</el-button> <el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -33,11 +33,12 @@ ...@@ -33,11 +33,12 @@
<div class="chart-title-num">各渠道新增客户数</div> <div class="chart-title-num">各渠道新增客户数</div>
</div> </div>
<div class="chart-desc-item" v-for="(item, index) in codeIds" :key="index"> <div class="chart-desc-item" v-for="(item, index) in codeIds" :key="index">
<div class="chart-item-title"> <div class="chart-item-title" :title="item.codeName">
<span :style="{ background: colorList[index], }"></span> <span :style="{ background: colorList[index] }"></span>
{{ item.codeName }} {{ item.codeName }}
</div> </div>
<div class="chart-item-num">{{ item.totalNum }}</div> <div class="chart-item-num link-dialog" @click="handleEmpDetail(item)" v-if="item.totalNum">{{ item.totalNum }}</div>
<div class="chart-item-num" v-else>0</div>
</div> </div>
</div> </div>
<div> <div>
...@@ -46,8 +47,18 @@ ...@@ -46,8 +47,18 @@
</div> </div>
</div> </div>
</div> </div>
<GLTable ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams" @refreshTable="handleSearch"></GLTable> <GLTable ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams" @refreshTable="handleSearch">
<div slot="newlyCount" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope, 'day', scope.scope.timeFrame)" v-if="scope.scope.newlyCount">{{ scope.scope.newlyCount }}</div>
<div v-else>0</div>
</div>
<div slot="newlyKeepCount" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope, 'status', scope.scope.timeFrame)" v-if="scope.scope.newlyKeepCount">{{ scope.scope.newlyKeepCount }}</div>
<div v-else>0</div>
</div>
</GLTable>
<select-channel :colorList="colorList" ref="channelForm" @selectTable="selectTable"></select-channel> <select-channel :colorList="colorList" ref="channelForm" @selectTable="selectTable"></select-channel>
<emp-detail ref="empDetailForm"></emp-detail>
</div> </div>
</template> </template>
...@@ -55,11 +66,13 @@ ...@@ -55,11 +66,13 @@
import utils from '@/utils/util' import utils from '@/utils/util'
import linechart from './linechart' import linechart from './linechart'
import selectChannel from './selectChannel' import selectChannel from './selectChannel'
import empDetail from './empDetail.vue'
export default { export default {
name: 'channelStatistics', name: 'channelStatistics',
components: { components: {
linechart, linechart,
selectChannel selectChannel,
empDetail
}, },
data() { data() {
return { return {
...@@ -83,11 +96,13 @@ export default { ...@@ -83,11 +96,13 @@ export default {
}, },
{ {
label: '新增客户数', label: '新增客户数',
prop: 'newlyCount' prop: 'newlyCount',
addHtml: 'newlyCount'
}, },
{ {
label: '留存客户数', label: '留存客户数',
prop: 'newlyKeepCount' prop: 'newlyKeepCount',
addHtml: 'newlyKeepCount'
}, },
{ {
label: '日期', label: '日期',
...@@ -106,9 +121,27 @@ export default { ...@@ -106,9 +121,27 @@ export default {
colorList: ['#5850FF', '#2CCA74', '#EB4E4E', '#FF6D00', '#F8C900', '#2CCAC4', '#E74EEB', '#6F2828'] colorList: ['#5850FF', '#2CCA74', '#EB4E4E', '#FF6D00', '#F8C900', '#2CCAC4', '#E74EEB', '#6F2828']
} }
}, },
watch: { // watch: {
createTime(value) { // createTime(value) {
if (value) { // if (value) {
// this.startTime = value[0]
// this.endTime = value[1]
// this.timeRadio = null
// this.trendType = null
// } else {
// this.startTime = ''
// this.endTime = ''
// this.timeRadio = 1
// this.trendType = 1
// }
// this.getFollower()
// this.codeSearch()
// }
// },
methods: {
handleTime() {
const value = this.createTime
if (value && value.length > 0) {
this.startTime = value[0] this.startTime = value[0]
this.endTime = value[1] this.endTime = value[1]
this.timeRadio = null this.timeRadio = null
...@@ -121,12 +154,11 @@ export default { ...@@ -121,12 +154,11 @@ export default {
} }
this.getFollower() this.getFollower()
this.codeSearch() this.codeSearch()
} },
},
methods: {
handleTab() { handleTab() {
this.createTime = []
this.trendType = this.timeRadio this.trendType = this.timeRadio
this.startTime = '' this.createTime = ''
this.endTime = '' this.endTime = ''
this.codeSearch() this.codeSearch()
this.getFollower() this.getFollower()
...@@ -134,6 +166,9 @@ export default { ...@@ -134,6 +166,9 @@ export default {
handleSearch() { handleSearch() {
this.codeSearch() this.codeSearch()
}, },
handleEmpDetail(scope, value, day) {
this.$refs.empDetailForm.init(scope, value, day)
},
codeSearch() { codeSearch() {
var params = { var params = {
...JSON.parse(JSON.stringify(this.tableSearchForm)), ...JSON.parse(JSON.stringify(this.tableSearchForm)),
...@@ -179,6 +214,24 @@ export default { ...@@ -179,6 +214,24 @@ export default {
handleChannel() { handleChannel() {
this.$refs.channelForm.init(this.codeIds) this.$refs.channelForm.init(this.codeIds)
}, },
getFollowerTotal() {
var params = {
pageSize: 1000,
pageNum: 1
}
this.$apis.channel.listChannelCodeByPage(params).then(res => {
console.log(res)
this.tableData = res.data
this.tableTotal = res.count
this.tableData.forEach(item => {
this.selectCode.forEach((itm, index) => {
if (itm.codeState == item.codeState) {
this.$refs.table.$refs.salelistMutiTable.toggleRowSelection(item)
}
})
})
})
},
getFollower() { getFollower() {
let codeState = this.codeIds.map(item => item.codeState) let codeState = this.codeIds.map(item => item.codeState)
var params = { var params = {
...@@ -207,7 +260,7 @@ export default { ...@@ -207,7 +260,7 @@ export default {
this.getFollower() this.getFollower()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.channel-main { .channel-main {
...@@ -218,6 +271,10 @@ export default { ...@@ -218,6 +271,10 @@ export default {
} }
} }
} }
.link-dialog {
text-decoration: underline;
cursor: pointer;
}
.channel-chart { .channel-chart {
display: flex; display: flex;
.channel-chart-desc { .channel-chart-desc {
...@@ -248,6 +305,9 @@ export default { ...@@ -248,6 +305,9 @@ export default {
line-height: 17px; line-height: 17px;
margin-top: 10px; margin-top: 10px;
.chart-item-title { .chart-item-title {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
span { span {
vertical-align: middle; vertical-align: middle;
display: inline-block; display: inline-block;
...@@ -285,4 +345,4 @@ export default { ...@@ -285,4 +345,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template>
<div class="square-main" v-loading="loading">
<el-dialog title="客户列表" :visible.sync="dialogVisible" width="70%" :before-close="handleClose">
<el-form :inline="true" :model="tableSearchForm" class="emp-form">
<el-form-item size="small" label="客户名称">
<el-input v-model="tableSearchForm.customerName" placeholder="请输入客户名称"></el-input>
</el-form-item>
<el-form-item size="small" label="状态" v-if="!pStatus">
<el-select v-model="tableSearchForm.status" placeholder="请选择">
<el-option v-for="item in optionstatus" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item size="small" label="跟进员工" v-if="!staffIds">
<el-select v-model="staffId" placeholder="请选择">
<el-option v-for="item in staffName" :key="item.staffId" :label="item.staffName" :value="item.staffId"></el-option>
</el-select>
</el-form-item>
<el-form-item size="small" label="添加时间" v-if="timeStatus">
<el-date-picker :picker-options="pickerOptions" value-format="yyyy-MM-dd" v-model="createTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item>
<el-form-item size="small" style="float: right; margin-right: 0px">
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<!-- <GLCombiForm ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> -->
<GLTable v-loading="loading" ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams" @refreshTable="handleSearch" @selectionTable="selectionTable">
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">详情</el-button>
</div>
<template slot="status" slot-scope="scope">
<div class="status-form" v-if="scope.scope.status" style="color: #eb4e4e">删除好友</div>
<div class="status-form" v-else style="color: #00a854">正常</div>
</template>
<template slot="customerName" slot-scope="scope">
<div class="form-row">
<img :src="scope.scope.avatar" v-if="scope.scope.avatar" />
{{ scope.scope.customerName }}
<span style="color: #5850ff">{{ scope.scope.type == 1 ? '@微信' : '@企微' }}</span>
</div>
</template>
</GLTable>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleCancel" type="primary">关闭</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { utils } from 'glsx-common'
import util from '@/utils/util'
export default {
name: 'selectEmp',
data() {
return {
loading: false,
dialogVisible: false,
status: '',
createTime: [],
optionstatus: [
{
value: '',
label: '全部'
},
{
value: '0',
label: '正常'
},
{
value: '-1',
label: '删除好友'
}
],
tableSearchForm: {},
searchFormData: [
{
label: '客户名称',
name: 'codeNameAndRemark',
type: 'input',
placeholder: '请输入客户名称'
},
{
label: '状态',
name: 'imStatus',
type: 'select',
placeholder: '请选择',
optionId: 'value',
optionLabel: 'label',
optionList: [
{
value: '',
label: '全部'
},
{
value: '0',
label: '正常'
},
{
value: '-1',
label: '删除好友'
}
]
},
{
label: '跟进员工',
name: 'imStatus',
type: 'select',
placeholder: '请选择',
optionId: 'value',
optionLabel: 'label',
optionList: [
{
value: '',
label: '全部'
},
{
value: '0',
label: '正常'
},
{
value: '-1',
label: '删除好友'
}
]
},
{
label: '添加时间',
name: 'createTime',
type: 'datePicker',
placeholder: '',
isClear: true,
pickerOptions: {
disabledDate: time => {
return time.getTime() > Date.now()
}
}
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
tableParams: {
listName: 'data',
tableOption: false,
tableColumns: [
{
label: '客户名称',
prop: 'customerName',
addHtml: 'customerName',
align: 'left'
},
{
label: '客户性别',
prop: 'customerSex',
formatter: cellValue => {
console.log(cellValue)
return cellValue.customerSex == 1 ? '男' : '女'
},
width: '80px'
},
{
label: '状态',
prop: 'status',
addHtml: 'status',
width: '80px'
},
{
label: '跟进员工',
prop: 'followStaff',
width: '80px'
},
{
label: '添加时间',
prop: 'addTime'
},
{
label: '操作',
prop: 'optionBtns',
width: '80px',
addHtml: 'optionBtns'
}
]
},
layout: 'sizes, prev, pager, next, jumper, ->, total',
tableData: [],
staffName: [],
tableTotal: 0,
selectItem: [],
selectEmp: [],
pStatus: null,
staffIds: null,
staffId: null
}
},
methods: {
jumpUrl() {
this.$history.push('/home/followUp/index')
},
getFollower() {
var params = {
...JSON.parse(JSON.stringify(this.tableSearchForm)),
pageSize: this.$refs.table.page.pageSize,
pageNum: this.$refs.table.page.pageNum,
custState: this.selectRow.codeState,
staffIds: this.staffId ? [this.staffId] : null
}
if (this.createTime && this.createTime.length > 0) {
params.beginTime = this.createTime[0]
params.endTime = this.createTime[1]
}
if (this.pStatus) {
params.status = 0
}
if (this.staffIds) {
params.staffIds = this.staffIds
}
this.loading = true
this.$apis.channel.getCustomer(params).then(res => {
this.loading = false
this.tableData = res.data
this.tableTotal = res.count
})
},
getChannelCodeStaffList() {
var params = {
pageSize: 1000,
pageNum: 1,
codeState: this.selectRow.codeState
}
this.$apis.channel.getChannelCodeStaffList(params).then(res => {
this.staffName = [{ staffName: '全部', staffId: null }].concat(res.data)
})
},
init(item, value, day) {
this.createTime = []
this.pStatus = null
this.staffIds = null
this.timeStatus = true
if (value == 'day' && !day) {
this.createTime = [util.getDay(0), util.getDay(0)]
this.timeStatus = false
}
if (value == 'day' && day) {
if (day.indexOf('~') == -1) {
this.createTime = [day, day]
} else {
this.createTime = [day.split('~')[0], day.split('~')[1]]
}
this.timeStatus = false
}
if (value == 'status' && !day) {
this.pStatus = 'status'
}
if (value == 'status' && day) {
this.pStatus = 'status'
if (day.indexOf('~') == -1) {
this.createTime = [day, day]
} else {
this.createTime = [day.split('~')[0], day.split('~')[1]]
}
this.timeStatus = false
}
if (value == 'staffIds') {
this.staffIds = item.staffId
}
if (value == 'statusAndStaffIds') {
this.pStatus = 'status'
this.staffIds = item.staffId
}
this.selectRow = item
this.tableSearchForm = {}
this.dialogVisible = true
this.getChannelCodeStaffList()
this.$nextTick(() => {
this.$refs.table.page.pageNum = 1
this.getFollower()
})
},
handleSearch() {
this.getFollower()
},
selectionTable(val) {
this.selectItem = val
},
handleClose() {
this.handleCancel()
},
handleDetail(scope) {
this.$history.push('/custom/clientManage/clientDetail?id=' + scope.oneId)
},
handleCancel: utils.debounce(function() {
this.dialogVisible = false
}, 300)
}
}
</script>
<style lang="scss" scoped>
.dialog-jump {
color: #5850ff;
float: left;
line-height: 24px;
text-decoration: underline;
cursor: pointer;
}
.emp-form {
/deep/ {
.el-date-editor,
.el-input {
width: 215px;
}
}
}
.square-main {
/deep/ {
.el-table {
height: 35vh;
overflow-y: auto;
}
.el-form-item {
margin-right: 20px;
}
.el-table::before {
left: 0;
bottom: 0;
width: 100%;
height: 0px;
}
}
}
.form-row {
img {
width: 50px;
height: 50px;
vertical-align: middle;
}
}
</style>
<template> <template>
<div class="square-main"> <div class="square-main">
<el-dialog title="选择渠道" :visible.sync="dialogVisible" width="70%" :before-close="handleCancel"> <GLDialog title="选择渠道" :visible.sync="dialogVisible" @onOk="handleSelect" @onCancel="handleCancel" mode="big">
<div class="square-tabel"> <div class="square-tabel">
<div class="square-tabel-select"> <div class="square-tabel-select">
<GLTable ref="table" :hasPage="false" :tableData="tableData" :tableTotal="tableTotal" :tableParams="tableParams" @refreshTable="handleSearch" @selectionTable="selectionTable"></GLTable> <GLTable ref="table" :hasPage="false" :tableData="tableData" :tableTotal="tableTotal" :tableParams="tableParams" @refreshTable="handleSearch" @selectionTable="selectionTable"></GLTable>
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<div class="selected-title">已选渠道</div> <div class="selected-title">已选渠道</div>
<div class="selected-panel"> <div class="selected-panel">
<div class="selected-item" v-for="(item, index) in selectedList" :key="index"> <div class="selected-item" v-for="(item, index) in selectedList" :key="index">
<div> <div :title="item.codeName">
<span :style="{ background: colorList[index]}"></span> <span :style="{ background: colorList[index] }"></span>
{{ item.codeName }} {{ item.codeName }}
</div> </div>
<img src="@/assets/img/channel/del.png" @click="delTag(item)" /> <img src="@/assets/img/channel/del.png" @click="delTag(item)" />
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<el-button size="small" @click="handleCancel">取 消</el-button> <el-button size="small" @click="handleCancel">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelect">确 定</el-button> <el-button size="small" type="primary" @click="handleSelect">确 定</el-button>
</span> </span>
</el-dialog> </GLDialog>
</div> </div>
</template> </template>
...@@ -104,7 +104,7 @@ export default { ...@@ -104,7 +104,7 @@ export default {
this.dialogVisible = false this.dialogVisible = false
this.$refs.table.$refs.salelistMutiTable.clearSelection() this.$refs.table.$refs.salelistMutiTable.clearSelection()
}, },
handleSelect: utils.debounce(function () { handleSelect: utils.debounce(function() {
if (this.selectedList.length == 0) { if (this.selectedList.length == 0) {
this.$message.error('请选择渠道') this.$message.error('请选择渠道')
return return
...@@ -119,7 +119,7 @@ export default { ...@@ -119,7 +119,7 @@ export default {
}, 300) }, 300)
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.square-main { .square-main {
...@@ -148,12 +148,17 @@ export default { ...@@ -148,12 +148,17 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
div {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
span { span {
vertical-align: middle; vertical-align: middle;
display: inline-block; display: inline-block;
width: 12px; width: 12px;
height: 2px; height: 2px;
margin-right: 10px; margin-right: 10px;
} }
img { img {
width: 16px; width: 16px;
...@@ -177,4 +182,4 @@ export default { ...@@ -177,4 +182,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -10,24 +10,55 @@ ...@@ -10,24 +10,55 @@
</template> </template>
<script> <script>
import channelList from "./components/channelList"; import channelList from './components/channelList'
import channelStatistics from "./components/channelStatistics"; import channelStatistics from './components/channelStatistics'
export default { export default {
name: "channel", name: 'channel',
components: { components: {
channelList, channelList,
channelStatistics, channelStatistics
}, },
data() { data() {
return { return {
activeName: "first", activeName: 'first'
}; }
}, },
methods: { methods: {
handleClick() {}, jumpWx() {
this.$history.push('/settings/enterpriseWechat/index')
},
wxTips() {
const menu = JSON.parse(sessionStorage['SCRM_BASE_MENULIST'])
menu.forEach(item => {
if (!item.children) {
return
}
item.children.forEach(itm => {
if (itm.path == '/enterpriseWechat/index') {
this.$apis.channel.getStatus({}).then(res => {
if (res.status != 'SUCCESS') {
const h = this.$createElement
this.$message({
showClose: true,
duration: 0,
message: h('p', null, [h('span', null, '此功能需完成【企业微信授权】后方可使用! '), h('span', { on: { click: this.jumpWx }, style: { marginRight: '150px', cursor: 'pointer', color: '#5850ff' } }, ['企业微信授权 ', h('i', { class: 'el-icon-d-arrow-right' }, '')])])
})
}
})
}
})
})
},
handleClick() {}
},
beforeDestroy() {
this.$message.closeAll()
}, },
}; mounted() {
</script> this.wxTips()
}
}
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.channel-main { .channel-main {
...@@ -37,4 +68,4 @@ export default { ...@@ -37,4 +68,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template> <template>
<div class="channel-main scrm-box-f" v-loading="loading"> <div class="channel-main scrm-box-f" v-loading="loading">
<div class="channel-header">
<el-button type="primary" size="small" @click="goBack">返回</el-button>
</div>
<div class="poster-body"> <div class="poster-body">
<div class="poster-item" @dblclick="setPoster(item)" @mouseenter="item.show = true" @mouseleave="item.show = false" v-for="(item, index) in posterList" :key="index"> <div class="poster-item" @click="setPoster(item)" @mouseenter="item.show = true" @mouseleave="item.show = false" v-for="(item, index) in posterList" :key="index">
<div class="poster-del" v-show="item.show" @click="handleDelete(item.id)"> <div class="poster-del" v-show="item.show" @click.stop="handleDelete(item.id)">
<img src="@/assets/img/del.png" /> <img src="@/assets/img/del.png" />
</div> </div>
<div class="poster-item-box" v-loading="item.loadingImg"> <div class="poster-item-box" v-loading="item.loadingImg">
<img <img
:src="item.autoUrl" :src="item.thumbnailUrl ? item.thumbnailUrl : item.autoUrl"
class="poster-image" class="poster-image"
v-if="item.imgWidth" v-if="item.imgWidth"
:style="{ :style="{
...@@ -19,23 +16,24 @@ ...@@ -19,23 +16,24 @@
}" }"
/> />
</div> </div>
<div class="poster-item-link" @click="downloadIamge(item.autoUrl)">下载海报</div> <div class="poster-item-link" @click.stop="downloadIamge(item.autoUrl)">下载海报</div>
</div> </div>
<div class="poster-item"> <div class="poster-item">
<div class="poster-item-box"> <div class="poster-item-box">
<div> <div>
<div class="poster-upload-image"> <div class="poster-upload-image">
<img src="@/assets/img/channel/upload.png" /> <img src="@/assets/img/channel/upload.png" />
<div class="poster-tips">上传海报图片,将自动配上渠道活码</div> <div class="poster-tips">上传海报图片,将自动配上渠道活码</div>
</div> </div>
<el-upload action="#" class="image-uploader" :before-upload="upLoadImg"> <div class="image-uploader">
<div class="poster-item-link">上传海报</div> <div class="poster-item-link">上传海报</div>
</el-upload> <input type="file" class="image-uploader" style="opacity: 0" ref="file" accept="*" @change="upLoadImg" />
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<el-dialog v-loading="loadingDrag" title="创建活码海报" :visible.sync="dialogVisible" width="50%" :before-close="handleClose"> <GLDialog @onOk="savePoster" @onCancel="dialogVisible = false" v-loading="loadingDrag" title="创建活码海报" :visible.sync="dialogVisible">
<div class="poster-draggable-title">拖动活码可调整活码位置</div> <div class="poster-draggable-title">拖动活码可调整活码位置</div>
<div class="poster-draggable"> <div class="poster-draggable">
<div <div
...@@ -65,18 +63,18 @@ ...@@ -65,18 +63,18 @@
></vue-draggable-resizable> ></vue-draggable-resizable>
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <!-- <span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible = false">取 消</el-button> <el-button size="small" @click="dialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="savePoster">确 定</el-button> <el-button size="small" type="primary" @click="savePoster">确 定</el-button>
</span> </span> -->
</el-dialog> </GLDialog>
</div> </div>
</template> </template>
<script> <script>
import util from '@/utils/util' import util from '@/utils/util'
import VueDraggableResizable from '@/components/vue-draggable-resizable' import VueDraggableResizable from '@/components/draggable/vue-draggable-resizable'
import '@/components/vue-draggable-resizable.css' import '@/components/draggable/vue-draggable-resizable.css'
export default { export default {
name: 'poster', name: 'poster',
components: { components: {
...@@ -134,8 +132,8 @@ export default { ...@@ -134,8 +132,8 @@ export default {
}, },
enterPoster() {}, enterPoster() {},
leavePoster() {}, leavePoster() {},
upLoadImg(file) { upLoadImg(e) {
console.log(file.size / 1024 / 1000 > 5) const file = e.srcElement.files[0]
let fileName = file.name let fileName = file.name
if (file.name.lastIndexOf('.') === -1) { if (file.name.lastIndexOf('.') === -1) {
this.$message.info('路径不正确') this.$message.info('路径不正确')
...@@ -178,6 +176,7 @@ export default { ...@@ -178,6 +176,7 @@ export default {
} else { } else {
self.loading = false self.loading = false
} }
self.$refs.file.value = ''
}) })
} }
} }
...@@ -230,13 +229,13 @@ export default { ...@@ -230,13 +229,13 @@ export default {
listChannelCodeBill.forEach(item => { listChannelCodeBill.forEach(item => {
item.show = false item.show = false
item.loadingImg = true item.loadingImg = true
let backUrl = item.autoUrl let backUrl = item.thumbnailUrl ? item.thumbnailUrl : item.autoUrl
this.backUrl = backUrl this.backUrl = backUrl
let img = new Image() let img = new Image()
img.src = backUrl img.src = backUrl
this.loadingImg = true this.loadingImg = true
this.loadingDrag = false this.loadingDrag = false
img.onload = function () { img.onload = function() {
if (img.width > img.height) { if (img.width > img.height) {
item.imgWidth = 280 item.imgWidth = 280
item.imgHeight = (img.height * 280) / img.width item.imgHeight = (img.height * 280) / img.width
...@@ -254,7 +253,7 @@ export default { ...@@ -254,7 +253,7 @@ export default {
let img = new Image() let img = new Image()
img.src = img_url img.src = img_url
let self = this let self = this
img.onload = function () { img.onload = function() {
self.dragHeight = (img.height * 375) / img.width self.dragHeight = (img.height * 375) / img.width
self.dialogVisible = true self.dialogVisible = true
self.loading = false self.loading = false
...@@ -266,7 +265,7 @@ export default { ...@@ -266,7 +265,7 @@ export default {
this.getPoster() this.getPoster()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.channel-main { .channel-main {
...@@ -274,8 +273,16 @@ export default { ...@@ -274,8 +273,16 @@ export default {
min-height: calc(100% - 30px); min-height: calc(100% - 30px);
} }
.image-uploader { .image-uploader {
display: inline-block; position: relative;
height: 20px; cursor: pointer;
.poster-item-link {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
margin: 0 auto !important;
text-align: center;
}
/deep/ { /deep/ {
.el-upload-list { .el-upload-list {
display: none; display: none;
...@@ -344,6 +351,7 @@ export default { ...@@ -344,6 +351,7 @@ export default {
font-weight: 400; font-weight: 400;
color: #999999; color: #999999;
line-height: 20px; line-height: 20px;
margin-bottom: 20px;
img { img {
width: 90px; width: 90px;
height: auto; height: auto;
...@@ -373,4 +381,4 @@ export default { ...@@ -373,4 +381,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template> <template>
<div class="channel-main scrm-box-f"> <div class="channel-main scrm-box-f">
<div><el-button type="primary" size="small" @click="goback">返回</el-button></div>
<div class="detail-form"> <div class="detail-form">
<el-form :model="detailCodeForm" label-width="120px"> <el-form :model="detailCodeForm" label-width="120px">
<el-row> <el-row>
...@@ -34,12 +33,14 @@ ...@@ -34,12 +33,14 @@
<div class="count-panel"> <div class="count-panel">
<div class="count-panel-item"> <div class="count-panel-item">
<div class="count-item-title">今日新增客户</div> <div class="count-item-title">今日新增客户</div>
<div class="count-item-num">{{ detailCodeForm.yesTodayAddCount }}人</div> <div class="count-item-num" @click="handleEmpDetail(detailCodeForm, 'day')" v-if="detailCodeForm.yesTodayAddCount">{{ detailCodeForm.yesTodayAddCount }}人</div>
<div class="count-item-num2" v-else>0人</div>
<img src="@/assets/img/channel/count3.png" class="count-item-icon" /> <img src="@/assets/img/channel/count3.png" class="count-item-icon" />
</div> </div>
<div class="count-panel-item"> <div class="count-panel-item">
<div class="count-item-title">总新增客户</div> <div class="count-item-title">总新增客户</div>
<div class="count-item-num">{{ detailCodeForm.newlyCount }}人</div> <div class="count-item-num" @click="handleEmpDetail(detailCodeForm)" v-if="detailCodeForm.newlyCount">{{ detailCodeForm.newlyCount }}人</div>
<div class="count-item-num2" v-else>0人</div>
<img src="@/assets/img/channel/count2.png" class="count-item-icon" /> <img src="@/assets/img/channel/count2.png" class="count-item-icon" />
</div> </div>
<div class="count-panel-item"> <div class="count-panel-item">
...@@ -49,7 +50,8 @@ ...@@ -49,7 +50,8 @@
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" /> <img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover> </el-popover>
</div> </div>
<div class="count-item-num">{{ detailCodeForm.newlyKeepCount }}人</div> <div class="count-item-num" @click="handleEmpDetail(detailCodeForm, 'status')" v-if="detailCodeForm.newlyKeepCount">{{ detailCodeForm.newlyKeepCount }}人</div>
<div class="count-item-num2" v-else>0人</div>
<img src="@/assets/img/channel/count1.png" class="count-item-icon" /> <img src="@/assets/img/channel/count1.png" class="count-item-icon" />
</div> </div>
</div> </div>
...@@ -58,14 +60,35 @@ ...@@ -58,14 +60,35 @@
<el-tab-pane label="按日期查看" name="1"></el-tab-pane> <el-tab-pane label="按日期查看" name="1"></el-tab-pane>
<el-tab-pane label="按成员查看" name="2"></el-tab-pane> <el-tab-pane label="按成员查看" name="2"></el-tab-pane>
</el-tabs> </el-tabs>
<GLTable v-show="activeName == 1" ref="timeTable" :tableData="getTimeApi" :tableParams="tableParams" :hasNum="false" :hasPage="false"></GLTable> <GLTable v-show="activeName == 1" ref="timeTable" :tableData="getTimeApi" :tableParams="tableParams" :hasNum="false" :hasPage="false">
<GLTable v-show="activeName == 2" @refreshTable="listStaff" :layout="layout" :tableTotal="tableTotal" ref="memberTabel" :tableData="getMemberApi" :tableParams="tableMemberParams" :pageConf="pageMemberConf" :hasNum="false"></GLTable> <div slot="newlyCount" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope, 'day', scope.scope.dayTime)" v-if="scope.scope.newlyCount">{{ scope.scope.newlyCount }}</div>
<div v-else>0</div>
</div>
<div slot="newlyKeepCount" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope, 'status', scope.scope.dayTime)" v-if="scope.scope.newlyKeepCount">{{ scope.scope.newlyKeepCount }}</div>
<div v-else>0</div>
</div>
</GLTable>
<GLTable v-show="activeName == 2" @refreshTable="listStaff" :layout="layout" :tableTotal="tableTotal" ref="memberTabel" :tableData="getMemberApi" :tableParams="tableMemberParams" :pageConf="pageMemberConf" :hasNum="false">
<div slot="newlyCount" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope, 'staffIds')" v-if="scope.scope.newlyCount">{{ scope.scope.newlyCount }}</div>
<div v-else>0</div>
</div>
<div slot="newlyKeepCount" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope, 'statusAndStaffIds')" v-if="scope.scope.newlyKeepCount">{{ scope.scope.newlyKeepCount }}</div>
<div v-else>0</div>
</div>
</GLTable>
<emp-detail ref="empDetailForm"></emp-detail>
</div> </div>
</template> </template>
<script> <script>
import empDetail from './components/empDetail.vue'
export default { export default {
name: 'store', name: 'store',
components: { empDetail },
data() { data() {
return { return {
activeName: '1', activeName: '1',
...@@ -79,11 +102,13 @@ export default { ...@@ -79,11 +102,13 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: '新增客户数', label: '新增客户数',
prop: 'newlyCount' prop: 'newlyCount',
addHtml: 'newlyCount'
}, },
{ {
label: '留存客户数', label: '留存客户数',
prop: 'newlyKeepCount' prop: 'newlyKeepCount',
addHtml: 'newlyKeepCount'
}, },
{ {
label: '日期', label: '日期',
...@@ -101,11 +126,13 @@ export default { ...@@ -101,11 +126,13 @@ export default {
}, },
{ {
label: '新增客户数', label: '新增客户数',
prop: 'newlyCount' prop: 'newlyCount',
addHtml: 'newlyCount'
}, },
{ {
label: '留存客户数', label: '留存客户数',
prop: 'newlyKeepCount' prop: 'newlyKeepCount',
addHtml: 'newlyKeepCount'
}, },
{ {
label: '日期', label: '日期',
...@@ -127,6 +154,9 @@ export default { ...@@ -127,6 +154,9 @@ export default {
goback() { goback() {
this.$router.push('/channel/index') this.$router.push('/channel/index')
}, },
handleEmpDetail(scope, status, day) {
this.$refs.empDetailForm.init(scope, status, day)
},
detailChannelCode(id, codeUuid) { detailChannelCode(id, codeUuid) {
let param = { let param = {
id, id,
...@@ -196,9 +226,13 @@ export default { ...@@ -196,9 +226,13 @@ export default {
this.listStaff() this.listStaff()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.link-dialog {
text-decoration: underline;
cursor: pointer;
}
.channel-main { .channel-main {
padding: 20px; padding: 20px;
.remark-row { .remark-row {
...@@ -306,6 +340,17 @@ export default { ...@@ -306,6 +340,17 @@ export default {
color: #333333; color: #333333;
line-height: 26px; line-height: 26px;
margin-top: 28px; margin-top: 28px;
display: inline-block;
cursor: pointer;
text-decoration: underline;
}
.count-item-num2 {
font-size: 26px;
font-weight: 600;
color: #333333;
line-height: 26px;
margin-top: 28px;
display: inline-block;
} }
.count-item-icon { .count-item-icon {
position: absolute; position: absolute;
...@@ -355,4 +400,4 @@ export default { ...@@ -355,4 +400,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -7,16 +7,13 @@ ...@@ -7,16 +7,13 @@
<div class="drainage-config-wrap"> <div class="drainage-config-wrap">
<div class="drainage-item-label" v-if="configType">平台将识别尚未补充联系方式的企微客户,并自动发送消息提醒对应员工跟进。</div> <div class="drainage-item-label" v-if="configType">平台将识别尚未补充联系方式的企微客户,并自动发送消息提醒对应员工跟进。</div>
<div class="drainage-item-label" v-else>通过企微魔方导入客户数据后,平台将识别尚未添加企微的客户,并自动发送消息提醒对应员工跟进。</div> <div class="drainage-item-label" v-else>通过数据魔方导入客户数据后,平台将识别尚未添加企微的客户,并自动发送消息提醒对应员工跟进。</div>
<div class="drainage-item-switch"> <div class="drainage-item-switch">
<el-switch v-model="addValue" @change="handleAddSwitch" active-color="#5850FF" inactive-color="#999999"></el-switch> <el-switch v-model="addValue" @change="handleAddSwitch" active-color="#5850FF" inactive-color="#999999"></el-switch>
</div> </div>
</div> </div>
<div class="config-title"> <div class="config-title">
<span v-if="!editStatus && !configType" @click="editStatus = true"> <el-button type="primary" icon="el-icon-edit-outline" size="small" v-if="!editStatus && !configType" @click="editStatus = true">编辑配置</el-button>
<label>编辑配置</label>
<i class="el-icon-edit-outline"></i>
</span>
</div> </div>
<div class="config-market" v-if="configType"> <div class="config-market" v-if="configType">
<div class="config-market-item checked"> <div class="config-market-item checked">
...@@ -167,18 +164,11 @@ ...@@ -167,18 +164,11 @@
</div> </div>
</div> </div>
</div> </div>
<div <GLFooter v-if="(editStatus && !configType) || configType">
v-if="(editStatus && !configType) || configType"
class="footer-panel"
:style="{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<el-button type="primary" @click="handleSave" v-if="!configType">确定</el-button> <el-button type="primary" @click="handleSave" v-if="!configType">确定</el-button>
<el-button type="primary" @click="goback" v-if="configType">返回</el-button> <el-button type="primary" @click="goback" v-if="configType">返回</el-button>
<el-button @click="handleCancel" v-if="!configType">取消</el-button> <el-button @click="handleCancel" v-if="!configType">取消</el-button>
</div> </GLFooter>
<select-emp @selectTable="selectTable" ref="selectEmpForm"></select-emp> <select-emp @selectTable="selectTable" ref="selectEmpForm"></select-emp>
</div> </div>
</template> </template>
...@@ -304,7 +294,7 @@ export default { ...@@ -304,7 +294,7 @@ export default {
if (res) { if (res) {
this.configItem = res this.configItem = res
this.addValue = res.delFlag == 0 ? true : false this.addValue = res.delFlag == 0 ? true : false
this.staffIds = res.staffIds?eval(res.staffIds):[] this.staffIds = res.staffIds ? eval(res.staffIds) : []
} }
}) })
}, },
...@@ -326,15 +316,21 @@ export default { ...@@ -326,15 +316,21 @@ export default {
this.findConfig(1) this.findConfig(1)
this.configType = false this.configType = false
} }
},
resize() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
} }
}, },
mounted() { mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.resize()
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.init() this.init()
window.addEventListener('resize', () => {
this.resize()
})
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.footer-panel { .footer-panel {
...@@ -348,7 +344,10 @@ export default { ...@@ -348,7 +344,10 @@ export default {
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1); box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
} }
.drainage-wrap { .drainage-wrap {
margin-bottom: 20px; margin-bottom: 16px;
&:nth-child(2) {
min-height: calc(100vh - 490px);
}
.drainage-title { .drainage-title {
padding-left: 20px; padding-left: 20px;
font-size: 16px; font-size: 16px;
...@@ -454,6 +453,7 @@ export default { ...@@ -454,6 +453,7 @@ export default {
color: #5850ff; color: #5850ff;
line-height: 40px; line-height: 40px;
height: 40px; height: 40px;
margin: 8px 0px;
span { span {
cursor: pointer; cursor: pointer;
} }
...@@ -535,4 +535,4 @@ export default { ...@@ -535,4 +535,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template>
<div class="square-main" v-loading.fullscreen.lock="loading">
<div class="drainage-wrap scrm-box-f">
<div class="drainage-title">营销配置</div>
<div class="form-main">
<div class="drainage-form">
<div class="drainage-form-item">
<label class="is-require" style="line-height: 32px">营销名称</label>
<div style="position: relative">
<el-input @focus="imNameStatus = false" type="type" size="small" placeholder="请输入营销名称" v-model.trim="imName" :disabled="!editStatus" maxlength="30"></el-input>
<div class="el-form-item__error" v-if="imNameStatus">请输入营销名称</div>
</div>
</div>
<div class="drainage-form-item">
<label>群发短信</label>
<div class="message-panel">
<el-form ref="configForm" label-position="left" label-width="100px" :model="addForm" :rules="addRules" class="code-body-form">
<el-form-item label="推送规则:"><div class="configForm-desc">系统将在「开始营销时间」之后启动短信营销,并在「截止营销时间」之后停止短信下放。由于相关管控限制,营销类短信无法实时触达用户,若短信时效要求很高,请谨慎使用。</div></el-form-item>
<el-form-item size="small" label="营销时间" prop="time">
<el-time-picker is-range :disabled="!editStatus" value-format="HH:mm" format="HH:mm" v-model="addForm.time" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围"></el-time-picker>
</el-form-item>
<el-form-item label="短信内容" prop="content">
<el-input type="textarea" v-model="addForm.content" rows="5" :disabled="!editStatus" maxlength="280" show-word-limit></el-input>
<div class="form-tips">70字內(含70字)计一条,超过70字,按70字/条计费。</div>
<div class="form-tips">提示:当前短信已有{{ addForm.content.length }}字,按{{ content.length }}条短信发送且计费。</div>
</el-form-item>
<div class="drainage-form-item">
<label style="width: 100px; text-align: left; color: #666">
自动打标签
<el-popover placement="top" width="400" trigger="hover" content="提示:通过该营销活动添加员工企微的客户,将自动使用以下标签进行标记。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover>
</label>
<div class="drainage-emp">
<template v-for="item in tagging">
<div :key="index" v-for="(tag, index) in item.labelList">
{{ tag.name }}
</div>
</template>
</div>
</div>
</el-form>
</div>
</div>
<div class="drainage-form-item">
<label>
跟进员工
<el-popover placement="top" width="400" trigger="hover" content="用户点击短信中的链接后,将自动分配以下某位员工的企微名片,客户添加好友将自动回复后台所配置的欢迎语。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover>
</label>
<div class="drainage-emp">
<div :key="index" v-for="(item, index) in dracImFollowStaffResponses">
<i class="el-icon-user-solid"></i>
{{ item.staffName }}
</div>
</div>
</div>
</div>
<div class="form-image">
<img src="@/assets/img/marketing/phone.png" />
<div class="preview-content">
<div class="preview-info">
<div class="preview-text text" v-for="(item, index) in content" :key="index">{{ item }}</div>
</div>
</div>
</div>
</div>
</div>
<div class="channel-main-welcome scrm-box-f">
<div class="chanel-form-title">欢迎语</div>
<div class="welcome-panel">
<div class="welcome-switch">
<label>自动发送欢迎语</label>
<el-switch v-model="autoWelcome" :disabled="!editStatus" active-color="#5850FF" inactive-color="#999999"></el-switch>
</div>
<div class="welcome-box" v-show="!editStatus && autoWelcome">
<div class="welcome-box-contaner">
<div :key="index" v-for="(item, index) in welcomeInfo">
<div v-if="item.attType == 1">
<div v-html="item.attContent" class="welcome-box-name"></div>
</div>
<div v-else-if="item.attType == 2">
<img src="@/assets/img/guestCustom/icon-img.png" alt="" />
<span>{{ item.attContent }}</span>
</div>
<div v-else-if="item.attType == 3">
<img src="@/assets/img/guestCustom/icon-img.png" alt="" />
<span>{{ item.attContent }}</span>
</div>
<div v-else-if="item.attType == 4">
<img src="@/assets/img/guestCustom/icon-link.png" alt="" />
<span>{{ item.attContent }}</span>
</div>
<div v-else-if="item.attType == 5">
<img src="@/assets/img/guestCustom/icon-applet.png" alt="" />
<span>{{ item.attContent }}</span>
</div>
<div v-else-if="item.attType == 6">
<img src="@/assets/img/guestCustom/icon-applet.png" alt="" />
<span>{{ JSON.parse(item.attContent).fileName }}</span>
</div>
<div v-else-if="item.attType == 7">
<img src="@/assets/img/guestCustom/icon-applet.png" alt="" />
<span>{{ item.attContent.marketingName }}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue'
export default {
name: 'configInfo',
data() {
return {
loading: false,
welcomeInfo: [],
eventBus: new Vue(),
taggingLength: 0,
autoWelcome: true,
imName: '',
imNameStatus: false,
empStatus: false,
importName: null,
exportUrl: null,
editStatus: false,
saveStatus: false,
importStatus: false,
ExportDracImResponse: {},
footerLeft: 0,
footerWidth: 0,
addForm: {
desc: '',
content: '',
time: ['9:00:00', '18:00:00']
},
content: [],
editId: null,
tagging: [],
messageItem: {},
dialogVisible: true,
value: false,
value1: false,
dracImFollowStaffResponses: [],
dracImMessageConfigAddRequest: {},
ModelItem: {}
}
},
watch: {
'addForm.content': {
handler: function() {
this.content = []
let str = this.addForm.content
let num = 70
let len = str.length
for (let i = 0; i < len / num; i++) {
let str1 = str.substring(i * num, (i + 1) * num)
this.content.push(str1)
}
}
},
importName: {
handler() {
this.saveStatus = true
},
deep: true
},
imName: {
handler() {
this.saveStatus = true
},
deep: true
},
autoWelcome: {
handler() {
this.saveStatus = true
},
deep: true
},
addForm: {
handler() {
this.saveStatus = true
},
deep: true
},
tagging: {
handler: function() {
this.taggingLength = 0
this.tagging.forEach(item => {
this.taggingLength += item.labelList.length
})
this.saveStatus = true
},
deep: true
},
dracImFollowStaffResponses: {
handler() {
this.saveStatus = true
},
deep: true
}
},
methods: {
goback() {
this.importStatus = false
},
findById(id) {
this.$apis.marketing.findById({ id }).then(res => {
this.$nextTick(() => {
this.$refs.configForm.validate()
})
this.dracImFollowStaffResponses = res.dracImFollowStaffResponses
this.addForm.time = [res.dracImMessageConResponse.startTime, res.dracImMessageConResponse.endTime]
this.addForm.content = res.dracImMessageConResponse.content
this.imName = res.imName
this.autoWelcome = res.autoWelcome ? true : false
const previewList = res.dracScrmWelcomeConfigDTOS.map(item => {
if (item.attType == 7) item.attContent = JSON.parse(item.attContent)
if (item.attType == 1) item.attContent = item.attContent.replaceAll('[@昵称]', '<span style="color:#5850FF">@昵称</span>').replaceAll(/\n/g, '<br>')
return item
})
console.log(previewList)
this.welcomeInfo = previewList
const tagging = eval(res.tagging)
const taggingList = tagging.map(item => {
let name = item.name.split(',')
let ids = item.tagIds.split(',')
console.log(ids)
let labelList = name.map((tag, index) => {
return { id: ids[index], name: tag }
})
return {
labelGroup: {
id: item.groupId,
name: item.labelType
},
labelList
}
})
this.tagging = taggingList
this.$nextTick(() => {
this.saveStatus = false
})
})
}
},
mounted() {
let { id } = this.$route.params
this.editId = id
this.findById(id)
}
}
</script>
<style lang="scss" scoped>
.channel-main-welcome {
margin: 20px 0px 16px;
.chanel-form-title {
padding-left: 20px;
font-size: 16px;
font-weight: 600;
color: #333333;
line-height: 57px;
height: 57px;
border-bottom: 1px solid #d8d8d8;
}
.welcome-panel {
margin: 10px;
padding: 0px 42px 20px;
.welcome-switch {
margin-bottom: 20px;
label {
margin-right: 10px;
font-size: 14px;
font-weight: 400;
color: #666666;
}
}
.welcome-box {
margin-left: 48px;
&-contaner {
margin: 20px;
background: rgba(247, 247, 247, 0.52);
border-radius: 2px;
line-height: 22px;
padding: 10px;
min-width: 500px;
}
img {
width: 16px;
height: 16px;
vertical-align: sub;
margin-right: 5px;
}
}
}
}
.footer-panel {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 0px;
height: 64px;
background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
.image-uploader {
display: inline-block;
margin-bottom: 6px;
width: 100px;
position: relative;
input {
cursor: pointer;
position: absolute;
top: 0px;
width: 100%;
height: 100%;
font-size: 0px;
}
/deep/ {
.el-upload-list {
display: none;
}
}
}
.import-panel {
z-index: 2001;
position: fixed;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
&-box {
width: 712px;
height: 266px;
background: #ffffff;
border-radius: 4px;
padding: 20px;
box-sizing: border-box;
.import-title {
font-size: 20px;
font-weight: 500;
color: #424242;
line-height: 28px;
}
.import-num-panel {
display: flex;
margin: 10px;
.import-num-item {
width: 50%;
height: 140px;
text-align: center;
display: table-cell;
vertical-align: middle;
.import-num {
margin-top: 40px;
font-size: 20px;
font-weight: 500;
color: rgba(0, 0, 0, 0.85);
line-height: 28px;
}
.import-num-h2 {
font-size: 14px;
font-weight: 400;
color: rgba(0, 0, 0, 0.65);
line-height: 22px;
}
}
}
.import-footer {
display: flex;
justify-content: space-between;
}
}
}
.drainage-wrap {
margin-bottom: 20px;
&:nth-child(2) {
margin-bottom: 20px;
}
.drainage-title {
padding-left: 20px;
font-size: 16px;
font-weight: 600;
color: #333333;
line-height: 57px;
height: 57px;
border-bottom: 1px solid #d8d8d8;
}
.form-main {
display: flex;
.form-image {
width: 280px;
height: 546px;
margin: 20px 10px;
position: relative;
.preview-content {
position: absolute;
width: 250px;
height: 320px;
overflow-y: auto;
top: 125px;
left: 50px;
.preview-text {
padding: 10px;
position: relative;
width: 160px;
color: #333;
background-color: #f4f4f4;
border-radius: 4px;
word-wrap: break-word;
margin-bottom: 10px;
}
}
img {
width: 100%;
height: auto;
}
}
.drainage-form {
flex: 1;
}
}
.form-tips {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
margin-top: 5px;
}
.drainage-form {
padding: 20px;
.drainage-form-item {
display: flex;
margin-top: 20px;
/deep/ {
.el-input__inner {
width: 448px;
}
}
label {
width: 120px;
text-align: right;
margin-right: 20px;
height: 36px;
line-height: 36px;
img {
width: 14px;
height: 14px;
vertical-align: middle;
margin-left: 5px;
}
&.is-require {
&::before {
content: '*';
color: #f56c6c;
margin-right: 4px;
}
}
}
}
/deep/ {
.el-textarea__inner {
border-radius: 0px;
border: 1px solid #dcdfe6;
}
}
.select-panel {
padding-left: 20px;
background: #fff;
display: flex;
font-size: 14px;
font-weight: 400;
color: #717171;
line-height: 30px;
border: 1px solid #dcdfe6;
border-top: 0px;
> div {
cursor: pointer;
margin-right: 10px;
span {
margin-left: 3px;
}
}
}
.upload-box {
margin-bottom: 10px;
.upload-file-panel {
display: flex;
align-items: center;
> a {
margin-left: 10px;
text-decoration: underline;
font-size: 12px;
font-weight: 400;
color: #5850ff;
line-height: 17px;
}
}
.upload-btn {
text-align: center;
width: 96px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #dcdfe6;
font-size: 14px;
font-weight: 400;
color: #999999;
padding: 6px 0px;
}
.upload-tips {
margin-top: 6px;
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 20px;
}
}
.message-panel {
background: #f7f7f7;
border: 1px solid #dcdfe6;
padding: 20px;
flex: 1;
box-sizing: border-box;
font-size: 14px;
color: #3a3a3a;
.configForm-desc {
margin-top: 10px;
line-height: 20px;
}
}
.drainage-emp {
display: flex;
margin-top: 6px;
flex-wrap: wrap;
div {
text-align: left;
position: relative;
font-size: 14px;
line-height: 14px;
padding-left: 15px;
-webkit-border-radius: 4px;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 6px;
display: inline-block;
margin-bottom: 5px;
margin-right: 5px;
i {
color: #75acff;
}
}
}
.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 5px 0px 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;
}
}
.el-tag {
margin-right: 4px;
height: 26px;
line-height: 24px;
margin-bottom: 5px;
}
.tag-item-panel {
display: flex;
}
.drainage-coutom-count {
font-size: 14px;
font-weight: 400;
color: #7d7d7d;
line-height: 36px;
margin-left: 20px;
}
}
.drainage-panel {
padding: 20px;
.drainage-config-wrap {
display: flex;
justify-content: space-between;
align-items: center;
.drainage-item-label {
width: 50%;
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
}
}
.config-title {
font-size: 14px;
font-weight: 400;
color: #5850ff;
line-height: 20px;
margin: 20px 0px;
i {
margin-left: 6px;
}
}
.config-market {
display: flex;
&-item {
position: relative;
padding: 10px;
width: 50%;
height: 150px;
background: #f6f6ff;
border-radius: 4px;
opacity: 0.8;
box-sizing: border-box;
&:first-child {
margin-right: 20px;
}
&.checked {
border: 1px solid #5850ff;
.config-market-title {
color: #5850ff;
}
.config-market-icon {
background: linear-gradient(153deg, #8085ef 0%, #6f76ee 100%, #6f76ee 100%) !important;
}
.config-market-name {
color: #333333 !important;
}
.config-line {
border: 1px solid #5850ff !important;
}
}
.config-market-title {
font-size: 16px;
font-weight: 400;
color: #999999;
line-height: 22px;
text-align: center;
}
.config-switch-icon {
position: absolute;
right: 10px;
top: 10px;
}
.config-market-select {
display: flex;
.config-market-s1 {
width: 33.33%;
margin: 0 auto;
text-align: center;
position: relative;
.config-line {
position: absolute;
top: 45px;
right: -30%;
width: 60%;
border: 1px solid #999999;
}
.config-market-icon {
width: 56px;
height: 56px;
background: #999999;
border-radius: 50%;
margin: 20px auto 10px;
}
.config-market-name {
font-size: 14px;
font-weight: 400;
color: #adadad;
line-height: 20px;
}
}
}
}
}
}
}
</style>
<template>
<div>
<div class="form-panel scrm-box-f">
<el-form :inline="true" :model="tableSearchForm" class="follow-form-item">
<el-row>
<el-form-item size="small" label="手机号">
<el-input size="small" v-model="tableSearchForm.phone" placeholder="请输入手机号"></el-input>
</el-form-item>
<el-form-item size="small" label="发送状态" style="margin-left: 20px">
<el-select v-model="tableSearchForm.status" placeholder="请选择">
<el-option v-for="item in optionstatus" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item size="small" label="客户姓名" style="margin-left: 20px">
<el-input size="small" v-model="tableSearchForm.customerName" placeholder="请输入客户姓名"></el-input>
</el-form-item>
<el-form-item size="small" style="float: right">
<el-button @click="handleReset">重置</el-button>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-row>
</el-form>
<GLTable v-loading="loading" ref="table" @refreshTable="handleSearch" :searchForm="tableSearchForm" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams">
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">短信内容</el-button>
</div>
</GLTable>
<GLDialog title="提示" :hasFooter="true" :content="messageContent" :visible.sync="dialogVisible" mode="small">
<span slot="footer" class="dialog-footer">
<el-button size="small" type="primary" @click="dialogVisible = false">
确定
</el-button>
</span>
</GLDialog>
</div>
</div>
</template>
<script>
import util from '@/utils/util'
export default {
name: 'customList',
data() {
return {
loading: false,
messageContent: '',
tableSearchForm: {},
dialogVisible: false,
tableData: [],
optionstatus: [
{
value: '',
label: '全部'
},
{
value: '0',
label: '未发送'
},
{
value: '1',
label: '已发送'
}
],
tableParams: {
listName: 'data',
tableOption: false,
tableColumns: [
{
label: '手机号',
prop: 'phone'
},
{
label: '客户姓名',
prop: 'customerName'
},
{
label: '发送状态',
prop: 'statusName'
},
{
label: '发送时间',
prop: 'sendTime'
},
{
label: '操作',
prop: 'optionBtns',
width: '140px',
addHtml: 'optionBtns',
fixed: 'right'
}
]
},
layout: 'sizes, prev, pager, next, jumper, ->, total',
tableTotal: 0,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }
}
},
methods: {
handleDetail(scope) {
this.dialogVisible = true
this.messageContent = scope.content
},
handleSearch() {
this.listChannelCodeByPage()
},
handleReset() {
this.tableSearchForm = {}
this.listChannelCodeByPage()
},
listChannelCodeByPage() {
const { id } = this.$route.params
const params = {
...JSON.parse(JSON.stringify(this.tableSearchForm)),
pageSize: this.$refs.table.page.pageSize,
pageNum: this.$refs.table.page.pageNum,
id
}
this.loading = true
this.$apis.marketing.customerPage(params).then(res => {
this.loading = false
if (res) {
this.tableData = res.data
this.tableData.forEach(item => {
this.$set(item, 'taggingList', [])
const tagging = eval(item.tagging)
if (tagging && tagging.length > 0) {
tagging.forEach(itm => {
let name = itm.name.split(',')
name.forEach((tag, index) => {
item.taggingList.push({ name: tag })
})
})
}
})
this.tableTotal = res.count
}
})
}
},
mounted() {
this.listChannelCodeByPage()
}
}
</script>
<style>
.el-popover {
max-width: 800px;
}
</style>
<style lang="scss" scoped>
.popover-panel {
width: 1000px;
}
.form-header {
margin-bottom: 20px;
}
.form-panel {
padding: 20px;
margin-bottom: 60px;
/deep/ .el-popover {
max-width: 1000px;
}
}
.download-link {
cursor: pointer;
margin-top: 6px;
font-size: 14px;
font-weight: 400;
color: #666666;
line-height: 20px;
}
.codeRemark {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 20px;
}
.tag-panel {
.tag-item {
border-radius: 4px;
border: 1px solid #e8e8ea;
display: inline-block;
padding: 4px 6px;
margin-right: 3px;
margin-bottom: 3px;
}
}
.allTagsWrap {
position: relative;
display: -webkit-box;
// max-height: 56px;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
padding-bottom: -2px;
box-sizing: border-box;
// &:hover {
// -webkit-line-clamp: 9999;
// // .tag-box-wrap {
// // margin-bottom: 10px;
// // }
// }
.tag-box-wrap {
display: inline-block;
margin-right: 10px;
// margin-bottom: 2px;
padding: 0 10px;
box-sizing: border-box;
min-width: 76px;
max-width: 200px;
height: 26px;
line-height: 26px;
border-radius: 4px;
border: 1px solid #e8e8ea;
background: #fafbfe;
text-align: center;
font-size: 14px;
font-weight: 400;
color: #666666;
max-width: 245px;
cursor: pointer;
margin-bottom: 3px;
// &:first-child{
// margin-bottom: 4px;
// }
}
// .tag-box-wrap + .tag-box-wrap {
// margin-bottom: 4px;
// }
.expande-button-wrap {
position: absolute;
right: 0;
bottom: 0;
.expande-button {
color: #fafbfe;
cursor: pointer;
i {
height: 8px;
}
span {
height: 20px;
font-size: 14px;
font-weight: 400;
color: #fafbfe;
line-height: 20px;
}
}
}
}
.link-dialog {
text-decoration: underline;
cursor: pointer;
}
.accountType-row {
text-align: left;
position: relative;
font-size: 14px;
line-height: 14px;
padding-left: 15px;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 6px;
display: inline-block;
margin-bottom: 5px;
margin-right: 5px;
&-tag {
display: inline-block;
border: 1px solid #e8e8ea;
background: #fafbfe;
text-align: center;
font-size: 14px;
font-weight: 400;
color: #666;
max-width: 150px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
i {
color: #75acff;
margin-right: 3px;
}
// &::before {
// content: '';
// position: absolute;
// width: 6px;
// height: 6px;
// background: #5850ff;
// border-radius: 8px;
// left: 0px;
// top: 7px;
// }
}
</style>
...@@ -8,12 +8,8 @@ ...@@ -8,12 +8,8 @@
> >
<div class="model-panel"> <div class="model-panel">
<div class="model-panel-tab"> <div class="model-panel-tab">
<label>模板类型:</label> <el-input v-model="keyword" placeholder="请输入关键字" width="215px" size="small"></el-input>
<el-tabs v-model="activeName" @tab-click="handleClick" type="card"> <el-button type="primary" @click="handleSearch" size="small">查询</el-button>
<el-tab-pane label="售前" name="1"></el-tab-pane>
<el-tab-pane label="售中" name="2"></el-tab-pane>
<el-tab-pane label="售后" name="3"></el-tab-pane>
</el-tabs>
</div> </div>
<div class="model-item-panel" v-if="modelList.length>0" v-loading="loading"> <div class="model-item-panel" v-if="modelList.length>0" v-loading="loading">
<div class="model-item" v-for="(item, index) in modelList" :key="index"> <div class="model-item" v-for="(item, index) in modelList" :key="index">
...@@ -57,6 +53,7 @@ export default { ...@@ -57,6 +53,7 @@ export default {
name: "activityModel", name: "activityModel",
data() { data() {
return { return {
keyword: '',
dialogVisible: false, dialogVisible: false,
loading: false, loading: false,
activeName: "1", activeName: "1",
...@@ -69,6 +66,7 @@ export default { ...@@ -69,6 +66,7 @@ export default {
}, },
methods: { methods: {
init() { init() {
this.keyword = '';
this.messageRadio = {}; this.messageRadio = {};
this.dialogVisible = true; this.dialogVisible = true;
this.dracImMessage(); this.dracImMessage();
...@@ -85,7 +83,7 @@ export default { ...@@ -85,7 +83,7 @@ export default {
let params = { let params = {
pageSize: this.pageSize, pageSize: this.pageSize,
pageNum: this.pageNum, pageNum: this.pageNum,
type: this.activeName, keyword: this.keyword
}; };
this.$apis.marketing.dracImMessage(params).then((res) => { this.$apis.marketing.dracImMessage(params).then((res) => {
this.messageRadio = {}; this.messageRadio = {};
...@@ -94,6 +92,9 @@ export default { ...@@ -94,6 +92,9 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
handleSearch() {
this.dracImMessage();
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`); console.log(`每页 ${val} 条`);
}, },
...@@ -117,8 +118,9 @@ export default { ...@@ -117,8 +118,9 @@ export default {
line-height: 24px; line-height: 24px;
} }
/deep/ { /deep/ {
.el-checkbox:last-of-type { .el-input,.el-input__inner {
margin-right: 8px; width: 320px;
margin-right: 20px;
} }
.el-tabs__nav { .el-tabs__nav {
border: 0; border: 0;
......
...@@ -4,24 +4,82 @@ ...@@ -4,24 +4,82 @@
<div class="drainage-title">指定客户</div> <div class="drainage-title">指定客户</div>
<div class="drainage-form"> <div class="drainage-form">
<div class="drainage-form-item"> <div class="drainage-form-item">
<label>指定方式</label>
<div class="upload-box drainage-type">
<el-radio-group v-model="selectType">
<el-radio :label="1">通过标签筛选</el-radio>
<el-radio :label="3">通过人群筛选</el-radio>
<el-radio :label="2">通过Excel导入</el-radio>
</el-radio-group>
</div>
</div>
<div class="drainage-form-item" v-if="selectType == 1">
<label>客户信息</label>
<div class="upload-box">
<el-button size="small" @click="handleScreenTag">
<i class="el-icon-plus"></i>
筛选标签
</el-button>
<span class="tag-count">
(已选标签共关联
{{ contactNum }}
个客户)
</span>
<div class="el-input-tag input-tag-wrapper" v-if="labeling.length > 0">
<template v-for="(item, index) in labeling">
<el-tag type="info" v-for="(tag, idx) in item.labelList" :key="idx" closable :disable-transitions="false" @close="removeTypeTag(item, idx, index)">
{{ tag.name }}
</el-tag>
</template>
</div>
<div class="upload-tips">提示:系统将自动过滤未补充手机号的客户</div>
</div>
</div>
<div class="drainage-form-item" v-if="selectType == 3">
<label>客户信息</label>
<div class="upload-box">
<el-button size="small" @click="handleCrowd">
<i class="el-icon-plus"></i>
筛选人群
</el-button>
<span class="tag-count">
(已选人群共关联
{{ contactNum }}
个客户)
</span>
<div class="el-input-tag input-tag-wrapper" v-if="crowding.length > 0">
<template v-for="(item, index) in crowding">
<el-tag type="info" :key="item.crowdId" closable :disable-transitions="false" @close="removeCrowding(index)">
{{ item.crowdName }}
</el-tag>
</template>
</div>
<div class="upload-tips">提示:若用户同时属于多个选中人群,系统将自动去重</div>
</div>
</div>
<div class="drainage-form-item" v-if="selectType == 2">
<label>客户信息</label> <label>客户信息</label>
<div class="upload-box"> <div class="upload-box">
<div class="upload-file-panel"> <div class="upload-file-panel">
<el-upload action="" class="image-uploader" :before-upload="uploadFile"> <div class="image-uploader">
<div class="upload-btn"> <div class="upload-btn">
<i class="el-icon-upload2"></i> <i class="el-icon-upload2"></i>
上传文件 上传文件
</div> </div>
</el-upload> <input type="file" style="opacity: 0" ref="file" accept="*" @change="uploadFile" />
</div>
<a class="download-url" href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/客户信息导入模板.xlsx">下载导入模版</a> <a class="download-url" href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/客户信息导入模板.xlsx">下载导入模版</a>
</div> </div>
<div class="upload-tips" v-if="importName">{{ importName }}</div> <div class="upload-result" v-if="importName">
<div class="upload-result-input">{{ importName }}</div>
<i class="el-icon-delete" @click="clearFile"></i>
</div>
<div class="upload-tips">支持扩展名:xlsx、xls</div> <div class="upload-tips">支持扩展名:xlsx、xls</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="drainage-wrap scrm-box-f"> <div :class="['drainage-wrap', 'scrm-box-f', { 'drainage-bottom': dracImFollowStaffResponses.length == 0 }]">
<div class="drainage-title">营销配置</div> <div class="drainage-title">营销配置</div>
<div class="form-main"> <div class="form-main">
<div class="drainage-form"> <div class="drainage-form">
...@@ -50,13 +108,19 @@ ...@@ -50,13 +108,19 @@
<div class="form-tips">70字內(含70字)计一条,超过70字,按70字/条计费。</div> <div class="form-tips">70字內(含70字)计一条,超过70字,按70字/条计费。</div>
<div class="form-tips">提示:当前短信已有{{ addForm.content.length }}字,按{{ content.length }}条短信发送且计费。</div> <div class="form-tips">提示:当前短信已有{{ addForm.content.length }}字,按{{ content.length }}条短信发送且计费。</div>
</el-form-item> </el-form-item>
<el-form-item label="自动打标签"> <div class="drainage-form-item">
<label style="width: 100px; text-align: left; color: #666">
自动打标签
<el-popover placement="top" width="400" trigger="hover" content="提示:通过该营销活动添加员工企微的客户,将自动使用以下标签进行标记。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover>
</label>
<div class="tag-item-panel" v-if="editStatus"> <div class="tag-item-panel" v-if="editStatus">
<div> <div>
<el-button size="small" @click="handleAddTag">添加</el-button> <el-button size="small" @click="handleAddTag">添加</el-button>
<div class="el-input-tag input-tag-wrapper" v-if="taggingLength"> <div class="el-input-tag input-tag-wrapper" v-if="taggingLength">
<template v-for="(item,index) in tagging"> <template v-for="(item, index) in tagging">
<el-tag type="info" v-for="(tag, idx) in item.labelList" :key="idx" closable :disable-transitions="false" @close="removeTag(item, idx,index)"> <el-tag type="info" v-for="(tag, idx) in item.labelList" :key="idx" closable :disable-transitions="false" @close="removeTag(item, idx, index)">
{{ tag.name }} {{ tag.name }}
</el-tag> </el-tag>
</template> </template>
...@@ -70,12 +134,17 @@ ...@@ -70,12 +134,17 @@
</div> </div>
</template> </template>
</div> </div>
</el-form-item> </div>
</el-form> </el-form>
</div> </div>
</div> </div>
<div class="drainage-form-item" v-if="editStatus"> <div class="drainage-form-item" v-if="editStatus">
<label class="is-require">跟进员工</label> <label class="is-require">
跟进员工
<el-popover placement="top" width="400" trigger="hover" content="用户点击短信中的链接后,将自动分配以下某位员工的企微名片,客户添加好友将自动回复后台所配置的欢迎语。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover>
</label>
<div style="position: relative"> <div style="position: relative">
<el-button size="small" @click="handleAddEmp"> <el-button size="small" @click="handleAddEmp">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
...@@ -92,7 +161,12 @@ ...@@ -92,7 +161,12 @@
</div> </div>
</div> </div>
<div class="drainage-form-item" v-else> <div class="drainage-form-item" v-else>
<label>跟进员工</label> <label>
跟进员工
<el-popover placement="top" width="400" trigger="hover" content="用户点击短信中的链接后,将自动分配以下某位员工的企微名片,客户添加好友将自动回复后台所配置的欢迎语。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover>
</label>
<div class="drainage-emp"> <div class="drainage-emp">
<div :key="index" v-for="(item, index) in dracImFollowStaffResponses"> <div :key="index" v-for="(item, index) in dracImFollowStaffResponses">
<i class="el-icon-user-solid"></i> <i class="el-icon-user-solid"></i>
...@@ -111,7 +185,7 @@ ...@@ -111,7 +185,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="channel-main-welcome scrm-box-f"> <div class="channel-main-welcome scrm-box-f" v-if="dracImFollowStaffResponses.length">
<div class="chanel-form-title">欢迎语</div> <div class="chanel-form-title">欢迎语</div>
<div class="welcome-panel"> <div class="welcome-panel">
<div class="welcome-switch"> <div class="welcome-switch">
...@@ -119,7 +193,7 @@ ...@@ -119,7 +193,7 @@
<el-switch v-model="autoWelcome" :disabled="!editStatus" active-color="#5850FF" inactive-color="#999999"></el-switch> <el-switch v-model="autoWelcome" :disabled="!editStatus" active-color="#5850FF" inactive-color="#999999"></el-switch>
</div> </div>
<div class="welcome-box" v-show="editStatus && autoWelcome"> <div class="welcome-box" v-show="editStatus && autoWelcome">
<welcome-words :eventBus="eventBus" ref="welcome"></welcome-words> <GLEditor ref="welcome" :form="'customer'" :btnList="btnList" @previewWord="previewForm"></GLEditor>
</div> </div>
<div class="welcome-box" v-show="!editStatus && autoWelcome"> <div class="welcome-box" v-show="!editStatus && autoWelcome">
<div class="welcome-box-contaner"> <div class="welcome-box-contaner">
...@@ -152,16 +226,10 @@ ...@@ -152,16 +226,10 @@
</div> </div>
</div> </div>
</div> </div>
<div <GLFooter>
class="footer-panel"
:style="{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<el-button type="primary" @click="handleSave">提交</el-button>
<el-button @click="handleCancel">取消</el-button> <el-button @click="handleCancel">取消</el-button>
</div> <el-button type="primary" @click="handleSave">提交</el-button>
</GLFooter>
<div class="import-panel" v-if="importStatus"> <div class="import-panel" v-if="importStatus">
<div class="import-panel-box"> <div class="import-panel-box">
<div class="import-title">操作结果</div> <div class="import-title">操作结果</div>
...@@ -181,8 +249,11 @@ ...@@ -181,8 +249,11 @@
</div> </div>
</div> </div>
</div> </div>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisible = false" type="warning" content="当前有内容信息未保存,是否继续返回?" :visible.sync="dialogVisible" mode="small"></GLDialog>
<select-emp ref="selectEmpForm" @selectTable="selectTable"></select-emp> <select-emp ref="selectEmpForm" @selectTable="selectTable"></select-emp>
<select-tag ref="selectTagForm" @tagSelected="tagSelected"></select-tag> <select-tag ref="selectTagForm" @tagSelected="tagSelected"></select-tag>
<screen-tag ref="screenTagForm" @tagScreened="tagScreened"></screen-tag>
<select-crowd ref="selectCrowdForm" @crowdData="crowdChecked"></select-crowd>
<activity-model ref="selectModelForm" @selectActivity="selectActivity"></activity-model> <activity-model ref="selectModelForm" @selectActivity="selectActivity"></activity-model>
<message-model ref="selectMessageForm" @selectItem="selectItem"></message-model> <message-model ref="selectMessageForm" @selectItem="selectItem"></message-model>
</div> </div>
...@@ -190,23 +261,44 @@ ...@@ -190,23 +261,44 @@
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import welcomeWords from '@/components/welcome/welcomeWords.vue' import word from '@/mixins/word'
import selectEmp from '@/components/selectEmp' import selectEmp from '@/components/selectEmp'
import selectTag from '@/components/selectTag' import selectTag from '@/components/selectTag'
import screenTag from '@/components/screenTag'
import selectCrowd from '@/components/selectCrowd'
import messageModel from './components/messageModel' import messageModel from './components/messageModel'
import util from '@/utils/util'
const validateTime = (rule, value, callback) => {
if ((new Date(`2000-1-1 ${value[1]}`).getTime() - new Date(`2000-1-1 ${value[0]}`).getTime()) / (1000 * 60) < 120) {
callback(new Error('因营销类短信内容需人工审核,建议预留2小时的营销时长。'))
} else {
callback()
}
}
const validateContent = (rule, value, callback) => {
console.log(value)
if (value == `【${Vue.prototype.$globalState.session.merchantName}】`) {
callback(new Error('请选择短信模板'))
} else {
callback()
}
}
export default { export default {
mixins: [word],
name: 'config', name: 'config',
components: { components: {
selectEmp, selectEmp,
selectTag, selectTag,
messageModel, screenTag,
welcomeWords selectCrowd,
messageModel
}, },
data() { data() {
return { return {
contactNum: 0,
selectType: 1,
loading: false, loading: false,
welcomeInfo: [], welcomeInfo: [],
eventBus: new Vue(),
taggingLength: 0, taggingLength: 0,
autoWelcome: true, autoWelcome: true,
imName: '', imName: '',
...@@ -215,34 +307,44 @@ export default { ...@@ -215,34 +307,44 @@ export default {
importName: null, importName: null,
exportUrl: null, exportUrl: null,
editStatus: true, editStatus: true,
saveStatus: false,
importStatus: false, importStatus: false,
ExportDracImResponse: {}, ExportDracImResponse: {},
footerLeft: 0, footerLeft: 0,
footerWidth: 0, footerWidth: 0,
addForm: { addForm: {
desc: '', desc: '',
content: '', content: `【${this.$globalState.session.merchantName}】`,
time: '' time: ['9:00:00', '18:00:00']
}, },
content: [], content: [],
editId: null, editId: null,
tagging: [], tagging: [],
labeling: [],
crowding: [],
messageItem: {}, messageItem: {},
dialogVisible: true, dialogVisible: false,
value: false, value: false,
value1: false, value1: false,
dracImFollowStaffResponses: [], dracImFollowStaffResponses: [],
dracImMessageConfigAddRequest: {}, dracImMessageConfigAddRequest: {},
ModelItem: {}, ModelItem: {},
merchantName: this.$globalState.session.merchantName,
addRules: { addRules: {
time: [{ required: true, message: '请选择营销时间', trigger: 'change' }], time: [
content: [{ required: true, message: '请选择短信模板', trigger: 'change' }] { required: true, message: '请选择营销时间', trigger: 'change' },
{ validator: validateTime, trigger: 'change' }
],
content: [
{ required: true, message: '请选择短信模板', trigger: 'change' },
{ validator: validateContent, trigger: 'blur' }
]
} }
} }
}, },
watch: { watch: {
'addForm.content': { 'addForm.content': {
handler: function () { handler: function() {
this.content = [] this.content = []
let str = this.addForm.content let str = this.addForm.content
let num = 70 let num = 70
...@@ -253,34 +355,148 @@ export default { ...@@ -253,34 +355,148 @@ export default {
} }
} }
}, },
importName: {
handler() {
this.saveStatus = true
},
deep: true
},
imName: {
handler() {
this.saveStatus = true
},
deep: true
},
autoWelcome: {
handler() {
this.saveStatus = true
},
deep: true
},
addForm: {
handler() {
this.saveStatus = true
},
deep: true
},
tagging: { tagging: {
handler: function () { handler: function() {
this.taggingLength = 0 this.taggingLength = 0
this.tagging.forEach(item => { this.tagging.forEach(item => {
this.taggingLength += item.labelList.length this.taggingLength += item.labelList.length
}) })
this.saveStatus = true
},
deep: true
},
crowding: {
handler() {
console.log(this.crowding)
if (this.crowding.length == 0) {
this.contactNum = 0
return
}
this.handleSaveImport()
},
deep: true
},
labeling: {
handler() {
console.log(this.labeling.length)
if (this.labeling.length == 0) {
this.contactNum = 0
this.filterTagging = []
return
}
this.filterTagging = this.labeling.map(item => {
return {
groupId: item.labelGroup.id,
groupName: item.labelGroup.name,
groupType: item.labelType,
labelId: item.labelList[0].id,
labelName: item.labelList[0].name
}
})
this.handleSaveImport()
},
deep: true
},
dracImFollowStaffResponses: {
handler() {
this.saveStatus = true
}, },
deep: true deep: true
},
selectType(newVal, oldVal) {
if ((oldVal == 1 && this.labeling.length > 0) || (oldVal == 3 && this.crowding.length > 0)) {
this.$confirm('更换指定方式将重置客户列表', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.labeling = []
this.crowding = []
this.contactNum = 0
console.log('清空')
})
.catch(() => {
this.selectType = oldVal
})
}
if (oldVal == 1 && this.importName) {
this.$confirm('更换指定方式将重置客户列表', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.clearFile()
console.log('清空了')
})
.catch(() => {
this.selectType = oldVal
})
}
} }
}, },
methods: { methods: {
clearFile() {
this.importName = null
this.exportUrl = null
this.$refs.file.value = ''
},
importError(url) { importError(url) {
window.open(url) util.openUrl(url)
}, },
goback() { goback() {
this.importStatus = false this.importStatus = false
}, },
handleCancel() { handleSure() {
this.$router.push('/market/index') this.$router.push('/market/index')
}, },
handleCancel() {
console.log(this.saveStatus)
if (this.saveStatus || (this.$refs.welcome && this.$refs.welcome.previewList.length > 0 && this.editStatus)) {
this.dialogVisible = true
} else {
this.$router.push('/market/index')
}
},
selectItem(item) { selectItem(item) {
this.messageItem = item this.messageItem = item
this.addForm.content = item.content this.addForm.content = `【${this.merchantName}】${item.content}`
}, },
//打标签
tagSelected(item) { tagSelected(item) {
this.tagging = item this.tagging = item
}, },
uploadFile(file) { //选择标签
tagScreened(item) {
this.labeling = item
},
uploadFile(e) {
const file = e.srcElement.files[0]
let AllImgExt = '.xls|.xlsx' let AllImgExt = '.xls|.xlsx'
let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase() let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
console.log(extName) console.log(extName)
...@@ -297,6 +513,7 @@ export default { ...@@ -297,6 +513,7 @@ export default {
this.$apis.common.pictureUpload({ file: fileUrl }).then(res => { this.$apis.common.pictureUpload({ file: fileUrl }).then(res => {
this.importName = file.name this.importName = file.name
this.exportUrl = res this.exportUrl = res
this.$refs.file.value = ''
this.handleSaveImport() this.handleSaveImport()
}) })
} }
...@@ -318,38 +535,64 @@ export default { ...@@ -318,38 +535,64 @@ export default {
this.tagging.splice(index, 1) this.tagging.splice(index, 1)
} }
}, },
removeTypeTag(item, idx, index) {
item.labelList.splice(idx, 1)
if (item.labelList.length == 0) {
this.labeling.splice(index, 1)
}
},
removeCrowding(index) {
this.crowding.splice(index, 1)
},
selectActivity(item) { selectActivity(item) {
this.ModelItem = item this.ModelItem = item
console.log(this.ModelItem) console.log(this.ModelItem)
}, },
handleSaveImport() { handleSaveImport() {
this.loading = true; const groupIds = this.crowding.map(item => item.crowdId)
let params; this.loading = true
let config; let params = {
if (this.editId) { exportUrl: this.exportUrl,
config = 'exportUpdate' imType: 2,
params = { filterTagging: JSON.stringify(this.filterTagging),
imType: 2, groupIds
id: this.editId, }
exportUrl: this.exportUrl if (params.filterTagging && params.filterTagging == '[]') {
} delete params.filterTagging
} else {
config = 'exportAdd'
params = {
exportUrl: this.exportUrl,
imType: 2
}
} }
this.$apis.marketing[config](params).then(res => { if (params.groupIds && params.groupIds.length == 0) {
delete params.groupIds
}
this.$apis.marketing.exportAdd(params).then(res => {
if (res) { if (res) {
this.ExportDracImResponse = res if (this.selectType == 1) {
this.importStatus = true this.contactNum = res.totalCount
} else if (this.selectType == 3) {
this.contactNum = res.totalCount
} else {
this.ExportDracImResponse = res
this.importStatus = true
}
} else {
this.contactNum = 0
} }
this.loading = false this.loading = false
}) })
}, },
handleSave() { handleSave() {
if (!this.exportUrl) { if (this.selectType == 1 && this.labeling.length == 0) {
this.$message.error('请选择客户标签')
return
}
if (this.selectType == 3 && this.crowding.length == 0) {
this.$message.error('请选择人群')
return
}
if ((this.selectType == 1 || this.selectType == 3) && this.contactNum == 0) {
this.$message.error('智能营销客户为空')
return
}
if (this.selectType == 2 && !this.exportUrl) {
this.$message.error('请上传客户信息') this.$message.error('请上传客户信息')
return return
} }
...@@ -361,7 +604,6 @@ export default { ...@@ -361,7 +604,6 @@ export default {
this.empStatus = true this.empStatus = true
return return
} }
this.loading = true;
this.$refs['configForm'].validate(valid => { this.$refs['configForm'].validate(valid => {
if (valid) { if (valid) {
let startTime, endTime let startTime, endTime
...@@ -371,59 +613,57 @@ export default { ...@@ -371,59 +613,57 @@ export default {
} }
let templateId = this.messageItem.id let templateId = this.messageItem.id
const content = this.addForm.content const content = this.addForm.content
let params
let config let tagging = this.tagging.map(item => {
if (this.editId) { let tagIds = item.labelList.map(tag => {
config = 'exportUpdate' return tag.id
params = {
imType: 2,
id: this.editId,
exportUrl: this.exportUrl
}
} else {
let tagging = this.tagging.map(item => {
let tagIds = item.labelList.map(tag => {
return tag.id
})
let name = item.labelList.map(tag => {
return tag.name
})
return {
groupId: item.labelGroup.id,
tagIds: tagIds.join(','),
name: name.join(','),
labelType: item.labelGroup.name
}
}) })
config = 'exportAdd' let name = item.labelList.map(tag => {
params = { return tag.name
autoWelcome: this.autoWelcome ? 1 : 0,
imName: this.imName,
imType: 2,
tagging: JSON.stringify(tagging),
exportUrl: this.exportUrl,
dracImFollowStaffRequestList: this.dracImFollowStaffResponses,
dracImMessageConfigRequest: {
startTime,
endTime,
templateId,
content
}
}
const previewList = this.$common ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : this.$refs.welcome.previewList
const attachmentList = previewList.map(item => {
if (item.attType == 1) {
item.attContent = item.attContent.replaceAll('[@昵称]', '@昵称')
item.attContent = item.attContent.replaceAll('@昵称', '[@昵称]')
} else if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent)
}
return item
}) })
params.welcomeInfo = attachmentList return {
groupId: item.labelGroup.id,
tagIds: tagIds.join(','),
name: name.join(','),
labelType: item.labelGroup.name
}
})
const groupIds = this.crowding.map(item => item.crowdId)
let params = {
autoWelcome: this.autoWelcome ? 1 : 0,
imName: this.imName,
imType: 2,
tagging: JSON.stringify(tagging),
filterTagging: JSON.stringify(this.filterTagging),
exportUrl: this.exportUrl,
dracImFollowStaffRequestList: this.dracImFollowStaffResponses,
groupIds,
dracImMessageConfigRequest: {
startTime,
endTime,
templateId,
content
}
} }
if (params.filterTagging && params.filterTagging == '[]') {
this.$apis.marketing[config](params).then(res => { delete params.filterTagging
}
if (params.groupIds && params.groupIds.length == 0) {
delete params.groupIds
}
const previewList = this.$common ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : this.$refs.welcome.previewList
const attachmentList = previewList.map(item => {
if (item.attType == 1) {
item.attContent = item.attContent.replaceAll('[@昵称]', '@昵称')
item.attContent = item.attContent.replaceAll('@昵称', '[@昵称]')
} else if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent)
}
return item
})
params.welcomeInfo = attachmentList
this.loading = true
this.$apis.marketing.exportAdd(params).then(res => {
this.loading = false this.loading = false
if (res) { if (res) {
this.$router.push('/market/index') this.$router.push('/market/index')
...@@ -432,13 +672,27 @@ export default { ...@@ -432,13 +672,27 @@ export default {
} }
}) })
}, },
//选择员工
handleAddEmp() { handleAddEmp() {
this.empStatus = false this.empStatus = false
this.$refs.selectEmpForm.init(this.dracImFollowStaffResponses) this.$refs.selectEmpForm.init(this.dracImFollowStaffResponses)
}, },
//选择标签
handleAddTag() { handleAddTag() {
this.$refs.selectTagForm.init(this.tagging) this.$refs.selectTagForm.init(this.tagging)
}, },
//筛选标签
handleScreenTag() {
this.$refs.screenTagForm.init(this.labeling)
},
handleCrowd() {
console.log(this.crowding)
this.$refs.selectCrowdForm.init(this.crowding)
},
crowdChecked(item) {
this.crowding = item
},
//选择短信模板
handleSelectMessage() { handleSelectMessage() {
this.$refs.selectMessageForm.init() this.$refs.selectMessageForm.init()
}, },
...@@ -478,6 +732,9 @@ export default { ...@@ -478,6 +732,9 @@ export default {
} }
}) })
this.tagging = taggingList this.tagging = taggingList
this.$nextTick(() => {
this.saveStatus = false
})
}) })
} }
}, },
...@@ -485,14 +742,14 @@ export default { ...@@ -485,14 +742,14 @@ export default {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
let { id } = this.$route.params let { id } = this.$route.params
if (id != -1) { if (id) {
this.editId = id this.editId = id
this.findById(id) this.findById(id)
this.editStatus = false this.editStatus = false
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.channel-main-welcome { .channel-main-welcome {
...@@ -508,7 +765,7 @@ export default { ...@@ -508,7 +765,7 @@ export default {
} }
.welcome-panel { .welcome-panel {
margin: 10px; margin: 10px;
padding: 0px 20px 20px; padding: 0px 42px 20px;
.welcome-switch { .welcome-switch {
margin-bottom: 20px; margin-bottom: 20px;
label { label {
...@@ -550,7 +807,16 @@ export default { ...@@ -550,7 +807,16 @@ export default {
.image-uploader { .image-uploader {
display: inline-block; display: inline-block;
margin-bottom: 6px; margin-bottom: 6px;
height: 20px; width: 100px;
position: relative;
input {
cursor: pointer;
position: absolute;
top: 0px;
width: 100%;
height: 100%;
font-size: 0px;
}
/deep/ { /deep/ {
.el-upload-list { .el-upload-list {
display: none; display: none;
...@@ -612,10 +878,14 @@ export default { ...@@ -612,10 +878,14 @@ export default {
} }
} }
.drainage-wrap { .drainage-wrap {
margin-bottom: 20px; margin-bottom: 16px;
&:nth-child(2) { &:nth-child(2) {
margin-bottom: 20px; margin-bottom: 20px;
} }
&.drainage-bottom {
margin-bottom: 16px;
}
.drainage-title { .drainage-title {
padding-left: 20px; padding-left: 20px;
font-size: 16px; font-size: 16px;
...@@ -682,6 +952,12 @@ export default { ...@@ -682,6 +952,12 @@ export default {
margin-right: 20px; margin-right: 20px;
height: 36px; height: 36px;
line-height: 36px; line-height: 36px;
img {
width: 14px;
height: 14px;
vertical-align: middle;
margin-left: 5px;
}
&.is-require { &.is-require {
&::before { &::before {
content: '*'; content: '*';
...@@ -718,6 +994,16 @@ export default { ...@@ -718,6 +994,16 @@ export default {
.upload-box { .upload-box {
margin-bottom: 10px; margin-bottom: 10px;
&.drainage-type {
margin-left: -10px;
}
.tag-count {
color: #666666;
margin-left: 10px;
span {
color: #5850ff;
}
}
.upload-file-panel { .upload-file-panel {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -741,6 +1027,26 @@ export default { ...@@ -741,6 +1027,26 @@ export default {
color: #999999; color: #999999;
padding: 6px 0px; padding: 6px 0px;
} }
.upload-result {
display: flex;
align-items: center;
&-input {
width: 320px;
height: 26px;
background: #f5f7fa;
border-radius: 4px;
font-size: 14px;
padding-left: 12px;
color: #333333;
line-height: 26px;
}
> i {
cursor: pointer;
color: #c6c6c6;
font-size: 14px;
margin-left: 10px;
}
}
.upload-tips { .upload-tips {
margin-top: 6px; margin-top: 6px;
font-size: 14px; font-size: 14px;
...@@ -926,4 +1232,4 @@ export default { ...@@ -926,4 +1232,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template>
<div class="channel-main">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="营销配置" name="first"></el-tab-pane>
<el-tab-pane label="客户列表" name="second"></el-tab-pane>
</el-tabs>
<component :is="activeName == 'first' ? configInfo : customList"></component>
<!-- <GLFooter>
<el-button type="primary" @click="goback">返回</el-button>
</GLFooter> -->
</div>
</template>
<script>
import configInfo from './components/configInfo'
import customList from './components/customList'
export default {
name: 'config',
components: {
configInfo,
customList
},
data() {
return {
activeName: 'first',
customList: 'customList',
configInfo: 'configInfo'
}
},
methods: {
goback() {
this.$router.push('/market/index')
}
}
}
</script>
<style lang="scss" scoped>
.channel-main {
/deep/ {
.el-tabs__nav-wrap::after {
height: 0px;
}
}
}
</style>
<template>
<div class="form-panel scrm-box-f">
<el-form :inline="true" :model="tableSearchForm" class="follow-form-item">
<el-form-item size="small" label="客户名称">
<el-input size="small" v-model="tableSearchForm.phone" placeholder="请输入客户名称"></el-input>
</el-form-item>
<el-form-item size="small" label="手机号">
<el-input size="small" v-model="tableSearchForm.phone" placeholder="请输入手机号"></el-input>
</el-form-item>
<el-form-item size="small" label="领取状态">
<el-select v-model="tableSearchForm.status" placeholder="请选择">
<el-option v-for="item in optionstatus" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item size="small" style="float: right">
<el-button type="primary" @click="handleSearch">导出</el-button>
<el-button @click="handleReset">重置</el-button>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">客户详情</el-button>
<el-button type="text" @click="handleDetail(scope.scope)">短信内容</el-button>
</div>
</GLTable>
</div>
</template>
<script>
export default {
name: 'effect',
data() {
return {
totalCount: 0,
percentage: 0,
optionstatus: [
{
value: '',
label: '全部'
},
{
value: '0',
label: '未发送'
},
{
value: '1',
label: '已发送'
}
],
tableSearchForm: {},
getListApi: this.$apis.overview.findAllMessageByPage,
tableParams: {
mutiSelectUniqueKey: 'id',
mutiSelectName: 'emp',
listName: 'data',
tableOption: false,
tableColumns: [
{
label: '客户名称',
prop: 'phone'
},
{
label: '手机号',
prop: 'phone'
},
{
label: '是否加企微',
prop: 'phone'
},
{
label: '手机号',
prop: 'phone'
},
{
label: '跟进员工',
prop: 'statusName'
},
{
label: '领取状态',
prop: 'phone'
},
{
label: '领取时间',
prop: 'sendTime'
},
{
label: '核销状态',
prop: 'phone'
},
{
label: '核销时间',
prop: 'sendTime'
},
{
label: '操作',
prop: 'optionBtns',
width: '160px',
addHtml: 'optionBtns',
fixed: 'right'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
baseData: {
allMerchantList: [],
roleList: [],
staffStatusList: []
}
}
},
methods: {
findMessageStatic() {
this.$apis.overview.findMessageStatic({}).then(res => {
this.totalCount = res.totalCount
this.percentage = res.percentage
})
},
handleReset() {
this.tableSearchForm = {}
this.handleSearch()
},
handleSearch() {
this.$refs.employeeRef.refreshTable()
},
handleDetail(scope) {
this.$alert(scope.content, { center: true })
}
},
mounted() {
this.findMessageStatic()
}
}
</script>
<style lang="scss" scoped>
.form-header {
margin-bottom: 20px;
}
.form-panel {
padding: 20px;
.statistics-panel {
display: flex;
&-item {
width: 33.33%;
.statistics-title-h {
font-size: 20px;
font-weight: 600;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
margin-bottom: 20px;
}
.statistics-title {
font-size: 16px;
font-weight: 500;
color: #424242;
line-height: 22px;
img {
width: 14px;
height: 14px;
margin-left: 10px;
margin-top: 4px;
}
}
.circle-box {
margin: 20px 0px;
display: flex;
align-items: center;
.circle-box-item {
margin-left: 10px;
font-size: 14px;
font-weight: 400;
color: rgba(0, 0, 0, 0.65);
line-height: 22px;
.circle-item-num {
font-size: 22px;
font-weight: 600;
color: #333333;
line-height: 30px;
}
}
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="square-main"> <div class="square-main">
<div class="square-main-header"> <div class="square-main-header">
<el-button type="primary" size="small" @click="addConfig"> <GLButton type="primary" size="small" @click="addConfig" fn="新增营销">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
新增营销 新增营销
</el-button> </GLButton>
<!-- <GLButton type="primary" @click="addConfig" size="small" fn="新增" mode="el-button">新增营销</GLButton> --> <!-- <GLButton type="primary" @click="addConfig" size="small" fn="新增" mode="el-button">新增营销</GLButton> -->
<label>结合门店营销活动,指定客户创建智能营销,提高活动转化率</label> <label>结合门店营销活动,指定客户创建智能营销,提高活动转化率</label>
<el-popover placement="top" width="400" trigger="hover" content="通过导入的客户,门店可通过智能外呼及智能短信,结合营销活动的需要向离店用户进行智能营销,可实现标准、高效的营销同时实现用户线上化。"> <el-popover placement="top" width="400" trigger="hover" content="通过导入的客户,门店可通过智能外呼及智能短信,结合营销活动的需要向离店用户进行智能营销,可实现标准、高效的营销同时实现用户线上化。">
...@@ -14,26 +14,11 @@ ...@@ -14,26 +14,11 @@
</div> </div>
<div class="square-tabel scrm-box-f"> <div class="square-tabel scrm-box-f">
<div class="square-tabel-form"> <div class="square-tabel-form">
<el-form :inline="true" :model="tableSearchForm" class="follow-form-item"> <GLCombiForm ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<el-form-item size="small" label="添加时间">
<el-date-picker :picker-options="pickerOptions" v-model="createTime" type="daterange" value-format="yyyy/MM/dd" start-placeholder="开始时间" end-placeholder="结束时间"></el-date-picker>
</el-form-item>
<el-form-item size="small" label="状态">
<el-select v-model="tableSearchForm.imStatus" placeholder="请选择">
<el-option v-for="item in optionstatus" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item size="small" label="营销名称">
<el-input v-model="tableSearchForm.imName" placeholder="请输入营销名称"></el-input>
</el-form-item>
<el-form-item size="small" style="float: right">
<el-button @click="handleReset">重置</el-button>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"> <GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="optionBtns" slot-scope="scope"> <div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button :disabled="scope.scope.imStatus!=1" type="text" @click="handleDetail(scope.scope)">营销配置</el-button> <GLButton type="text" @click="handleDetail(scope.scope)" fn="智能营销配置">查看配置</GLButton>
<!-- <GLButton :disabled="scope.scope.imStatus!=1" type="text" @click="handleStatistics(scope.scope)" fn="营销统计">营销统计</GLButton> -->
</div> </div>
</GLTable> </GLTable>
</div> </div>
...@@ -46,18 +31,51 @@ export default { ...@@ -46,18 +31,51 @@ export default {
name: 'marketing', name: 'marketing',
data() { data() {
return { return {
optionstatus: [ tableSearchForm: {
imName: '',
imStatus: '',
createTime: ''
},
searchFormData: [
{ {
value: '', label: '添加时间',
label: '全部' name: 'createTime',
type: 'datePicker',
placeholder: '',
isClear: true,
pickerOptions: {
disabledDate: time => {
return time.getTime() > Date.now()
}
}
}, },
{ {
value: '1', label: '状态',
label: '待处理' name: 'imStatus',
type: 'select',
placeholder: '请选择',
optionId: 'value',
optionLabel: 'label',
optionList: [
{
value: '',
label: '全部'
},
{
value: '1',
label: '待处理'
},
{
value: '3',
label: '已完成'
}
]
}, },
{ {
value: '3', label: '营销名称',
label: '已完成' name: 'imName',
type: 'input',
placeholder: '请输入营销名称'
} }
], ],
pickerOptions: { pickerOptions: {
...@@ -67,7 +85,6 @@ export default { ...@@ -67,7 +85,6 @@ export default {
}, },
createTime: '', createTime: '',
dialogVisible: true, dialogVisible: true,
tableSearchForm: {},
getListApi: this.$apis.marketing.findAllByPage, getListApi: this.$apis.marketing.findAllByPage,
tableParams: { tableParams: {
listName: 'data', listName: 'data',
...@@ -93,12 +110,13 @@ export default { ...@@ -93,12 +110,13 @@ export default {
}, },
{ {
label: '创建人', label: '创建人',
prop: 'createdName' prop: 'createdName',
width: '220px'
}, },
{ {
label: '操作', label: '操作',
prop: 'optionBtns', prop: 'optionBtns',
width: '100px', width: '180px',
addHtml: 'optionBtns', addHtml: 'optionBtns',
fixed: 'right' fixed: 'right'
} }
...@@ -113,35 +131,47 @@ export default { ...@@ -113,35 +131,47 @@ export default {
} }
}, },
watch: { watch: {
createTime(value) { // createTime(value) {
if (value) { // if (value) {
this.tableSearchForm.beginTime = value[0] // this.tableSearchForm.beginTime = value[0]
this.tableSearchForm.endTime = value[1] // this.tableSearchForm.endTime = value[1]
} else { // } else {
delete this.tableSearchForm.beginTime // delete this.tableSearchForm.beginTime
delete this.tableSearchForm.endTime // delete this.tableSearchForm.endTime
} // }
} // }
}, },
methods: { methods: {
handleSearch() { handleSearch() {
this.$refs.employeeRef.refreshTable() this.$refs.employeeRef.refreshTable()
}, },
handleReset() { handleReset() {
this.createTime = []
this.tableSearchForm = {} this.tableSearchForm = {}
this.$refs.employeeRef.refreshTable() this.$refs.employeeRef.refreshTable()
}, },
beforeSearchFn() {
return new Promise(resolve => {
if (this.tableSearchForm.createTime) {
this.tableSearchForm.beginTime = new Date(this.tableSearchForm.createTime[0]).toLocaleDateString().replace(/-/g, '/')
this.tableSearchForm.endTime = new Date(this.tableSearchForm.createTime[1]).toLocaleDateString().replace(/-/g, '/')
}
// delete this.tableSearchForm.createTime
resolve()
})
},
handleImport() {}, handleImport() {},
addConfig() { addConfig() {
this.$router.push('/market/config/-1') this.$router.push('/market/config')
}, },
handleDetail(scope) { handleDetail(scope) {
this.$router.push('/market/config/' + scope.id) this.$router.push('/market/configDetail/' + scope.id)
},
handleStatistics(scope) {
this.$router.push('/market/effect/' + scope.id)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.square-main-header { .square-main-header {
...@@ -328,4 +358,4 @@ export default { ...@@ -328,4 +358,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template> <template>
<div class="square-main"> <div class="square-main">
<div class="drainage-wrap scrm-box-f"> <div class="drainage-wrap scrm-box-f">
<div class="drainage-title">指定客户</div> <div class="drainage-title">指定客户1</div>
<div class="drainage-form"> <div class="drainage-form">
<div class="drainage-form-item"> <div class="drainage-form-item">
<label>客户信息</label> <label>客户信息1</label>
<div class="upload-box"> <div class="upload-box">
<div class="upload-file-panel"> <div class="upload-file-panel">
<el-upload action="" class="image-uploader" :before-upload="uploadFile"> <el-upload action="" class="image-uploader" :before-upload="uploadFile">
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
<div class="drainage-form"> <div class="drainage-form">
<div class="drainage-form-item" v-if="editStatus"> <div class="drainage-form-item" v-if="editStatus">
<label class="is-require">跟进员工</label> <label class="is-require">跟进员工</label>
<el-popover placement="top" width="400" trigger="hover" content="通过导入的客户,门店可通过智能外呼及智能短信,结合营销活动的需要向离店用户进行智能营销,可实现标准、高效的营销同时实现用户线上化。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover>
<div> <div>
<el-button size="small" @click="handleAddEmp"> <el-button size="small" @click="handleAddEmp">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
...@@ -67,7 +70,7 @@ ...@@ -67,7 +70,7 @@
</div> </div>
</div> </div>
<div class="form-tips">共可输入500字,70字內(含70字)计一条,超过70字,按70字/条计费。</div> <div class="form-tips">共可输入500字,70字內(含70字)计一条,超过70字,按70字/条计费。</div>
<div class="form-tips">提示:当前短信已有{{ addForm.content.length }}字,按{{content.length}}条短信发送且计费。</div> <div class="form-tips">提示:当前短信已有{{ addForm.content.length }}字,按{{ content.length }}条短信发送且计费。</div>
</el-form-item> </el-form-item>
<el-form-item label="审核通知人:">短信内容审核结果会通过企微消息的形式发送给设置的员工,员工可以及时跟进。</el-form-item> <el-form-item label="审核通知人:">短信内容审核结果会通过企微消息的形式发送给设置的员工,员工可以及时跟进。</el-form-item>
<el-form-item label="自动打标签"> <el-form-item label="自动打标签">
...@@ -99,7 +102,7 @@ ...@@ -99,7 +102,7 @@
<img src="@/assets/img/marketing/phone.png" /> <img src="@/assets/img/marketing/phone.png" />
<div class="preview-content"> <div class="preview-content">
<div class="preview-info"> <div class="preview-info">
<div class="preview-text text" v-for="(item,index) in content" :key="index">{{ item }}</div> <div class="preview-text text" v-for="(item, index) in content" :key="index">{{ item }}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -186,7 +189,7 @@ export default { ...@@ -186,7 +189,7 @@ export default {
}, },
watch: { watch: {
'addForm.content': { 'addForm.content': {
handler: function () { handler: function() {
this.content = [] this.content = []
let str = this.addForm.content let str = this.addForm.content
let num = 70 let num = 70
...@@ -321,11 +324,17 @@ export default { ...@@ -321,11 +324,17 @@ export default {
this.addForm.content = res.dracImMessageConResponse.content this.addForm.content = res.dracImMessageConResponse.content
this.tagging = eval(res.tagging) this.tagging = eval(res.tagging)
}) })
},
resize() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
} }
}, },
mounted() { mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.resize()
this.footerWidth = document.documentElement.clientWidth - this.footerLeft window.addEventListener('resize', () => {
this.resize()
})
let { id } = this.$route.params let { id } = this.$route.params
if (id != -1) { if (id != -1) {
this.editId = id this.editId = id
...@@ -334,7 +343,7 @@ export default { ...@@ -334,7 +343,7 @@ export default {
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.footer-panel { .footer-panel {
...@@ -695,4 +704,4 @@ export default { ...@@ -695,4 +704,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template> <template>
<div class="square-main"> <div class="square-main">
<div class="square-main-header"> <div class="square-main-header">
<el-button type="primary" size="small" @click="addConfig"> <GLButton type="primary" size="small" @click="addConfig" fn="新增营销">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
新增营销 新增营销
</el-button> </GLButton>
<label>结合门店营销活动,指定客户创建智能营销,提高活动转化率</label> <label>结合门店营销活动,指定客户创建智能营销,提高活动转化率</label>
<el-popover placement="top" width="400" trigger="hover" content="通过导入的客户,门店可通过智能外呼及智能短信,结合营销活动的需要向离店用户进行智能营销,可实现标准、高效的营销同时实现用户线上化。"> <el-popover placement="top" width="400" trigger="hover" content="通过导入的客户,门店可通过智能外呼及智能短信,结合营销活动的需要向离店用户进行智能营销,可实现标准、高效的营销同时实现用户线上化。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" /> <img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</el-form> </el-form>
<GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"> <GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="optionBtns" slot-scope="scope"> <div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">营销配置</el-button> <GLButton type="text" @click="handleDetail(scope.scope)" fn="智能营销配置">营销配置</GLButton>
</div> </div>
</GLTable> </GLTable>
</div> </div>
...@@ -54,12 +54,8 @@ export default { ...@@ -54,12 +54,8 @@ export default {
label: '待处理' label: '待处理'
}, },
{ {
value: '2',
label: '处理中'
},
{
value: '3', value: '3',
label: '已处理' label: '已完成'
} }
], ],
pickerOptions: { pickerOptions: {
......
...@@ -3,30 +3,30 @@ ...@@ -3,30 +3,30 @@
</template> </template>
<script> <script>
import * as echarts from "echarts"; import * as echarts from 'echarts'
export default { export default {
name: "echartCircle", name: 'echartCircle',
props: { props: {
coustomId: { coustomId: {
type: String, type: String,
default: "", default: ''
}, },
bgColor1: { bgColor1: {
type: String, type: String,
default: "", default: ''
}, },
bgColor2: { bgColor2: {
type: String, type: String,
default: "", default: ''
}, },
coustomCount: { coustomCount: {
type: String, type: String
}, }
}, },
data() { data() {
return {}; return {}
}, },
watch: { watch: {
coustomCount() { coustomCount() {
...@@ -35,33 +35,33 @@ export default { ...@@ -35,33 +35,33 @@ export default {
}, },
methods: { methods: {
getEchart() { getEchart() {
const chartDom = document.getElementById(this.coustomId); const chartDom = document.getElementById(this.coustomId)
const myChart = echarts.init(chartDom); const myChart = echarts.init(chartDom)
let option; let option
option = { option = {
series: [ series: [
{ {
type: "pie", type: 'pie',
radius: ["40%", "70%"], radius: ['40%', '70%'],
hoverAnimation: false, hoverAnimation: false,
avoidLabelOverlap: false, avoidLabelOverlap: false,
color: [this.bgColor1, this.bgColor2], color: [this.bgColor1, this.bgColor2],
label: { label: {
show: false, show: false,
position: "center", position: 'center'
}, },
labelLine: { labelLine: {
show: false, show: false
}, },
data: [{ value: 100 }, { value: this.coustomCount}], data: [{ value: 100 - this.coustomCount }, { value: this.coustomCount }]
}, }
], ]
}; }
option && myChart.setOption(option); option && myChart.setOption(option)
}, }
} }
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
<template> <template>
<div> <div>
<div id="channel-main" class="chart-line" v-show="lineStatus"></div> <div id="channel-main" class="chart-line" v-show="lineStatus"></div>
<div class="chart-line-empty" v-show="!lineStatus"> <div class="chart-line-empty" v-show="!lineStatus">
<img src="@/assets/img/empty.png" /> <img src="@/assets/img/empty.png" />
<div class="chart-empty-d">暂无数据</div> <div class="chart-empty-d">暂无数据</div>
</div> </div>
...@@ -27,6 +27,12 @@ export default { ...@@ -27,6 +27,12 @@ export default {
let notAddEntMicroCount = lineData.map(item => { let notAddEntMicroCount = lineData.map(item => {
return item.notAddEntMicroCount return item.notAddEntMicroCount
}) })
const lengthC = entMicroCount.length - 1
if (notAddEntMicroCount.every(item => item == 0) && entMicroCount.every(item => item == 0)) {
this.lineStatus = false
return
}
this.lineStatus = true
let dateTime = lineData.map(item => { let dateTime = lineData.map(item => {
return item.dayTime return item.dayTime
}) })
...@@ -54,13 +60,13 @@ export default { ...@@ -54,13 +60,13 @@ export default {
}, },
dataZoom: [ dataZoom: [
{ {
type: 'inside', startValue: lengthC - 29,
startValue: 0, endValue: lengthC
endValue: 29
}, },
{ {
startValue: 0, type: 'inside',
endValue: 29 startValue: lengthC - 29,
endValue: lengthC
} }
], ],
xAxis: { xAxis: {
...@@ -70,7 +76,7 @@ export default { ...@@ -70,7 +76,7 @@ export default {
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
minInterval: 1, minInterval: 1
}, },
series: [ series: [
{ {
...@@ -89,15 +95,10 @@ export default { ...@@ -89,15 +95,10 @@ export default {
} }
option && myChart.setOption(option) option && myChart.setOption(option)
if(notAddEntMicroCount.every(item => item == 0) && entMicroCount.every(item => item == 0)) {
this.lineStatus = false
}else {
this.lineStatus = true
}
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.chart-line { .chart-line {
...@@ -114,4 +115,4 @@ export default { ...@@ -114,4 +115,4 @@ export default {
margin-bottom: 12px; margin-bottom: 12px;
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -18,27 +18,19 @@ ...@@ -18,27 +18,19 @@
</div> </div>
</div> </div>
</div> </div>
<el-form :inline="true" :model="tableSearchForm" class="follow-form-item" label-width="80px"> <GLCombiForm ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<el-row>
<el-form-item size="small" label="电话号码">
<el-input size="small" v-model="tableSearchForm.phone" placeholder="请输入电话号码"></el-input>
</el-form-item>
<el-form-item size="small" label="发送状态">
<el-select v-model="tableSearchForm.status" placeholder="请选择">
<el-option v-for="item in optionstatus" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item size="small" style="float: right">
<el-button @click="handleReset">重置</el-button>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-row>
</el-form>
<GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"> <GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="optionBtns" slot-scope="scope"> <div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">短信内容</el-button> <el-button type="text" @click="handleDetail(scope.scope)">短信内容</el-button>
</div> </div>
</GLTable> </GLTable>
<GLDialog title="提示" :hasFooter="true" :content="messageContent" :visible.sync="dialogVisible" mode="small">
<span slot="footer" class="dialog-footer">
<el-button size="small" type="primary" @click="dialogVisible = false">
确定
</el-button>
</span>
</GLDialog>
</div> </div>
</template> </template>
...@@ -51,8 +43,10 @@ export default { ...@@ -51,8 +43,10 @@ export default {
}, },
data() { data() {
return { return {
messageContent: '',
totalCount: 0, totalCount: 0,
percentage: 0, percentage: 0,
dialogVisible: false,
optionstatus: [ optionstatus: [
{ {
value: '', value: '',
...@@ -67,7 +61,40 @@ export default { ...@@ -67,7 +61,40 @@ export default {
label: '已发送' label: '已发送'
} }
], ],
tableSearchForm: {}, tableSearchForm: {
phone: '',
status: null
},
searchFormData: [
{
label: '电话号码',
name: 'phone',
type: 'input',
placeholder: '请输入电话号码'
},
{
label: '状态',
name: 'status',
type: 'select',
placeholder: '请选择',
optionId: 'value',
optionLabel: 'label',
optionList: [
{
value: '',
label: '全部'
},
{
value: '0',
label: '未发送'
},
{
value: '1',
label: '已发送'
}
]
}
],
getListApi: this.$apis.overview.findAllMessageByPage, getListApi: this.$apis.overview.findAllMessageByPage,
tableParams: { tableParams: {
listName: 'data', listName: 'data',
...@@ -120,14 +147,15 @@ export default { ...@@ -120,14 +147,15 @@ export default {
this.$refs.employeeRef.refreshTable() this.$refs.employeeRef.refreshTable()
}, },
handleDetail(scope) { handleDetail(scope) {
this.$alert(scope.content, { center: true }) this.dialogVisible = true
this.messageContent = scope.content
} }
}, },
mounted() { mounted() {
this.findMessageStatic() this.findMessageStatic()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.form-header { .form-header {
...@@ -180,4 +208,4 @@ export default { ...@@ -180,4 +208,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="overview-main"> <div class="overview-main">
<div class="overview-header"> <div class="overview-header">
<span>引流获客概览</span> <span>引流获客概览</span>
<el-popover placement="top" width="400" trigger="hover" content="引流获客通过整合活码营销、企微魔方,可分别针对到店用户及离店用户提供企微线上化方案。帮助门店迅速的形成企微客户池,为后续营销活动搭建起稳定高频的触达通道。"> <el-popover placement="top" width="400" trigger="hover" content="引流获客通过整合活码营销、数据魔方,可分别针对到店用户及离店用户提供企微线上化方案。帮助门店迅速的形成企微客户池,为后续营销活动搭建起稳定高频的触达通道。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" /> <img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover> </el-popover>
</div> </div>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<div class="store-item"> <div class="store-item">
<div class="store-item-s"> <div class="store-item-s">
<div class="store-item-title">离店用户线上化</div> <div class="store-item-title">离店用户线上化</div>
<el-button type="primary" size="small" @click="jumpSquare">企微魔方</el-button> <el-button type="primary" size="small" @click="jumpSquare">数据魔方</el-button>
</div> </div>
<div class="store-item-s"> <div class="store-item-s">
<div class="store-item-icon"> <div class="store-item-icon">
...@@ -115,7 +115,7 @@ export default { ...@@ -115,7 +115,7 @@ export default {
}, },
methods: { methods: {
jumpUrl() { jumpUrl() {
this.$router.push('/square/import') this.$router.push('/square/import')
}, },
jumpChannel() { jumpChannel() {
this.$router.push('/channel/index') this.$router.push('/channel/index')
...@@ -124,9 +124,9 @@ export default { ...@@ -124,9 +124,9 @@ export default {
this.$router.push('/square/import') this.$router.push('/square/import')
}, },
viewChart() { viewChart() {
this.loading = true; this.loading = true
this.$apis.overview.viewChart({}).then(res => { this.$apis.overview.viewChart({}).then(res => {
this.loading = false; this.loading = false
this.entMicroCount = res.entMicroCount this.entMicroCount = res.entMicroCount
this.totalCount = res.totalCount this.totalCount = res.totalCount
this.$refs.customerForm.getChart(res.trendItemList) this.$refs.customerForm.getChart(res.trendItemList)
...@@ -138,7 +138,7 @@ export default { ...@@ -138,7 +138,7 @@ export default {
this.viewChart() this.viewChart()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.overview-header { .overview-header {
...@@ -155,7 +155,7 @@ export default { ...@@ -155,7 +155,7 @@ export default {
} }
} }
.store-panel { .store-panel {
margin: 20px auto; margin: 16px auto;
padding: 20px; padding: 20px;
display: flex; display: flex;
.store-panel-item { .store-panel-item {
...@@ -172,7 +172,7 @@ export default { ...@@ -172,7 +172,7 @@ export default {
} }
.store-item-s { .store-item-s {
width: 33.33%; width: 33.33%;
padding: 30px 20px; padding: 30px 15px;
.store-item-title { .store-item-title {
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
...@@ -205,9 +205,7 @@ export default { ...@@ -205,9 +205,7 @@ export default {
} }
} }
.user-panel { .user-panel {
display: flex;
&-line { &-line {
flex: 1;
padding: 20px; padding: 20px;
.echart-title { .echart-title {
font-size: 20px; font-size: 20px;
...@@ -260,7 +258,7 @@ export default { ...@@ -260,7 +258,7 @@ export default {
} }
} }
.statistics-main { .statistics-main {
margin-top: 20px; margin-top: 16px;
.statistics-title { .statistics-title {
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
...@@ -286,4 +284,4 @@ export default { ...@@ -286,4 +284,4 @@ export default {
font-size: 15px !important; font-size: 15px !important;
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template>
<div class="import-main" v-loading="loading">
<div class="upload-container">
<div class="upload-item" v-for="(item, index) in fileList" :key="item">
<div class="upload-label" :style="{ width: textNum * 20 + 'px' }">
<label v-if="item.flag">*</label>
{{ item.templateName }}:
</div>
<div class="upload-desc">
<div class="upload-btn">
<el-button size="small">
<i class="el-icon-plus"></i>
{{ item.fileName ? '更换文件' : '上传文件' }}
</el-button>
<input type="file" style="opacity: 0" ref="file" accept="*" @change="uploadFile($event, item, index)" />
</div>
<a :href="item.templateUrl">下载模板</a>
<div class="upload-tips" v-if="!item.fileName && !item.fileInfo">支持扩展名:xlsx、xls</div>
<div class="upload-tips" v-if="item.fileInfo">
<i class="el-icon-success"></i>
文件格式正确({{ item.fileName }})
</div>
<div class="upload-tips" v-if="item.fileName && !item.fileInfo">
<i class="el-icon-error"></i>
文件格式错误,请更换文件({{ item.fileName }})
</div>
</div>
</div>
<div class="upload-item">
<div class="upload-label" :style="{ width: textNum * 20 + 'px' }">
备注:
</div>
<div class="upload-desc">
<el-input type="textarea" maxlength="50" :rows="6" placeholder="为本次导入的数据添加备注" v-model="remarks"></el-input>
</div>
</div>
<div class="upload-item">
<div class="upload-label" :style="{ width: textNum * 20 + 'px' }">
跟进人
<el-popover placement="top" width="400" trigger="hover" content="用户点击短信中的链接后,将自动分配以下某位员工的企微名片,客户添加好友将自动回复后台所配置的欢迎语。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover>
:
</div>
<div class="upload-desc">
<div style="position: relative">
<el-button size="small" @click="handleAddEmp">
<i class="el-icon-plus"></i>
选择跟进专员
</el-button>
<div class="el-input-tag input-tag-wrapper" v-show="staffIdList.length">
<el-tag effect="plain" type="info" v-for="(tag, idx) in staffIdList" :key="idx" closable :disable-transitions="false" @close="remove(idx)">
<i class="el-icon-user-solid"></i>
{{ tag.staffName }}
</el-tag>
</div>
</div>
</div>
</div>
</div>
<select-emp ref="selectEmpForm" @selectTable="selectTable"></select-emp>
</div>
</template>
<script>
import * as XLSX from 'xlsx'
import util from '@/utils/util'
import uploadInfo from '@/utils/upload'
import selectEmp from '@/components/selectEmp'
import MD5 from 'md5'
export default {
name: 'step-first',
props: {},
components: {
selectEmp
},
data() {
return {
textNum: 0,
loading: false,
staffIdList: [],
tabelHeader: [],
tabelHeaderModel: [],
fileList: [],
remarks: ''
}
},
mounted() {
this.merchantConfig()
},
methods: {
async merchantConfig() {
this.loading = true
const fileList = await this.$apis.square.merchantConfig({})
this.fileList = fileList.map(item => {
this.textNum = this.textNum > item.templateName.length ? this.textNum : item.templateName.length + 1
return {
size: '',
flag: !parseInt(item.mustUpload),
fileName: '',
templateName: item.templateName,
fileUrl: '',
fileInfo: '',
templateUrl: item.templateUrl,
BusinessTypeId: item.businessType,
businessTypeName: item.businessName
}
})
this.loading = false
this.readWorkbookFromRemoteFile()
},
getUploadInfo() {
for (let f of this.fileList) {
if (!f.fileName && f.flag) {
this.$message.error('请上传' + f.templateName)
return false
}
if (!f.fileInfo && f.fileName) {
this.$message.error(f.templateName + '文件格式错误,请更换文件')
return false
}
}
const staffIdList = this.staffIdList.map(item => {
return item.staffId
})
return {
fileList: this.fileList,
remarks: this.remarks,
staffIdList
}
},
getDownloadModel() {
this.$apis.square.downloadModel({}).then(res => {
console.log(res)
})
},
// 从网络上读取某个excel文件,url必须同域,否则报错
async readWorkbookFromRemoteFile() {
for (let f of this.fileList) {
try {
let tabelHeaderArr = await this.getTabelHeaderModel(f.templateUrl)
this.tabelHeaderModel.push(tabelHeaderArr)
} catch (error) {
this.$message.error('读取失败')
}
}
},
getTabelHeaderModel(model_url) {
const _this = this
return new Promise((resolve, reject) => {
var xhr = new XMLHttpRequest()
xhr.open('get', model_url, true)
xhr.responseType = 'arraybuffer'
xhr.onload = function(e) {
if (xhr.status == 200) {
var datat = new Uint8Array(xhr.response)
var workbook = XLSX.read(datat, { type: 'array' })
const wsname = workbook.SheetNames[0]
const ws = workbook.Sheets[wsname]
/* 数组转换 */
const data = _this.getHeaderRow(ws)
resolve(data)
} else {
reject()
}
}
xhr.send()
})
},
getHeaderRow(sheet) {
const headers = []
/* sheet['!ref']表示所有单元格的范围,例如从A1到F8则记录为 A1:F8*/
const range = XLSX.utils.decode_range(sheet['!ref'])
let C,
R = range.s.r /* 从第一行开始 */
/* 按列进行数据遍历 */
for (C = range.s.c; C <= range.e.c; ++C) {
/* 查找第一行中的单元格 */
const cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })]
let hdr = 'UNKNOWN ' + C // <-- 进行默认值设置
if (cell && cell.t) hdr = XLSX.utils.format_cell(cell)
if (!hdr.includes('UNKNOWN')) {
headers.push(hdr)
}
}
return headers
},
compareHeader(file) {
return new Promise(resolve => {
const reader = new FileReader()
reader.onload = event => {
/* 解析数据 */
const bstr = event.target.result
const wb = XLSX.read(bstr, { type: 'binary' })
/* 获取文件的第一个工作表(WorkSheet) */
const wsname = wb.SheetNames[0]
const ws = wb.Sheets[wsname]
if (!ws['!ref']) {
this.$message.error('格式错误')
this.loading = false
return
}
const data = this.getHeaderRow(ws)
resolve(data)
}
reader.readAsBinaryString(file)
})
},
send(arr) {
let max = 3 //最多允许同时执行的ajax次数
var current = 0 //当前有多少ajax正在执行
// var _name = getFileType(w.fileName);
var _num = 0
var len = arr.length
var hasFile = false
for (let i = len - 1; i >= 0; i--) {
var _index = i
var fileBase64 = uploadInfo.transformArrayBufferToBase64(arr[i])
var oParams = uploadInfo.getParams(_index, fileBase64)
var o = {}
oParams.file = oParams.fileType + '@' + fileBase64
o.method = 'POST'
o.data = oParams
//fileFragmentUpload(o);
//如果存在url,则直接跳出循环
if (hasFile) {
return false
}
this.$apis.common.getUploadFileToken(o).then(res => {
if (res.code == 0) {
_num++
var _obj = res.data
// 如果有进度条,则设置对应的进度条属性
//如果存在url,则直接跳出循环
if (res.data.fileUrl) {
hasFile = true
return false
}
}
})
}
},
//创建worker分线程
createWorker() {
let self = this
var myWorker = function() {
// let that = this
let w = {}
this.addEventListener(
'message',
function(e) {
var _obj = e.data
var files = self.file
console.log(self)
var reader = new FileReader()
w.config = _obj.config
w.options = _obj.options
w.file = _obj.file
//var r1 = getToken(files);
reader.readAsArrayBuffer(files)
reader.onload = function(e) {
var hexHash = MD5(e.target.res)
if (hexHash) {
console.log('加密结束:' + new Date().getTime())
}
var oParams = {}
oParams.fileMD5 = hexHash
oParams.file = e.target.result
oParams.size = files.size
//w.fileMD5 = hexHash;
this.postMessage(oParams)
/*var _arr = fileSlice(oParams);
console.log(_arr)
w.list = _arr;
Promise.all([r1]).then(res => {
checkFileIsUpload(hexHash).then(res => {
console.log(res);
if (res.code == 0) {
send(_arr);
}
});
})*/
}
},
false
)
}
var workerData = new Blob(['(' + myWorker.toString() + ')()'], {
type: 'text/javascript'
})
return workerData
},
async uploadFile(e, uploadItem, index) {
const file = e.srcElement.files[0]
let AllImgExt = '.xls|.xlsx'
let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
console.log(extName)
if (AllImgExt.indexOf(extName) === -1) {
this.$message.error('上传格式不正确')
return false
}
const size = file.size / 1024 / 1024
if (size > 8) {
this.$message.error('单文件体积需小于8M')
return
}
this.loading = true
const header = await this.compareHeader(file)
if (util.getArrayIsSubset(header, this.tabelHeaderModel[index])) {
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const fileInfo = file.name.split('.')[1] + '@' + arrBase64[1]
uploadItem.fileInfo = fileInfo
uploadItem.size = size
uploadItem.fileName = file.name
this.loading = false
// const params = {}
// console.log(fileInfo)
// params.fileList = [{ file: fileInfo, fileType: 'doc' }]
// this.$apis.common.pictureUpload(params).then(res => {
// uploadItem.fileUrl = res
// uploadItem.size = size
// uploadItem.fileName = file.name
// this.$refs.file.value = ''
// this.loading = false
// })
}
} else {
uploadItem.fileName = file.name
uploadItem.fileInfo = ''
this.loading = false
}
},
// uploadFile(e, uploadItem, index) {
// const file = e.srcElement.files[0]
// let AllImgExt = '.xls|.xlsx'
// let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
// console.log(extName)
// if (AllImgExt.indexOf(extName) === -1) {
// this.$message.error('上传格式不正确')
// return false
// }
// const size = file.size / 1024 / 1024
// if (size > 30) {
// this.$message.error('单文件体积需小于30M')
// return
// }
// const reader = new FileReader(file)
// reader.onload = event => {
// /* 解析数据 */
// const bstr = event.target.result
// const wb = XLSX.read(bstr, { type: 'binary' })
// /* 获取文件的第一个工作表(WorkSheet) */
// const wsname = wb.SheetNames[0]
// const ws = wb.Sheets[wsname]
// /* 数组转换 */
// const data = XLSX.utils.sheet_to_json(ws, { header: 1 })
// /* 进行表格数据更新 */
// uploadItem.fileName = file.name
// if (data && data.length > 0 && util.getArrayIsSubset(data[0], this.tabelHeaderModel[index])) {
// const arrBase64 = bstr.split(',')
// const fileInfo = file.name.split('.')[1] + '@' + arrBase64[1]
// this.$apis.common.pictureUpload({ file: fileInfo }).then(res => {
// uploadItem.fileUrl = res
// uploadItem.size = size
// this.$refs.file.value = ''
// })
// }
// /* 进行表格表头数据更新 */
// this.getHeaderRow(ws)
// }
// reader.readAsBinaryString(file)
// },
uploadFileSuccess(e) {
let AllImgExt = '.xls|.xlsx'
let extName = e.name.substring(e.name.lastIndexOf('.')).toLowerCase()
console.log(extName)
if (AllImgExt.indexOf(extName) === -1) {
this.$message.error('上传格式不正确')
return false
}
const size = e.size / 1024 / 1024
if (size < 9) {
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e)
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const fileInfo = e.name.split('.')[1] + '@' + arrBase64[1]
this.$apis.common.pictureUpload({ file: fileInfo }).then(res => {
this.fileInfo = res
this.importName = e.name
this.$refs.file.value = ''
})
}
} else {
this.$message.error('上传文件不可超过9M')
}
},
//选择员工
handleAddEmp() {
this.$refs.selectEmpForm.init(this.staffIdList)
},
selectTable(item) {
this.staffIdList = item.map(item => {
return {
staffId: item.relationId,
staffName: item.staffName
}
})
},
remove(index) {
this.staffIdList.splice(index, 1)
}
}
}
</script>
<style lang="scss" scoped>
.import-main {
margin: 60px auto 0px;
width: 92%;
.upload-item {
display: flex;
margin-top: 30px;
font-size: 14px;
.upload-label {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
text-align: right;
min-width: 110px;
label {
color: #eb4e4e;
}
img {
width: 14px;
height: 14px;
vertical-align: middle;
}
}
.upload-desc {
margin-top: -6px;
.upload-btn {
position: relative;
display: inline-block;
input {
cursor: pointer;
position: absolute;
height: 100%;
width: 100%;
top: 0px;
left: 0px;
font-size: 0px;
}
}
/deep/ .el-textarea {
width: 500px;
}
a {
color: #5850ff;
margin-left: 10px;
vertical-align: text-bottom;
}
.upload-tips {
margin-top: 6px;
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 22px;
i {
color: #2cca74;
&.el-icon-error {
color: #eb4e4e;
}
}
}
.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 5px 0px 5px;
max-height: 68px;
overflow: auto;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 500px;
display: flex;
align-items: center;
margin-top: 6px;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
}
.el-tag {
margin-right: 4px;
height: 26px;
line-height: 24px;
margin-bottom: 5px;
}
}
}
}
</style>
<template>
<div class="import-main">
<div class="upload-process">
<div class="upload-process-item" v-for="(item, index) in process" :key="item">
<div class="process-item-label" :style="{ width: textNum * 20 + 'px' }">
<label>*</label>
{{ item.templateName }}:
</div>
<div class="process-item-info">
<div class="process-item-size">
<img src="@/assets/img/Excel.png" alt="" />
文件大小:{{ item.size }}M
</div>
<div class="process-item-name">{{ item.fileName }}</div>
<div class="process-item-num">
<el-progress :show-text="false" :stroke-width="6" :percentage="item.percentage" :color="item.percentage != 100 ? '#5850FF' : '#2CCA74'"></el-progress>
<div class="process-num-status" v-if="item.percentage > 0 && item.percentage < 100">上传中</div>
<div class="process-num-status process-refresh" v-if="item.percentage == 0 && !dialogVisible" @click="refresh(index)">
重试
<i class="el-icon-refresh-right"></i>
</div>
<div class="process-num-status process-refresh" v-if="item.percentage == 0 && dialogVisible">
等待上传
</div>
<div class="process-num-status" v-if="item.percentage == 100"><i class="el-icon-success"></i></div>
</div>
</div>
</div>
</div>
<GLDialog @onOk="handleSure" @onCancel="handleCancel" title="提示" :visible.sync="dialogVisible" mode="small">
<div class="dialog-body">
<div class="dialog-tips-icon"><i class="el-icon-warning"></i></div>
<div class="dialog-tips-text">点击继续将开始上传数据文件</div>
<div class="dialog-tips-text">
<span>期间请勿关闭页面</span>
,是否继续吗?
</div>
</div>
<!-- <div slot="footer" class="dialog-footer">
<el-button size="small" @click="handleCancel">
取 消
</el-button>
<el-button size="small" type="primary" @click="handleSure">确 定</el-button>
</div> -->
</GLDialog>
<div class="loading-containner" v-if="processLoading"></div>
</div>
</template>
<script>
import { utils } from 'glsx-common'
export default {
name: 'step-second',
props: {},
data() {
return {
textNum: 0,
processLoading: false,
resultNum: 0,
dialogVisible: false,
setInter: [],
process: [{ percentage: 0 }, { percentage: 0 }, { percentage: 0 }],
uploadItem: ''
}
},
mounted() {},
beforeDestroy() {
this.setInter.forEach(item => {
item && clearInterval(item)
})
},
methods: {
handleSure: utils.debounce(function() {
this.fileUpload()
this.dialogVisible = false
}, 300),
handleCancel() {
this.$emit('excelCancel')
this.dialogVisible = false
},
handleClose() {
this.handleCancel()
},
startUpload(info) {
this.uploadItem = info
const fileList = info.fileList
this.process = fileList.map(p => {
this.textNum = this.textNum > p.templateName.length ? this.textNum : p.templateName.length + 1
return {
percentage: 0,
fileName: p.fileName,
templateName: p.templateName,
size: p.size.toFixed(2)
}
})
console.log(info)
this.dialogVisible = true
},
async refresh(index) {
this.processLoading = true
this.process[index].percentage = 0
this.setInter[index] = setInterval(this.addProcess(index), 300)
try {
this.uploadItem.fileList[index].fileUrl = await this.$apis.common.pictureUpload({ file: this.uploadItem.fileList[index].fileInfo })
this.resultNum++
this.process[index].percentage = 100
clearInterval(this.setInter[index])
if (this.resultNum == this.process.length) {
this.datacubeUpload()
}
} catch (e) {
this.processLoading = false
this.process[index].percentage = 0
clearInterval(this.setInter[index])
}
},
datacubeUpload() {
this.processLoading = false
const fileList = this.uploadItem.fileList.map(item => {
return {
templateName: item.templateName,
fileName: item.fileName,
fileUrl: item.fileUrl,
templateUrl: item.templateUrl,
BusinessTypeId: item.BusinessTypeId,
businessTypeName: item.businessTypeName
}
})
let params = { fileList, createdStaffId: this.$globalState.session.id, remarks: this.uploadItem.remarks, staffIdList: this.uploadItem.staffIdList }
this.$apis.square.datacubeUpload(params).then(res => {
if (res) {
this.$emit('handleSuccess')
}
})
},
fileUpload() {
this.process.forEach(p => {
p.percentage = Math.random() * 30
})
this.resultNum = 0
this.processLoading = true
this.uploadItem.fileList.forEach(async (item, index) => {
this.$set(this.setInter, index, setInterval(this.addProcess(index), 300))
try {
this.uploadItem.fileList[index].fileUrl = await this.$apis.common.pictureUpload({ file: item.fileInfo })
this.process[index].percentage = 100
this.resultNum++
clearInterval(this.setInter[index])
if (this.resultNum == this.process.length) {
this.datacubeUpload()
}
} catch (e) {
this.processLoading = false
this.process[index].percentage = 0
clearInterval(this.setInter[index])
}
// setTimeout(() => {
// clearInterval(this.setInter)
// this.$emit('handleSuccess')
// }, 1000)
// }
// this.$apis.common
// .pictureUpload({ file: item.fileInfo })
// .then(res => {
// resultNum++
// item.fileUrl = res
// this.process[index].percentage = 100
// })
// .catch(() => {
// this.process[index].percentage = 0
// })
})
// this.uploadItem.fileList = this.uploadItem.fileList.filter(item => item.fileUrl)
// this.uploadItem.createdStaffId = this.$globalState.session.id
// this.$apis.square
// .datacubeUpload(this.uploadItem)
// .then(res => {
// if (res) {
// const result = res.failFile
// let resultNum = 0
// result.forEach((item, index) => {
// if (item.uploadSuccess == 0) {
// this.process[index].percentage = 100
// resultNum++
// } else {
// this.process[index].percentage = 0
// }
// })
// if (resultNum == result.length) {
// setTimeout(() => {
// clearInterval(this.setInter)
// this.$emit('handleSuccess')
// }, 1000)
// }
// }
// })
// .catch(() => {
// this.process.forEach(p => {
// p.percentage = 0
// })
// })
},
addProcess(index) {
this.process[index].percentage = this.process[index].percentage > 90 ? this.process[index].percentage : this.process[index].percentage + Math.random() * 5
}
}
}
</script>
<style lang="scss" scoped>
.loading-containner {
top: 0px;
left: 0px;
position: fixed;
width: 100%;
background: rgba(255, 255, 255, 0.1);
z-index: 5000;
height: 100%;
}
.import-main {
margin: 60px auto 0px;
width: 92%;
.upload-process {
&-item {
display: flex;
margin-bottom: 20px;
width: 40vw;
.process-item-label {
font-size: 14px;
font-weight: 400;
color: #333333;
min-width: 120px;
line-height: 20px;
text-align: right;
label {
color: #eb4e4e;
}
}
.process-item-info {
flex: 1;
}
.process-item-size {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 22px;
img {
width: 24px;
}
}
.process-item-name {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 22px;
margin-top: 6px;
}
.process-item-num {
margin-top: 8px;
display: flex;
align-items: center;
font-size: 14px;
font-weight: 400;
color: rgba(0, 0, 0, 0.9);
line-height: 22px;
/deep/ .el-progress {
flex: 1;
margin-right: 6px;
}
.process-num-status {
width: 60px;
&.process-refresh {
cursor: pointer;
}
i {
color: #2cca74;
font-size: 14px;
&.el-icon-refresh-right {
color: #8c8c8c;
}
}
}
}
}
}
.dialog-body {
text-align: center;
margin: 10px 0px;
.dialog-tips-icon {
margin-bottom: 12px;
i {
color: #5850ff;
font-size: 32px;
}
}
.dialog-tips-text {
font-size: 16px;
font-weight: 400;
color: #333333;
line-height: 22px;
span {
color: #eb4e4e;
}
}
}
.dialog-footer {
text-align: center;
}
}
</style>
<template>
<div class="import-main">
<div class="import-success">
<div class="import-success-image">
<i class="el-icon-success"></i>
</div>
<div class="import-success-desc">上传完成</div>
<div class="import-success-content">数据中心已成功接收到数据,数据处理完毕后将发送企微通知。</div>
<div class="import-success-content">届时请回到【引流获客】-【企微魔方】查看分析结果</div>
</div>
</div>
</template>
<script>
export default {
name: 'step-third',
props: {},
data() {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped>
.import-main {
padding: 30px;
width: 80%;
margin: 0 auto;
border: 1px solid #e8e8ea;
}
.import-success {
text-align: center;
.el-icon-success {
font-size: 60px;
color: #2cca74;
}
&-desc {
font-size: 24px;
font-weight: 500;
color: #333333;
line-height: 32px;
margin: 20px 0px 10px;
}
&-content {
font-size: 14px;
font-weight: 400;
color: #000000;
line-height: 22px;
opacity: 0.45;
}
}
</style>
<template>
<div class="form-panel scrm-box-f">
<div class="form-header"><el-button type="primary" size="small" @click="goback">返回</el-button></div>
<el-form :inline="true" :model="tableSearchForm" class="follow-form-item">
<el-form-item size="small" label="客户名称">
<el-input size="small" v-model="tableSearchForm.phone" placeholder="请输入客户名称"></el-input>
</el-form-item>
<el-form-item size="small" label="电话号码">
<el-input size="small" v-model="tableSearchForm.phone" placeholder="请输入电话号码"></el-input>
</el-form-item>
<el-form-item size="small" label="是否添加企微">
<el-select v-model="tableSearchForm.status" placeholder="请选择">
<el-option v-for="item in optionstatus" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item size="small" label="首次添加企微">
<el-date-picker :picker-options="pickerOptions" v-model="createTime" type="daterange" value-format="yyyy-MM-dd" start-placeholder="开始时间" end-placeholder="结束时间"></el-date-picker>
</el-form-item>
<el-form-item size="small" style="float: right; margin-right: 0px">
<el-button @click="handleReset">重置</el-button>
<el-button type="primary" @click="handleSearch">导出</el-button>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">客户详情</el-button>
</div>
</GLTable>
</div>
</template>
<script>
export default {
name: 'customDetail',
data() {
return {
pickerOptions: {
disabledDate: time => {
return time.getTime() > Date.now()
}
},
createTime: '',
totalCount: 0,
percentage: 0,
optionstatus: [
{
value: '',
label: '全部'
},
{
value: '0',
label: '是'
},
{
value: '1',
label: '否'
}
],
tableSearchForm: {},
getListApi: this.$apis.overview.findAllMessageByPage,
tableParams: {
mutiSelectUniqueKey: 'id',
mutiSelectName: 'emp',
listName: 'data',
tableOption: false,
otherOptions: {
label: '启用开关'
},
tableColumns: [
{
label: '客户名称',
prop: 'phone'
},
{
label: '手机号',
prop: 'phone'
},
{
label: '性别',
prop: 'phone'
},
{
label: '是否加企微',
prop: 'statusName'
},
{
label: '来源',
prop: 'sendTime',
align: 'left'
},
{
label: '跟进员工',
prop: 'phone'
},
{
label: '首次添加企微',
prop: 'sendTime'
},
{
label: '操作',
prop: 'optionBtns',
width: '140px',
addHtml: 'optionBtns',
fixed: 'right'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
baseData: {
allMerchantList: [],
roleList: [],
staffStatusList: []
}
}
},
watch: {
createTime(value) {
if (value) {
this.tableSearchForm.startTime = value[0] + ' 00:00:00'
this.tableSearchForm.endTime = value[1] + ' 23:59:59'
} else {
delete this.tableSearchForm.startTime
delete this.tableSearchForm.endTime
}
}
},
methods: {
findMessageStatic() {
this.$apis.overview.findMessageStatic({}).then(res => {
this.totalCount = res.totalCount
this.percentage = res.percentage
})
},
goback() {
this.$router.go('-1')
},
handleReset() {
this.tableSearchForm = {}
this.handleSearch()
},
handleSearch() {
this.$refs.employeeRef.refreshTable()
},
handleDetail(scope) {
this.$alert(scope.content, { center: true })
}
},
mounted() {
this.findMessageStatic()
}
}
</script>
<style lang="scss" scoped>
.form-header {
margin-bottom: 20px;
}
.form-panel {
padding: 20px;
.follow-form-item {
/deep/ {
.el-form-item {
margin-right: 20px;
}
.el-input__inner {
width: 215px;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -10,10 +10,7 @@ ...@@ -10,10 +10,7 @@
</div> </div>
</div> </div>
<div class="config-title"> <div class="config-title">
<span v-if="!editStatus" @click="editStatus = true"> <el-button type="primary" icon="el-icon-edit-outline" size="small" v-if="!editStatus" @click="editStatus = true">编辑配置</el-button>
<label>编辑配置</label>
<i class="el-icon-edit-outline"></i>
</span>
</div> </div>
<div class="config-market"> <div class="config-market">
<div class="config-market-item checked"> <div class="config-market-item checked">
...@@ -79,7 +76,7 @@ ...@@ -79,7 +76,7 @@
<el-form ref="configForm" label-position="left" label-width="100px" :model="addForm" :rules="addRules" class="code-body-form"> <el-form ref="configForm" label-position="left" label-width="100px" :model="addForm" :rules="addRules" class="code-body-form">
<el-form-item label="推送时间:">系统将在「开始营销时间」之后启动智系统将在「开始营销时间」之后启动短信营销,并在「截止营销时间」之后停止短信发送。由于相关管控限制,营销类短信无法实时触达用户,若短信时效要求很高,请谨慎使用。</el-form-item> <el-form-item label="推送时间:">系统将在「开始营销时间」之后启动智系统将在「开始营销时间」之后启动短信营销,并在「截止营销时间」之后停止短信发送。由于相关管控限制,营销类短信无法实时触达用户,若短信时效要求很高,请谨慎使用。</el-form-item>
<el-form-item size="small" label="营销时间" prop="time"> <el-form-item size="small" label="营销时间" prop="time">
<el-time-picker is-range :disabled="!editStatus" value-format="HH:mm" format="HH:mm" v-model="addForm.time" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围"></el-time-picker> <el-time-picker is-range :disabled="!editStatus" value-format="HH:mm" format="HH:mm" v-model="addForm.time" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围"></el-time-picker>
</el-form-item> </el-form-item>
<el-form-item label="短信内容" prop="content"> <el-form-item label="短信内容" prop="content">
<el-input :disabled="!editStatus" type="textarea" v-model="addForm.content" rows="5" maxlength="280" show-word-limit></el-input> <el-input :disabled="!editStatus" type="textarea" v-model="addForm.content" rows="5" maxlength="280" show-word-limit></el-input>
...@@ -91,7 +88,14 @@ ...@@ -91,7 +88,14 @@
<div class="form-tips">70字內(含70字)计一条,超过70字,按70字/条计费。</div> <div class="form-tips">70字內(含70字)计一条,超过70字,按70字/条计费。</div>
<div class="form-tips">提示:当前短信已有{{ addForm.content.length }}字,按{{ content.length }}条短信发送且计费。</div> <div class="form-tips">提示:当前短信已有{{ addForm.content.length }}字,按{{ content.length }}条短信发送且计费。</div>
</el-form-item> </el-form-item>
<el-form-item label="自动打标签"> <div class="drainage-form-item">
<label style="width: 100px; text-align: left; color: #666">
自动打标签
<el-popover placement="top" width="400" trigger="hover" content="提示:通过该营销活动添加员工企微的客户,将自动使用以下标签进行标记。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover>
</label>
<div class="tag-item-panel" v-if="editStatus"> <div class="tag-item-panel" v-if="editStatus">
<div> <div>
<el-button size="small" @click="handleAddTag">添加</el-button> <el-button size="small" @click="handleAddTag">添加</el-button>
...@@ -111,12 +115,17 @@ ...@@ -111,12 +115,17 @@
</div> </div>
</template> </template>
</div> </div>
</el-form-item> </div>
</el-form> </el-form>
</div> </div>
</div> </div>
<div class="drainage-form-item" v-if="editStatus"> <div class="drainage-form-item" v-if="editStatus">
<label class="is-require">跟进员工</label> <label class="is-require">
跟进员工
<el-popover placement="top" width="400" trigger="hover" content="用户点击短信中的链接后,将自动分配以下某位员工的企微名片,客户添加好友将自动回复后台所配置的欢迎语。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover>
</label>
<div style="position: relative"> <div style="position: relative">
<el-button size="small" @click="handleAddEmp"> <el-button size="small" @click="handleAddEmp">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
...@@ -133,7 +142,12 @@ ...@@ -133,7 +142,12 @@
</div> </div>
</div> </div>
<div class="drainage-form-item" v-else> <div class="drainage-form-item" v-else>
<label>跟进员工</label> <label>
跟进员工
<el-popover placement="top" width="400" trigger="hover" content="用户点击短信中的链接后,将自动分配以下某位员工的企微名片,客户添加好友将自动回复后台所配置的欢迎语。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover>
</label>
<div class="drainage-emp" v-if="addForm.staffIds.length"> <div class="drainage-emp" v-if="addForm.staffIds.length">
<div :key="index" v-for="(item, index) in addForm.staffIds"> <div :key="index" v-for="(item, index) in addForm.staffIds">
<i class="el-icon-user-solid"></i> <i class="el-icon-user-solid"></i>
...@@ -160,7 +174,7 @@ ...@@ -160,7 +174,7 @@
<el-switch :disabled="!editStatus" v-model="autoWelcome" active-color="#5850FF" inactive-color="#999999"></el-switch> <el-switch :disabled="!editStatus" v-model="autoWelcome" active-color="#5850FF" inactive-color="#999999"></el-switch>
</div> </div>
<div class="welcome-box" v-show="editStatus && autoWelcome"> <div class="welcome-box" v-show="editStatus && autoWelcome">
<welcome-words :eventBus="eventBus" ref="welcome"></welcome-words> <GLEditor ref="welcome" :form="'customer'" :btnList="btnList" @previewWord="previewForm"></GLEditor>
</div> </div>
<div class="welcome-box" v-show="!editStatus && autoWelcome"> <div class="welcome-box" v-show="!editStatus && autoWelcome">
<div class="welcome-box-contaner"> <div class="welcome-box-contaner">
...@@ -193,17 +207,10 @@ ...@@ -193,17 +207,10 @@
</div> </div>
</div> </div>
</div> </div>
<div <GLFooter>
class="footer-panel" <el-button type="primary" @click="handleSave" v-if="editStatus">提交</el-button>
v-if="editStatus"
:style="{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<el-button type="primary" @click="handleSave">提交</el-button>
<el-button @click="goback">取消</el-button> <el-button @click="goback">取消</el-button>
</div> </GLFooter>
<select-emp ref="selectEmpForm" @selectTable="selectTable"></select-emp> <select-emp ref="selectEmpForm" @selectTable="selectTable"></select-emp>
<select-tag ref="selectTagForm" @tagSelected="tagSelected"></select-tag> <select-tag ref="selectTagForm" @tagSelected="tagSelected"></select-tag>
<message-model ref="selectMessageForm" @selectItem="selectItem"></message-model> <message-model ref="selectMessageForm" @selectItem="selectItem"></message-model>
...@@ -268,30 +275,40 @@ ...@@ -268,30 +275,40 @@
</div> </div>
</div> </div>
</div> </div>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisibleTips = false" type="warning" content="当前有内容信息未保存,是否继续返回?" :visible.sync="dialogVisibleTips" mode="small"></GLDialog>
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import word from '@/mixins/word'
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
import welcomeWords from '@/components/welcome/welcomeWords.vue'
import selectEmp from '@/components/selectEmp' import selectEmp from '@/components/selectEmp'
import selectTag from '@/components/selectTag' import selectTag from '@/components/selectTag'
import messageModel from '../market/components/messageModel' import messageModel from '../market/components/messageModel'
const validateTime = (rule, value, callback) => {
if ((new Date(`2000-1-1 ${value[1]}`).getTime() - new Date(`2000-1-1 ${value[0]}`).getTime()) / (1000 * 60) < 120) {
callback(new Error('因营销类短信内容需人工审核,建议预留2小时的营销时长。'))
} else {
callback()
}
}
export default { export default {
mixins: [word],
name: 'drainage', name: 'drainage',
components: { components: {
selectEmp, selectEmp,
selectTag, selectTag,
messageModel, messageModel
welcomeWords
}, },
data() { data() {
return { return {
welcomeInfo: [], welcomeInfo: [],
dialogVisibleTips: false,
eventBus: new Vue(), eventBus: new Vue(),
autoWelcome: true, autoWelcome: true,
editStatus: false, editStatus: false,
saveStatus: false,
footerLeft: 0, footerLeft: 0,
footerWidth: 0, footerWidth: 0,
taggingLength: 0, taggingLength: 0,
...@@ -305,21 +322,25 @@ export default { ...@@ -305,21 +322,25 @@ export default {
tagging: [], tagging: [],
templateId: '' templateId: ''
}, },
previewListStart: [],
content: [], content: [],
dialogVisible: false, dialogVisible: false,
addValue: false, addValue: false,
empStatus: false, empStatus: false,
value1: false, value1: false,
dracImFollowStaffResponses: [{ codeId: null, imId: 5, staffId: 366, staffName: 'fddfdf' }], dracImFollowStaffResponses: [],
addRules: { addRules: {
time: [{ required: true, message: '请选择营销时间', trigger: 'change' }], time: [
{ required: true, message: '请选择营销时间', trigger: 'change' },
{ validator: validateTime, trigger: 'change' }
],
content: [{ required: true, message: '请选择短信模板', trigger: 'change' }] content: [{ required: true, message: '请选择短信模板', trigger: 'change' }]
} }
} }
}, },
watch: { watch: {
'addForm.content': { 'addForm.content': {
handler: function () { handler: function() {
this.content = [] this.content = []
if (this.addForm.content) { if (this.addForm.content) {
let str = this.addForm.content let str = this.addForm.content
...@@ -333,7 +354,7 @@ export default { ...@@ -333,7 +354,7 @@ export default {
} }
}, },
'addForm.tagging': { 'addForm.tagging': {
handler: function () { handler: function() {
this.taggingLength = 0 this.taggingLength = 0
if (this.addForm.tagging) { if (this.addForm.tagging) {
this.addForm.tagging.forEach(item => { this.addForm.tagging.forEach(item => {
...@@ -342,6 +363,18 @@ export default { ...@@ -342,6 +363,18 @@ export default {
} }
}, },
deep: true deep: true
},
addForm: {
handler() {
this.saveStatus = true
},
deep: true
},
autoWelcome: {
handler() {
this.saveStatus = true
},
deep: true
} }
}, },
methods: { methods: {
...@@ -394,7 +427,29 @@ export default { ...@@ -394,7 +427,29 @@ export default {
.catch(() => {}) .catch(() => {})
}, },
goback() { goback() {
this.$router.push('/square/index') this.previewListStart.forEach(item => {
this.$refs.welcome.previewList.forEach(itm => {
if (item.attType == itm.attType) {
if (typeof item.attContent != 'object' && item.attContent != itm.attContent) {
this.saveStatus = true
}
if (typeof item.attContent == 'object' && item.attContent.marketingName != itm.attContent.marketingName) {
this.saveStatus = true
}
}
})
})
if (this.previewListStart.length == 0 && this.$refs.welcome.previewList.length > 0) {
this.saveStatus = true
}
if (this.saveStatus) {
this.dialogVisibleTips = true
} else {
this.$router.go(-1)
}
},
handleSure() {
this.$router.go(-1)
}, },
//开关 //开关
handleSwitch() { handleSwitch() {
...@@ -454,7 +509,7 @@ export default { ...@@ -454,7 +509,7 @@ export default {
console.log(item.attContent) console.log(item.attContent)
item.attContent = item.attContent.replaceAll('[@昵称]', '@昵称') item.attContent = item.attContent.replaceAll('[@昵称]', '@昵称')
item.attContent = item.attContent.replaceAll('@昵称', '[@昵称]') item.attContent = item.attContent.replaceAll('@昵称', '[@昵称]')
} else if (item.attType == 7) { } else if (item.attType == 7 && item.attContent) {
item.attContent = JSON.stringify(item.attContent) item.attContent = JSON.stringify(item.attContent)
} }
return item return item
...@@ -483,7 +538,7 @@ export default { ...@@ -483,7 +538,7 @@ export default {
this.editStatus = false this.editStatus = false
this.$apis.marketing.findConfig({ configType: 3 }).then(res => { this.$apis.marketing.findConfig({ configType: 3 }).then(res => {
if (res) { if (res) {
if(!res.staffIds) { if (!res.staffIds) {
this.addForm.id = res.id this.addForm.id = res.id
this.addForm.content = '' this.addForm.content = ''
return return
...@@ -526,21 +581,23 @@ export default { ...@@ -526,21 +581,23 @@ export default {
}) })
this.$refs.welcome.updateList(previewList) this.$refs.welcome.updateList(previewList)
} }
this.$nextTick(() => {
this.saveStatus = false
this.previewListStart = this.$common.utils.deepClone(this.$refs.welcome.previewList)
})
} }
}) })
} }
}, },
mounted() { mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.findConfig() this.findConfig()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.channel-main-welcome { .channel-main-welcome {
margin: 20px 0px 60px; margin: 20px 0px 16px;
.chanel-form-title { .chanel-form-title {
padding-left: 20px; padding-left: 20px;
font-size: 16px; font-size: 16px;
...@@ -552,7 +609,7 @@ export default { ...@@ -552,7 +609,7 @@ export default {
} }
.welcome-panel { .welcome-panel {
margin: 10px; margin: 10px;
padding: 0px 20px 20px; padding: 0px 42px 20px;
.welcome-switch { .welcome-switch {
margin-bottom: 20px; margin-bottom: 20px;
label { label {
...@@ -765,6 +822,11 @@ export default { ...@@ -765,6 +822,11 @@ export default {
margin-right: 20px; margin-right: 20px;
height: 36px; height: 36px;
line-height: 36px; line-height: 36px;
img {
width: 14px;
height: 14px;
vertical-align: middle;
}
&.is-require { &.is-require {
&::before { &::before {
content: '*'; content: '*';
...@@ -905,6 +967,7 @@ export default { ...@@ -905,6 +967,7 @@ export default {
color: #5850ff; color: #5850ff;
line-height: 40px; line-height: 40px;
height: 40px; height: 40px;
margin: 8px 0px;
span { span {
cursor: pointer; cursor: pointer;
} }
...@@ -996,4 +1059,4 @@ export default { ...@@ -996,4 +1059,4 @@ export default {
background: #ffffff; background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1); box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template> <template>
<div class="squre-main"> <div class="squre-main">
<el-button type="primary" size="small" @click="goBack">返回</el-button>
<div class="squre-title"> <div class="squre-title">
企微魔方 数据魔方
<span>智能分析客户数据,自动人群分类,推荐策略。</span> <span>智能分析客户数据,自动人群分类,推荐策略。</span>
</div> </div>
<div class="squre-safe-panel scrm-box-f" v-loading="loading"> <div class="squre-safe-panel scrm-box-f" v-loading="loading" :style="{ 'min-height': boxHeight + 'px' }">
<div class="dialog-step"> <div class="dialog-step">
<div class="el-steps el-steps--horizontal"> <div class="el-steps el-steps--horizontal">
<div class="el-step is-horizontal" style="flex-basis: 50%; margin-right: 0px"> <div class="el-step is-horizontal" style="flex-basis: 50%; margin-right: 0px">
<div class="el-step__head is-finish"> <div class="el-step__head is-finish">
<div class="el-step__line" style="margin-right: 0px"> <div :class="['el-step__line', activeIndex > 1 ? 'is-finish' : '']" style="margin-right: 0px">
<i class="el-step__line-inner" style="transition-delay: 0ms; border-width: 0px; width: 0%"></i> <i class="el-step__line-inner" style="transition-delay: 0ms; border-width: 0px; width: 0%"></i>
</div> </div>
<div class="el-step__icon is-text"> <div :class="['el-step__icon', activeIndex == 1 ? 'is-text' : '']">
<div class="el-step__icon-inner"><i class="el-icon-check"></i></div> <div class="el-step__icon-inner" v-if="activeIndex > 1"><i class="el-icon-check"></i></div>
<div class="el-step__icon-inner" v-else>1</div>
</div> </div>
<div class="el-step__main el-step__desc"> <div class="el-step__main el-step__desc">
<div class="el-step__title">导入信息</div> <div :class="['el-step__title', activeIndex == 1 ? 'is-finish' : '']">第一步</div>
<div class="el-step__title">数据脱敏</div> <div :class="['el-step__sub', activeIndex == 1 ? 'is-finish' : '']">选择数据文件</div>
</div> </div>
</div> </div>
</div> </div>
<div class="el-step is-horizontal" style="flex-basis: 50%; margin-right: 0px"> <div class="el-step is-horizontal" style="flex-basis: 50%; margin-right: 0px">
<div class="el-step__head is-finish"> <div :class="['el-step__head', activeIndex > 1 ? 'is-finish' : '']">
<div class="el-step__line" style="margin-right: 0px"> <div :class="['el-step__line', activeIndex > 2 ? 'is-finish' : '']" style="margin-right: 0px">
<i class="el-step__line-inner" style="transition-delay: -150ms; border-width: 0px; width: 0%"></i> <i class="el-step__line-inner" style="transition-delay: -150ms; border-width: 0px; width: 0%"></i>
</div> </div>
<div class="el-step__icon is-text"> <div :class="['el-step__icon', activeIndex == 2 ? 'is-text' : '']">
<!----> <!---->
<div class="el-step__icon-inner">2</div> <div class="el-step__icon-inner" v-if="activeIndex > 2"><i class="el-icon-check"></i></div>
<div class="el-step__icon-inner" v-else>2</div>
</div> </div>
<div class="el-step__main el-step__desc"> <div class="el-step__main el-step__desc">
<div class="el-step__title">智能识别</div> <div :class="['el-step__title', activeIndex == 2 ? 'is-finish' : '']">第二步</div>
<div class="el-step__title">自动归类</div> <div :class="['el-step__sub', activeIndex == 2 ? 'is-finish' : '']">上传数据文件</div>
</div> </div>
</div> </div>
</div> </div>
<div class="el-step is-horizontal is-flex" style="flex-basis: 50%; max-width: 33.3333%"> <div class="el-step is-horizontal is-flex" style="flex-basis: 50%; max-width: 33.3333%">
<div class="el-step__head"> <div :class="['el-step__head', activeIndex > 2 ? 'is-finish' : '']">
<div class="el-step__line"><i class="el-step__line-inner"></i></div> <div class="el-step__line"><i class="el-step__line-inner"></i></div>
<div class="el-step__icon is-text"> <div :class="['el-step__icon', activeIndex == 3 ? 'is-text' : '']">
<!----> <!---->
<div class="el-step__icon-inner">3</div> <div class="el-step__icon-inner">3</div>
</div> </div>
<div class="el-step__main el-step__desc"> <div class="el-step__main el-step__desc">
<div class="el-step__title is-wait">集客引流</div> <div :class="['el-step__title', activeIndex == 3 ? 'is-finish' : '']">第三步</div>
<div :class="['el-step__sub', activeIndex == 3 ? 'is-finish' : '']">完成</div>
<div class="el-step__title is-wait">策略推荐</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="safe-upload-panel" id="drop_area"> <div class="upload-list">
<el-upload action="" class="image-uploader" :before-upload="uploadFile"> <!-- <component :is="stepName"></component> -->
<div class="safe-upload-icon"><i class="el-icon-tickets"></i></div> <step-first v-show="stepName == 'stepFirst'" ref="firstForm"></step-first>
</el-upload> <step-second v-show="stepName == 'stepSecond'" ref="secondForm" @handleSuccess="handleSuccess" @excelCancel="excelCancel"></step-second>
<step-third v-show="stepName == 'stepThird'" ref="thirdForm"></step-third>
<div class="safe-upload-tips">点击或将文件拖拽到这里{{ importName ? '重新' : '' }}上传</div>
<div class="safe-upload-xl" v-if="importName">{{ importName }}</div>
<div class="safe-upload-xl">支持扩展名:.xls .xlsl</div>
<div class="safe-upload-link" @click="downloadModel">下载模版</div>
</div>
<div class="safe-upload-footer">
<el-button type="primary" size="small" @click="handleSubmit">提交</el-button>
</div>
</div>
<div class="squre-safe-panel scrm-box-f">
<div class="squre-safe-title">数据隐私&安全</div>
<div class="swiper-container">
<div class="swiper-wrap">
<div class="swiper-wrap-item" :class="{ checked: active == index + 1 }" :key="index" v-for="(item, index) in swiperList" @mouseenter="setActiveItem(index)" @mouseleave="autoplay = true">{{ item }}</div>
</div>
<el-carousel @change="changeItem" ref="carousel" @mouseenter.native="delHandleMouseEnter" :autoplay="autoplay">
<el-carousel-item>
<div class="swiper-container-panel">
<div class="swiper-container-content">数据传输阶段是数据从一个实体传输到另一个实体的阶段。平台使用企业级安全证书来加密通讯数据,防止发生中间人攻击。</div>
<div class="swiper-container-image">
<img src="@/assets/img/square/safe1.png" />
</div>
</div>
</el-carousel-item>
<el-carousel-item>
<div class="swiper-container-panel">
<div class="swiper-container-content">从海量数据中发现、分类和保护敏感数据,分析使用情况并进行风险预警,帮助用户防止数据泄漏和满足GDPR等合规要求</div>
<div class="swiper-container-image">
<img src="@/assets/img/square/safe2.png" />
</div>
</div>
</el-carousel-item>
<el-carousel-item>
<div class="swiper-container-panel">
<div class="swiper-container-content">对核心业务数据中敏感的信息,进行变形、转换、混淆,使得对业务数据中的身份、组织等隐私敏感信息进行去除或掩盖,以保护数据能被合理、安全地利用。</div>
<div class="swiper-container-image">
<img src="@/assets/img/square/safe3.png" />
</div>
</div>
</el-carousel-item>
<el-carousel-item>
<div class="swiper-container-panel">
<div class="swiper-container-content">通过基于组织的数据安全需求和合规性要求建立身份鉴别和数据访问控制机制,防止对数据的未授权访问风险。</div>
<div class="swiper-container-image">
<img src="@/assets/img/square/safe4.png" />
</div>
</div>
</el-carousel-item>
</el-carousel>
</div> </div>
</div> </div>
<GLFooter>
<el-button type="primary" @click="handleNext" v-show="activeIndex == 1">下一步</el-button>
<el-button type="primary" @click="goBack" v-show="activeIndex == 3">返回魔方</el-button>
</GLFooter>
</div> </div>
</template> </template>
<script> <script>
import * as XLSX from 'xlsx'
import stepFirst from './components/step-first.vue'
import stepSecond from './components/step-second.vue'
import stepThird from './components/step-third.vue'
export default { export default {
components: { stepFirst, stepSecond, stepThird },
name: 'import', name: 'import',
data() { data() {
return { return {
boxHeight: 0,
swiperList: ['加密传输', '脱敏传输', '去标识化', '限制访问'], swiperList: ['加密传输', '脱敏传输', '去标识化', '限制访问'],
autoplay: true, autoplay: true,
loading: false, loading: false,
...@@ -125,10 +86,62 @@ export default { ...@@ -125,10 +86,62 @@ export default {
imgArr: [], imgArr: [],
fileData: [], fileData: [],
fileInfo: '', fileInfo: '',
activeIndex: 1,
staffIds: [],
active: 1 active: 1
} }
}, },
computed: {
stepName() {
let status = ''
switch (this.activeIndex) {
case 1:
status = 'stepFirst'
break
case 2:
status = 'stepSecond'
break
case 3:
status = 'stepThird'
break
}
return status
}
},
methods: { methods: {
goBack() {
this.$router.push('/square/index')
},
// 从网络上读取某个excel文件,url必须同域,否则报错
readWorkbookFromRemoteFile() {
var xhr = new XMLHttpRequest()
xhr.open('get', 'https://img01.glsx.com.cn/upload/biz/魔方导入模板v1_0_2_20210117_1.xlsx', true)
xhr.responseType = 'arraybuffer'
xhr.onload = function(e) {
if (xhr.status == 200) {
var data = new Uint8Array(xhr.response)
var workbook = XLSX.read(data, { type: 'array' })
var tabelHeader = ''
for (var sheet in workbook.Sheets) {
if (workbook.Sheets.hasOwnProperty(sheet)) {
tabelHeader = XLSX.utils.sheet_to_json(workbook.Sheets[sheet])
// break; // 若是只取第一张表,就取消注释这行
}
}
if (tabelHeader && tabelHeader.length > 0) {
this.tabelHeaderTwo = Object.keys(tabelHeader[0])
}
console.log(this.tabelHeaderTwo)
}
}
xhr.send()
},
handleSuccess() {
this.activeIndex = 3
},
excelCancel() {
this.activeIndex = 1
},
changeItem(e) { changeItem(e) {
this.active = e + 1 this.active = e + 1
}, },
...@@ -140,54 +153,121 @@ export default { ...@@ -140,54 +153,121 @@ export default {
delHandleMouseEnter() { delHandleMouseEnter() {
this.$refs.carousel.handleMouseEnter = () => {} this.$refs.carousel.handleMouseEnter = () => {}
}, },
goBack() { handleNext() {
this.$router.push('/square/index') let uploadInfo = this.$refs.firstForm.getUploadInfo()
uploadInfo.fileList = uploadInfo.fileList.filter(item => item.fileInfo)
if (uploadInfo) {
this.activeIndex++
this.$refs.secondForm.startUpload(uploadInfo)
}
}, },
downloadModel() { changeInput(e) {
this.$apis.square.downloadModel({}).then(res => { this.uploadFile(e.target.files[0])
const link = document.createElement('a') },
link.setAttribute('href', res) //设置下载文件的url地址 readExcel(file) {
//link.setAttribute('download', 'download'); //用于设置下载文件的文件名 // 解析Excel
link.click() let _this = this
return new Promise(function(resolve, reject) {
// 返回Promise对象
const reader = new FileReader()
reader.onload = e => {
// 异步执行
try {
// 以二进制流方式读取获得整份excel表格对象
var data = e.target.result,
workbook = XLSX.read(data, { type: 'binary' })
} catch (e) {
reject(e.message)
}
// 表格的表格范围,可用于判断表头是否数量是否正确
var fromTo = ''
// 遍历每张表读取
for (var sheet in workbook.Sheets) {
let sheetInfos = workbook.Sheets[sheet]
let locations = [] // A1,B1,C1...
if (workbook.Sheets.hasOwnProperty(sheet)) {
fromTo = sheetInfos['!ref'] // A1:B5
locations = _this.getLocationsKeys(fromTo)
}
for (let i = 0; i < locations.length; i++) {
let value = sheetInfos[locations[i]].v
if (value != i) {
// 自定的校验规则,自由实现便可
// 校验失败reject
reject(locations[i] + "'s parameter isn't " + i)
}
}
// 校验成功resolve
resolve(true)
}
}
reader.readAsBinaryString(file)
}) })
}, },
enentDrop(e) { getHeaderRow(sheet) {
this.borderhover = false const headers = []
e.stopPropagation() /* sheet['!ref']表示所有单元格的范围,例如从A1到F8则记录为 A1:F8*/
e.preventDefault() //必填字段 const range = XLSX.utils.decode_range(sheet['!ref'])
let fileData = e.dataTransfer.files let C,
if (fileData && fileData[1]) { R = range.s.r /* 从第一行开始 */
this.$message.error('只能上次一个文件') /* 按列进行数据遍历 */
return for (C = range.s.c; C <= range.e.c; ++C) {
/* 查找第一行中的单元格 */
const cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })]
let hdr = 'UNKNOWN ' + C // <-- 进行默认值设置
if (cell && cell.t) hdr = XLSX.utils.format_cell(cell)
headers.push(hdr)
} }
console.log(fileData[1]) return headers
this.uploadFile(fileData[0])
}, },
uploadFile(e) { uploadFile(file) {
let AllImgExt = '.xls|.xlsx' const reader = new FileReader()
let extName = e.name.substring(e.name.lastIndexOf('.')).toLowerCase() reader.onload = e => {
console.log(extName) /* 解析数据 */
if (AllImgExt.indexOf(extName) === -1) { const bstr = e.target.result
this.$message.error('上传格式不正确') const wb = XLSX.read(bstr, { type: 'binary' })
return false /* 获取文件的第一个工作表(WorkSheet) */
} const wsname = wb.SheetNames[0]
const size = e.size / 1024 / 1024 const ws = wb.Sheets[wsname]
if (size < 9) { /* 数组转换 */
// // 转码base64 const data = XLSX.utils.sheet_to_json(ws, { header: 1 })
const reader = new FileReader() /* 进行表格数据更新 */
reader.readAsDataURL(e) if (data && data.length > 0) {
reader.onload = event => { this.tabelHeader = data[0]
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const fileInfo = e.name.split('.')[1] + '@' + arrBase64[1]
this.$apis.common.pictureUpload({ file: fileInfo }).then(res => {
this.fileInfo = res
this.importName = e.name
})
} }
} else { /* 进行表格表头数据更新 */
this.$message.error('上传文件不可超过9M') this.getHeaderRow(ws)
} }
reader.readAsBinaryString(file)
// let AllImgExt = '.xls|.xlsx'
// let extName = e.name.substring(e.name.lastIndexOf('.')).toLowerCase()
// console.log(extName)
// if (AllImgExt.indexOf(extName) === -1) {
// this.$message.error('上传格式不正确')
// return false
// }
// const size = e.size / 1024 / 1024
// if (size < 9) {
// // // 转码base64
// const reader = new FileReader()
// reader.readAsDataURL(e)
// reader.onload = event => {
// const imgFile = event.target.result
// const arrBase64 = imgFile.split(',')
// const fileInfo = e.name.split('.')[1] + '@' + arrBase64[1]
// this.$apis.common.pictureUpload({ file: fileInfo }).then(res => {
// this.fileInfo = res
// this.importName = e.name
// this.$refs.file.value = ''
// })
// }
// } else {
// this.$message.error('上传文件不可超过9M')
// }
}, },
handleSubmit() { handleSubmit() {
if (!this.fileInfo) { if (!this.fileInfo) {
...@@ -205,31 +285,15 @@ export default { ...@@ -205,31 +285,15 @@ export default {
} }
}, },
mounted() { mounted() {
let _this = this let clientHeight = document.documentElement.clientHeight
var dropbox = document.getElementById('drop_area') this.boxHeight = clientHeight - 280
dropbox.addEventListener('drop', this.enentDrop, false) // this.readWorkbookFromRemoteFile()
dropbox.addEventListener('dragleave', function (e) {
e.stopPropagation()
e.preventDefault()
_this.borderhover = false
})
dropbox.addEventListener('dragenter', function (e) {
e.stopPropagation()
e.preventDefault()
_this.borderhover = true
})
dropbox.addEventListener('dragover', function (e) {
e.stopPropagation()
e.preventDefault()
_this.borderhover = true
})
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.squre-title { .squre-title {
margin-top: 20px;
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
color: #333333; color: #333333;
...@@ -245,8 +309,9 @@ export default { ...@@ -245,8 +309,9 @@ export default {
} }
.dialog-step { .dialog-step {
width: 80%; width: 80%;
margin: 0 auto 40px; margin: 0 auto 80px;
} }
.el-steps { .el-steps {
transform: translateX(-30px); transform: translateX(-30px);
} }
...@@ -260,6 +325,7 @@ export default { ...@@ -260,6 +325,7 @@ export default {
width: 32px; width: 32px;
height: 32px; height: 32px;
border: 1px solid rgba(0, 0, 0, 0.15); border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 50%;
} }
.el-step.is-horizontal .el-step__line { .el-step.is-horizontal .el-step__line {
top: 14px; top: 14px;
...@@ -267,7 +333,7 @@ export default { ...@@ -267,7 +333,7 @@ export default {
right: 4%; right: 4%;
} }
.el-step__icon-inner { .el-step__icon-inner {
color: rgba(0, 0, 0, 0.25); color: #c6c6c6;
} }
.el-step__head.is-finish { .el-step__head.is-finish {
color: #ffffff; color: #ffffff;
...@@ -277,7 +343,7 @@ export default { ...@@ -277,7 +343,7 @@ export default {
position: absolute; position: absolute;
display: inline-block; display: inline-block;
top: -5px; top: -5px;
left: 36px; left: 42px;
width: 134px; width: 134px;
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
...@@ -285,19 +351,35 @@ export default { ...@@ -285,19 +351,35 @@ export default {
line-height: 24px; line-height: 24px;
} }
.el-step__head.is-finish .el-step__icon-inner { .el-step__head.is-finish .el-step__icon-inner {
color: #ffffff; color: #5850ff;
} }
.el-step__head.is-finish .el-step__line { .el-step__head.is-finish .el-step__line.is-finish {
background: #5850ff; background: #5850ff;
} }
.el-step__head.is-finish .el-step__icon {
border-color: #5850ff;
border-radius: 50%;
// background: #5850ff;
}
.el-step__head.is-finish .el-step__icon.is-text { .el-step__head.is-finish .el-step__icon.is-text {
background-color: #5850ff; border-color: #5850ff;
background: #5850ff;
}
.el-step__icon.is-text .el-step__icon-inner {
color: #ffffff;
} }
.el-step__title { .el-step__title {
font-size: 16px; font-size: 16px;
line-height: 24px; line-height: 24px;
font-weight: 600; font-weight: 500;
color: #000000; color: rgba(0, 0, 0, 0.65);
}
.el-step__sub {
font-size: 14px;
line-height: 24px;
font-size: 14px;
font-weight: 400;
color: rgba(0, 0, 0, 0.45);
} }
.el-step__description { .el-step__description {
font-size: 13px; font-size: 13px;
...@@ -306,10 +388,27 @@ export default { ...@@ -306,10 +388,27 @@ export default {
font-weight: 400; font-weight: 400;
} }
.el-step__title.is-finish { .el-step__title.is-finish {
color: #333333; font-weight: 600;
font-weight: 700; color: rgba(0, 0, 0, 0.85);
}
.el-step__sub.is-finish {
color: rgba(0, 0, 0, 0.65);
line-height: 22px;
} }
.image-uploader { .image-uploader {
position: relative;
height: 40px;
display: flex;
margin: 20px 0px;
justify-content: center;
input {
cursor: pointer;
position: absolute;
top: 0px;
width: 35px;
height: 35px;
font-size: 0px;
}
/deep/ { /deep/ {
.el-upload-list { .el-upload-list {
display: none; display: none;
...@@ -318,7 +417,8 @@ export default { ...@@ -318,7 +417,8 @@ export default {
} }
.squre-safe-panel { .squre-safe-panel {
padding: 40px; padding: 40px;
margin-top: 20px; margin-top: 10px;
margin-bottom: 16px;
/deep/ { /deep/ {
.el-carousel__indicators, .el-carousel__indicators,
.el-carousel__arrow { .el-carousel__arrow {
...@@ -336,7 +436,6 @@ export default { ...@@ -336,7 +436,6 @@ export default {
border: 1px solid rgba(0, 0, 0, 0.15); border: 1px solid rgba(0, 0, 0, 0.15);
text-align: center; text-align: center;
.safe-upload-icon { .safe-upload-icon {
margin: 20px 0px;
i { i {
font-size: 35px; font-size: 35px;
color: #5850ff; color: #5850ff;
...@@ -372,7 +471,7 @@ export default { ...@@ -372,7 +471,7 @@ export default {
.squre-safe-title { .squre-safe-title {
text-align: center; text-align: center;
font-size: 32px; font-size: 32px;
font-weight: 500; font-weight: 600;
color: rgba(0, 0, 0, 0.85); color: rgba(0, 0, 0, 0.85);
line-height: 40px; line-height: 40px;
} }
...@@ -410,7 +509,6 @@ export default { ...@@ -410,7 +509,6 @@ export default {
margin: 40px 0px; margin: 40px 0px;
height: 328px; height: 328px;
background: #ffffff; background: #ffffff;
box-shadow: 0px 0px 20px 0px rgba(88, 80, 255, 0.1);
border-radius: 2px; border-radius: 2px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
...@@ -424,4 +522,4 @@ export default { ...@@ -424,4 +522,4 @@ export default {
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<div class="squre-main"> <div class="squre-main">
<el-button type="primary" size="small" @click="goBack">返回</el-button> <el-button type="primary" size="small" @click="goBack">返回</el-button>
<div class="squre-success-panel scrm-box-f"> <div class="squre-success-panel scrm-box-f">
<div class="contact-us-wrap"> <!-- <div class="contact-us-wrap">
<img src="@/assets/img/qrcode.png" /> <img src="@/assets/img/qrcode.png" />
<div class="contact-us-about">联系我们</div> <div class="contact-us-about">联系我们</div>
</div> </div> -->
<div class="squre-success-image"><i class="el-icon-success"></i></div> <div class="squre-success-image"><i class="el-icon-success"></i></div>
<div class="squre-success-tips">提交成功</div> <div class="squre-success-tips">提交成功</div>
<div class="squre-success-content">所提交的数据已经过加密,并安全存储专属加密区。</div> <div class="squre-success-content">所提交的数据已经过加密,并安全存储专属加密区。</div>
...@@ -39,11 +39,11 @@ ...@@ -39,11 +39,11 @@
<div class="custom-wrap-sta"> <div class="custom-wrap-sta">
<div class="custom-count-item"> <div class="custom-count-item">
<div class="custom-count-title">属于本次导入</div> <div class="custom-count-title">属于本次导入</div>
<div class="custom-count-num">{{ detailInfo.waitAddEntmicroNumber }}人</div> <div class="custom-count-num" @click="jumpDetail">{{ detailInfo.waitAddEntmicroNumber }}人</div>
</div> </div>
<div class="custom-count-item"> <div class="custom-count-item">
<div class="custom-count-title">人群累计人数</div> <div class="custom-count-title">人群累计人数</div>
<div class="custom-count-num">{{ detailInfo.waitAddEntmicroTotal }}人</div> <div class="custom-count-num" @click="jumpDetail">{{ detailInfo.waitAddEntmicroTotal }}人</div>
</div> </div>
</div> </div>
<div class="custom-wrap-content">当前客户池中,尚未匹配到企微账号的数量。推荐使用以下营销策略,吸引用户添加企微。</div> <div class="custom-wrap-content">当前客户池中,尚未匹配到企微账号的数量。推荐使用以下营销策略,吸引用户添加企微。</div>
...@@ -56,11 +56,11 @@ ...@@ -56,11 +56,11 @@
<div class="custom-wrap-sta"> <div class="custom-wrap-sta">
<div class="custom-count-item"> <div class="custom-count-item">
<div class="custom-count-title">属于本次导入</div> <div class="custom-count-title">属于本次导入</div>
<div class="custom-count-num">{{ detailInfo.waitRenewalNumber }}人</div> <div class="custom-count-num" @click="jumpDetail">{{ detailInfo.waitRenewalNumber }}人</div>
</div> </div>
<div class="custom-count-item"> <div class="custom-count-item">
<div class="custom-count-title">人群累计人数</div> <div class="custom-count-title">人群累计人数</div>
<div class="custom-count-num">{{ detailInfo.waitTotal }}人</div> <div class="custom-count-num" @click="jumpDetail">{{ detailInfo.waitTotal }}人</div>
</div> </div>
</div> </div>
<div class="custom-wrap-content">提前给车险快到期的用户自动推荐适合该客户的优惠服务,提高客户续保率。</div> <div class="custom-wrap-content">提前给车险快到期的用户自动推荐适合该客户的优惠服务,提高客户续保率。</div>
...@@ -69,18 +69,18 @@ ...@@ -69,18 +69,18 @@
</div> </div>
<div class="custom-wrap-item"> <div class="custom-wrap-item">
<div class="custom-wrap-itemBox"> <div class="custom-wrap-itemBox">
<div class="custom-wrap-title">待定保客户</div> <div class="custom-wrap-title">待首保客户</div>
<div class="custom-wrap-sta"> <div class="custom-wrap-sta">
<div class="custom-count-item"> <div class="custom-count-item">
<div class="custom-count-title">属于本次导入</div> <div class="custom-count-title">属于本次导入</div>
<div class="custom-count-num">{{ detailInfo.waitRegularMaintainNumber }}人</div> <div class="custom-count-num" @click="jumpDetail">{{ detailInfo.waitRegularMaintainNumber }}人</div>
</div> </div>
<div class="custom-count-item"> <div class="custom-count-item">
<div class="custom-count-title">人群累计人数</div> <div class="custom-count-title">人群累计人数</div>
<div class="custom-count-num">{{ detailInfo.waitRegularMaintainTotal }}人</div> <div class="custom-count-num" @click="jumpDetail">{{ detailInfo.waitRegularMaintainTotal }}人</div>
</div> </div>
</div> </div>
<div class="custom-wrap-content">智能提醒用户定期保养,推荐保养项目和优惠活动,提高用户返店率。</div> <div class="custom-wrap-content">智能提醒用户回店首保,提高用户返店率。</div>
<div class="custom-wrap-config">敬请期待</div> <div class="custom-wrap-config">敬请期待</div>
</div> </div>
</div> </div>
...@@ -104,6 +104,9 @@ export default { ...@@ -104,6 +104,9 @@ export default {
jumpDrainage() { jumpDrainage() {
this.$router.push('/square/drainage') this.$router.push('/square/drainage')
}, },
jumpDetail() {
// this.$router.push('/square/customDetail')
},
importsKey() { importsKey() {
this.importData = this.$store.getters.square.importData this.importData = this.$store.getters.square.importData
let { id } = this.$route.params let { id } = this.$route.params
...@@ -253,6 +256,7 @@ export default { ...@@ -253,6 +256,7 @@ export default {
font-weight: 500; font-weight: 500;
color: rgba(0, 0, 0, 0.85); color: rgba(0, 0, 0, 0.85);
line-height: 34px; line-height: 34px;
cursor: pointer;
} }
} }
.custom-wrap-content { .custom-wrap-content {
......
<template> <template>
<div class="square-main"> <div class="square-main">
<div class="square-title"> <div class="square-title">
<span>企微魔方</span> <span>数据魔方</span>
<el-popover placement="top" width="400" trigger="hover" content="通过导入的客户基础信息,过滤出系统策略所匹配的目标营销人群,从而引导门店分门别类的配置营销方案,并监控实施效果。"> <el-popover placement="top" width="400" trigger="hover" content="通过导入的客户基础信息,过滤出系统策略所匹配的目标营销人群,从而引导门店分门别类的配置营销方案,并监控实施效果。">
<img src="@/assets/img/question.png" slot="reference" class="count-item-question" /> <img src="@/assets/img/question.png" slot="reference" class="count-item-question" />
</el-popover> </el-popover>
</div> </div>
<div class="square-num-box"> <div class="square-num-box">
<div class="square-num-item"> <div class="square-num-item">
<div class="square-num-title">客户总数</div> <div class="square-num-title">魔方导入客户数</div>
<div class="square-num-count">{{ countAll.totalCount }}</div> <div class="square-num-count">
</div> <span class="detail-content">
<div class="square-num-item"> {{ countAll.magicCount | overThousandFilter }}
<div class="square-num-title">企微客户数</div> <div @click="jumpDetail(0)" class="detail-btn" fn="客户明细" mode="label"></div>
<div class="square-num-count">{{ countAll.qyCount }}</div> </span>
</div>
</div> </div>
<div class="square-num-item"> <div class="square-num-item">
<div class="square-num-title">魔方导入客户数</div> <div class="square-num-title">魔方客户匹配企微数</div>
<div class="square-num-count">{{ countAll.magicCount }}</div> <div class="square-num-count">
<span class="detail-content">
{{ countAll.qyCount | overThousandFilter }}
<div @click="jumpDetail(1)" class="detail-btn" fn="客户明细" mode="label"></div>
</span>
</div>
</div> </div>
</div> </div>
<div class="square-title">客户分群营销</div> <div class="coustom-box-container">
<div class="coustom-box"> <div class="square-title">客户分群营销</div>
<div class="coustom-box-item"> <div class="coustom-box">
<div class="coustom-box-title">待添加企微客户</div> <div class="coustom-box-item">
<div class="coustom-echart"> <div class="coustom-box-title">待添加企微客户</div>
<echart-circle bgColor="#6395FA" coustomId="coustomId_1" :lineData="[countAll.unQyCount, countAll.totalCount - countAll.unQyCount]"></echart-circle> <div class="coustom-echart">
<div class="coustom-echart-desc"> <div class="coustom-echart-desc">
<div class="coustom-echart-title">人群占比</div> <div class="coustom-echart-num">
<div class="coustom-echart-num">{{ countAll.unQyCount }}/{{ countAll.totalCount }}</div> <span class="detail-content">
{{ countAll.unQyCount | overThousandFilter }}
<label>人</label>
<div @click="jumpDetailGroup" class="detail-btn" fn="客户明细" mode="label"></div>
</span>
</div>
</div>
</div>
<div class="coustom-box-content">当前客户池中,尚未匹配到企微账号的数量。推荐使用以下营销策略,吸引用户添加企微。</div>
<div class="coustom-box-config">
<GLButton class="coustom-box-btn" @click="jumpDrainage" fn="客户引流企微" mode="div">营销配置</GLButton>
</div> </div>
</div> </div>
<div class="coustom-box-content">当前客户池中,尚未匹配到企微账号的数量。推荐使用以下营销策略,吸引用户添加企微。</div> <div class="coustom-box-item">
<div class="coustom-box-config" @click="jumpDrainage">营销配置</div> <div class="coustom-box-title">信息待完善客户</div>
</div> <div class="coustom-echart">
<div class="coustom-box-item"> <div class="coustom-echart-desc">
<div class="coustom-box-title">信息待完善客户</div> <div class="coustom-echart-num">
<div class="coustom-echart"> <span class="detail-content">
<echart-circle bgColor="#5AD8A6" coustomId="coustomId_2" :lineData="[countAll.unInfoCount, countAll.totalCount - countAll.unInfoCount]"></echart-circle> {{ countAll.unInfoCount | overThousandFilter }}
<div class="coustom-echart-desc"> <label>人</label>
<div class="coustom-echart-title">人群占比</div> </span>
<div class="coustom-echart-num">{{ countAll.unInfoCount }}/{{ countAll.totalCount }}</div> </div>
</div>
</div>
<div class="coustom-box-content">当前客户池中,有企微客户尚未维护手机号码。建议批量通知对应的销售顾问维护此类客户信息。</div>
<div class="coustom-box-config">
<GLButton class="coustom-box-btn" @click="jumpFriend" fn="客户资料跟进" mode="div">营销配置</GLButton>
</div> </div>
</div> </div>
<div class="coustom-box-content">当前客户池中,有企微客户尚未维护手机号码。建议批量通知对应的销售顾问维护此类客户信息。</div> <div class="coustom-box-item">
<div class="coustom-box-config" @click="jumpFriend">营销配置</div> <div class="coustom-box-title">待续保客户</div>
</div> <div class="coustom-echart">
<div class="coustom-box-item"> <div class="coustom-echart-desc">
<div class="coustom-box-title">待续保客户</div> <div class="coustom-echart-num">
<div class="coustom-echart"> <span class="detail-content">
<echart-circle bgColor="#5D7092" coustomId="coustomId_3" :lineData="[countAll.unRenewCount, countAll.totalCount - countAll.unRenewCount]"></echart-circle> {{ countAll.unRenewCount | overThousandFilter }}
<div class="coustom-echart-desc"> <label>人</label>
<div class="coustom-echart-title">人群占比</div> </span>
<div class="coustom-echart-num">{{ countAll.unRenewCount }}/{{ countAll.totalCount }}</div> </div>
</div>
</div> </div>
<div class="coustom-box-content">提前给车险快到期的用户自动推荐适合该客户的优惠服务,提高客户续保率。</div>
<div class="coustom-box-config"><div class="coustom-box-btn coustom-box-wait">敬请期待</div></div>
</div> </div>
<div class="coustom-box-content">提前给车险快到期的用户自动推荐适合该客户的优惠服务,提高客户续保率。</div> <div class="coustom-box-item">
<div class="coustom-box-config">敬请期待</div> <div class="coustom-box-title">待首保客户</div>
</div> <div class="coustom-echart">
<div class="coustom-box-item"> <div class="coustom-echart-desc">
<div class="coustom-box-title">待首保客户</div> <div class="coustom-echart-num">
<div class="coustom-echart"> <span class="detail-content">
<echart-circle bgColor="#5B8FF9" coustomId="coustomId_4" :lineData="[countAll.unRegularCount, countAll.totalCount - countAll.unRegularCount]"></echart-circle> {{ countAll.unRegularCount | overThousandFilter }}
<div class="coustom-echart-desc"> <label>人</label>
<div class="coustom-echart-title">人群占比</div> </span>
<div class="coustom-echart-num">{{ countAll.unRegularCount }}/{{ countAll.totalCount }}</div> </div>
</div>
</div> </div>
<div class="coustom-box-content">智能提醒用户回店首保,提高用户返店率。</div>
<div class="coustom-box-config"><div class="coustom-box-btn coustom-box-wait">敬请期待</div></div>
</div> </div>
<div class="coustom-box-content">智能提醒用户回店首保,提高用户返店率。</div>
<div class="coustom-box-config">敬请期待</div>
</div> </div>
</div> </div>
<div class="square-tabel scrm-box-f"> <div class="square-tabel scrm-box-f">
<div class="square-tabel-form"> <div class="square-tabel-form">
<el-form :inline="true" :model="tableSearchForm" class="follow-form-item" label-width="120px"> <GLCombiForm ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<el-button size="small" type="primary" @click="handleImport"> <div class="tabel-container-tips">
<i class="el-icon-plus"></i> <div class="tabel-tips">
导入魔方 <span>数据列表</span>
</el-button> <i class="el-icon-warning-outline"></i>
<el-form-item size="small" label="导入时间"> 数据已处理: 表示所导出的数据已进入系统。由于每个系统标签的统计规则不同,具体更新时间有所差异。
<el-date-picker :picker-options="pickerOptions" v-model="createTime" type="daterange" value-format="yyyy-MM-dd" start-placeholder="开始时间" end-placeholder="结束时间"></el-date-picker> </div>
</el-form-item> <GLButton plain size="small" @click="handleImport" fn="导入数据">
<el-form-item size="small" style="float: right"> 导入数据
<el-button @click="handleReset">重置</el-button> </GLButton>
<el-button type="primary" @click="handleSearch">查询</el-button> </div>
</el-form-item>
</el-form>
<GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"> <GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div slot="importNumber" slot-scope="scope"> <div slot="importNumber" slot-scope="scope">
<div class="number-form"><span>{{ scope.scope.entmicroNumber }}</span> | <span>{{ scope.scope.importNumber }}</span></div> <div class="number-form">
<span>{{ scope.scope.entmicroNumber }}</span>
|
<span>{{ scope.scope.importNumber }}</span>
</div>
</div> </div>
<div slot="newCostomerNumber" slot-scope="scope"> <div slot="newCostomerNumber" slot-scope="scope">
<div class="number-form"><span>{{ scope.scope.newCustomerNumber }}</span> | <span>{{ scope.scope.importNumber }}</span> <div class="number-form">
<span>{{ scope.scope.newCustomerNumber }}</span>
|
<span>{{ scope.scope.importNumber }}</span>
</div> </div>
</div> </div>
<div class="table-btns" slot="optionBtns" slot-scope="scope"> <div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">详情</el-button> <a type="text" :href="scope.scope.failDataUrl" v-if="scope.scope.state == 1 && scope.scope.failDataUrl">异常数据</a>
</div> </div>
</GLTable> </GLTable>
</div> </div>
...@@ -132,12 +162,9 @@ ...@@ -132,12 +162,9 @@
</template> </template>
<script> <script>
import echartCircle from './components/echartCircle' // import echartCircle from './components/echartCircle'
export default { export default {
name: 'square', name: 'square',
components: {
echartCircle
},
data() { data() {
return { return {
pickerOptions: { pickerOptions: {
...@@ -145,10 +172,55 @@ export default { ...@@ -145,10 +172,55 @@ export default {
return time.getTime() > Date.now() return time.getTime() > Date.now()
} }
}, },
crowdId: '',
createTime: '', createTime: '',
countAll: {}, countAll: {},
dialogVisible: false, dialogVisible: false,
tableSearchForm: {}, tableSearchForm: {
createTime: '',
state: null
},
searchFormData: [
{
label: '导入时间',
name: 'createTime',
type: 'datePicker',
placeholder: '',
isClear: true,
pickerOptions: {
disabledDate: time => {
return time.getTime() > Date.now()
}
}
},
{
label: '数据处理状态',
name: 'state',
type: 'select',
placeholder: '请选择',
optionId: 'value',
optionLabel: 'label',
optionList: [
{
value: '',
label: '全部'
},
{
value: '1',
label: '已处理'
},
{
value: '0',
label: '处理中'
}
]
}
],
// pickerOptions: {
// disabledDate: time => {
// return time.getTime() > Date.now()
// }
// },
getListApi: this.$apis.square.importsRecord, getListApi: this.$apis.square.importsRecord,
tableParams: { tableParams: {
listName: 'data', listName: 'data',
...@@ -158,24 +230,30 @@ export default { ...@@ -158,24 +230,30 @@ export default {
}, },
tableColumns: [ tableColumns: [
{ {
label: '导入时间', label: '导入批次',
prop: 'createdTime' prop: 'batchNumber'
}, },
{ {
label: '企微客户数 | 导入客户数', label: '导入时间',
prop: 'importNumber', prop: 'createdTime',
minWidth: '100px', formatter: cellValue => {
addHtml: 'importNumber' return new Date(cellValue.createdTime).toLocaleDateString() + ' ' + new Date(cellValue.createdTime).toLocaleTimeString()
}
}, },
{ {
label: '新增客户数 | 导入客户数', label: '事件处理状态',
prop: 'newCostomerNumber', prop: 'state',
addHtml: 'newCostomerNumber' formatter: cellValue => {
return cellValue.state == 1 ? '已处理' : '处理中'
}
}, },
{ {
label: '导入人员', label: '导入人员',
prop: 'importStaffName', prop: 'createdStaff'
width: '130px' },
{
label: '备注',
prop: 'remarks'
}, },
{ {
label: '操作', label: '操作',
...@@ -194,22 +272,8 @@ export default { ...@@ -194,22 +272,8 @@ export default {
} }
} }
}, },
watch: {
createTime(value) {
if (value) {
this.tableSearchForm.startTime = value[0] + ' 00:00:00'
this.tableSearchForm.endTime = value[1] + ' 23:59:59'
} else {
delete this.tableSearchForm.startTime
delete this.tableSearchForm.endTime
}
}
},
methods: { methods: {
importsCount() { importsCount() {
let params = {
merchantId: '1'
}
this.$apis.square.importsCount({}).then(res => { this.$apis.square.importsCount({}).then(res => {
console.log(res) console.log(res)
this.countAll = res this.countAll = res
...@@ -235,22 +299,98 @@ export default { ...@@ -235,22 +299,98 @@ export default {
handleImport() { handleImport() {
this.$router.push('/square/import') this.$router.push('/square/import')
}, },
jumpDetail(status) {
let url
if (status) {
url = `/custom/clientManage/index?isJoin=${status}&addWay=企微魔方`
} else {
url = `/custom/clientManage/index?addWay=企微魔方`
}
this.$history.push(url)
},
jumpDetailGroup() {
this.$history.push(`/custom/clientDataOverview/group/${this.crowdId}/1`)
},
beforeSearchFn() {
return new Promise(resolve => {
if (this.tableSearchForm.createTime) {
this.tableSearchForm.startTime = new Date(this.tableSearchForm.createTime[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
this.tableSearchForm.endTime = new Date(this.tableSearchForm.createTime[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
resolve()
})
},
findLogin() { findLogin() {
this.$apis.square.findLoginCount({ loginType: 1005 }).then(res => { this.$apis.square.findLoginCount({ loginType: 1005 }).then(res => {
if (res) { if (res) {
this.dialogVisible = true this.dialogVisible = true
} }
}) })
},
datacubeNotice() {
this.$apis.square.datacubeNotice({}).then(res => {
if (res && res.length) {
for (let k of res) {
setTimeout(() => {
this.$notify({
title: '数据魔方已处理完成',
message: '批次' + k,
type: 'success',
duration: 2000
})
}, 100)
}
}
})
},
queryCrowdTree() {
const params = {
req: {
pageSize: 1000,
pageNum: 1,
merchantId: this.$globalState.session.merchantId,
crowdType: 1
}
}
this.$apis.square.queryCrowdTree(params).then(res => {
const crowdUnitList = res.crowdUnitList.find(item => item.crowdName == '已加企微,待匹配客户')
this.crowdId = crowdUnitList.crowdId
})
} }
}, },
mounted() { mounted() {
this.importsCount() this.importsCount()
this.findLogin() this.findLogin()
this.datacubeNotice()
this.queryCrowdTree()
},
beforeDestroy() {
this.$notify.closeAll()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.detail-content {
position: relative;
}
.detail-btn {
display: inline-block;
position: absolute;
cursor: pointer;
opacity: 0;
width: 100%;
height: 100%;
left: 0px;
top: 0px;
}
.detail-btn::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
background: brown;
}
.number-form { .number-form {
span { span {
display: inline-block; display: inline-block;
...@@ -342,11 +482,23 @@ export default { ...@@ -342,11 +482,23 @@ export default {
height: 102px; height: 102px;
margin: 20px 0px; margin: 20px 0px;
background: #ffffff; background: #ffffff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
display: flex; display: flex;
.square-num-item { .square-num-item {
width: 33.33%; width: 50%;
padding-left: 20px; padding-left: 20px;
text-align: center;
&:first-child {
position: relative;
&::after {
content: '';
position: absolute;
top: 18px;
right: 0px;
width: 1px;
height: 62px;
background: #f0f0f0;
}
}
.square-num-title { .square-num-title {
margin-top: 20px; margin-top: 20px;
font-size: 14px; font-size: 14px;
...@@ -362,69 +514,127 @@ export default { ...@@ -362,69 +514,127 @@ export default {
} }
} }
} }
.coustom-box { .coustom-box-container {
margin-top: 20px; margin-top: 16px;
display: flex; background: #ffffff;
&-item { .square-title {
box-sizing: border-box; height: 55px;
width: 25%; border-bottom: 1px solid #e8e8ea;
margin-right: 20px; line-height: 55px;
padding-left: 20px;
}
.coustom-box {
display: flex;
padding: 20px; padding: 20px;
height: 334px; &-item {
background: #ffffff; box-sizing: border-box;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1); width: 25%;
text-align: center; margin-right: 20px;
&:last-child { height: 271px;
margin-right: 0px; border-radius: 4px;
} border: 1px solid #e9e6f5;
.coustom-box-title { &:last-child {
font-size: 20px; margin-right: 0px;
font-weight: 500; }
color: #424242; .coustom-box-title {
line-height: 28px; font-size: 16px;
letter-spacing: 1px; font-weight: 600;
margin: 10px; color: #333;
} line-height: 28px;
.coustom-echart { letter-spacing: 1px;
display: flex; height: 56px;
justify-content: center; line-height: 56px;
align-items: center; background: #f4f4fc;
margin-bottom: 20px; border-radius: 4px;
.coustom-echart-desc { padding-left: 24px;
margin-left: 10px; }
.coustom-echart {
margin-top: 30px;
padding-left: 24px;
.coustom-echart-desc {
margin-left: 10px;
font-size: 14px;
font-weight: 400;
color: rgba(0, 0, 0, 0.65);
line-height: 22px;
.coustom-echart-num {
font-size: 26px;
font-weight: bold;
color: rgba(0, 0, 0, 0.85);
line-height: 32px;
label {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
}
}
}
}
.coustom-box-content {
margin-top: 20px;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 500;
color: rgba(0, 0, 0, 0.65); color: #a3a3a3;
line-height: 22px; line-height: 20px;
.coustom-echart-num { text-align: left;
font-size: 20px; padding: 0px 24px;
height: 72px;
box-sizing: border-box;
}
.coustom-box-config {
text-align: center;
.coustom-box-btn {
cursor: pointer;
margin: 10px auto;
display: inline-block;
border-radius: 4px;
border: 1px solid #5850ff;
padding: 7px 0px;
width: calc(100% - 46px);
font-size: 14px;
font-weight: 400;
color: #5850ff;
line-height: 14px;
&.coustom-box-wait {
color: #999999;
border: 1px solid #e5e5e5;
}
} }
} }
} }
.coustom-box-content { }
font-size: 14px; }
font-weight: 500; .tabel-container-tips {
color: #a3a3a3; display: flex;
line-height: 20px; align-items: center;
text-align: left; justify-content: space-between;
height: 110px; margin-bottom: 12px;
/deep/ .el-button--small {
border: 1px solid #5850ff;
color: #5850ff;
}
.tabel-tips {
font-size: 14px;
font-weight: 400;
color: rgba(0, 0, 0, 0.65);
line-height: 20px;
span {
color: #333333;
font-size: 18px;
font-weight: 600;
} }
.coustom-box-config { i {
cursor: pointer; color: #999999;
margin: 10px auto; margin-left: 5px;
display: inline-block;
border-radius: 4px;
border: 1px solid #5850ff;
padding: 7px 28px;
font-size: 14px;
font-weight: 400;
color: #5850ff;
line-height: 14px;
} }
} }
} }
.square-tabel { .square-tabel {
padding: 20px; padding: 20px;
margin-top: 20px; margin-top: 16px;
}
.table-btns a {
color: #5850ff;
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -3,10 +3,10 @@ const packageName = require('./package.json').name ...@@ -3,10 +3,10 @@ const packageName = require('./package.json').name
const node_env = process.env.NODE_ENV === 'production' const node_env = process.env.NODE_ENV === 'production'
const publicPath = node_env ? `/child/${packageName}/` : '/' const publicPath = node_env ? `/child/${packageName}/` : '/'
const resolve = dir => path.join(__dirname, dir) const resolve = dir => path.join(__dirname, dir)
const CDN_DOMAIN = 'https://cdn.bootcdn.net/' const CDN_DOMAIN = 'https://img02.glsx.com.cn/'
const cdn = { const cdn = {
css: [ css: [
`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/theme-chalk/index.css` // `${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/theme-chalk/index.css`
], ],
js: [ js: [
`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`, `${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!