Commit f4823b94 by 杨北旺

生成短链

1 parent 891cb3bb
......@@ -2083,6 +2083,17 @@
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"cliui": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
......@@ -2109,12 +2120,31 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"loader-utils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
"integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
......@@ -2141,6 +2171,28 @@
"strip-ansi": "^6.0.1"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
}
},
"wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
......@@ -13740,87 +13792,6 @@
}
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
"integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-quill-editor": {
"version": "3.0.6",
"resolved": "https://registry.npm.taobao.org/vue-quill-editor/download/vue-quill-editor-3.0.6.tgz",
......
import { http } from '@/main'
import { http,new_http } from '@/main'
/**获取财务管理列表*/
const getBalanceList = params => {
params.method = 'scrm.api.equity.order.balance.list.get'
......@@ -177,6 +177,15 @@ const exportGasList = params => {
returnAll: true
})
}
/** 生成短链 */
const createShortLink = params => {
params.method = 'scrm.api.wechat.miniprogram.geturllink'
return new_http({
url:'rop-scrm-wechat/router',
data: params,
returnAll: true
})
}
export default {
getBalanceList,
getOrderList,
......@@ -200,5 +209,6 @@ export default {
exportBalanceList,
getAllBrandList,
exportOrderList,
exportGasList
exportGasList,
createShortLink
}
......@@ -20,6 +20,7 @@ Vue.prototype.$apis = apis
start()
export { bootstrap, mount, unmount } from '@/setup'
export const http = params => Vue.prototype.$http(params)
export const new_http = params => Vue.prototype.$new_http(params)
import './utils/util.js'
......
......@@ -10,11 +10,14 @@ let router = null
let instance = null
export async function bootstrap({ name, id, history, common, messenger, globalState,routerBase }) {
const { response, request, sign, secret } = await fetchConfig(globalState.configSwitch)
let newrequest = Object.assign({},request)
newrequest.baseURL = juedeDomain(request.baseURL)
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$common = common
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$new_http = new common.Http({ response, request:newrequest, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
// Vue.use(GLButton,GLTable, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
const routesData = common.utils.deepClone(globalState.routers)
......@@ -41,3 +44,31 @@ function subscribe({ messenger }) {
console.log(`监听到子应用${v.from}发来消息:`, v)
})
}
function juedeDomain(url){
const val = {
environment:'test',
channel:2,
envVersion:'trial'//要打开的小程序版本。正式版为:release,体验版为:trial,开发版为:develop,仅在微信外打开时生效
}
const TEST = url.indexOf('scrm.test.glsx')>-1
const GL_PRODUCT = url.indexOf('scrm.glsx.com')>-1
const GH_PRODUCT = url.indexOf('scrm.cgacar')>-1
const DEV = url.indexOf('scrm.dev.glsx')>-1
if(TEST){
val.environment = 'test'
}else if(GL_PRODUCT){
val.environment = 'product'
val.envVersion = 'release'
val.channel = 1
}else if(GH_PRODUCT){
val.environment = 'product'
val.envVersion = 'release'
val.channel = 2
}else if(DEV){
val.environment = 'dev'
val.envVersion = 'develop'
}
Vue.prototype.$custom_env = val
let baseURL = url.match(/(\S*)\/rop/)[1];
return baseURL
}
......@@ -240,10 +240,18 @@ export default {
ruleForm: {
supplier: 'HW',
appearance: 1,
costPrice:'',
costPrice:'',
lineationPrice:'',
noMemberPrice:'',
salesPrice:''
salesPrice:'',
brandName:'',
productName:'',
productId:'',
goodsImage:'',
denomination:0,
warrantyPeriod:0,
buysNotes:'',
useNotes:''
},
stock: '',
brandNameList: [],
......
......@@ -5,7 +5,7 @@
<el-form :inline="true" style="width: 100%" :model="searchForm" label-width="85px" label-position="right">
<el-row style="display: flex; align-items: center; margin-bottom: 2px">
<el-form-item size="small" label="品牌名称">
<el-select size="small" v-model="searchForm.brandName" filterable placeholder="请选择">
<el-select clearable size="small" v-model="searchForm.brandName" filterable placeholder="请选择">
<el-option v-for="item in goodsBrandList" :key="item.id" :label="item.brandName" :value="item.brandName"></el-option>
</el-select>
</el-form-item>
......@@ -16,7 +16,7 @@
<el-input v-model="searchForm.productName" placeholder="请输入" size="small" clearable></el-input>
</el-form-item> -->
<el-form-item size="small" label="提供方" style="margin-left: -10px">
<el-select size="small" v-model="searchForm.supplier">
<el-select clearable size="small" v-model="searchForm.supplier">
<el-option v-for="item in supplierList" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
......@@ -26,7 +26,7 @@
<el-input v-model="searchForm.productId" placeholder="请输入" size="small" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="商品状态">
<el-select size="small" v-model="searchForm.status">
<el-select clearable size="small" v-model="searchForm.status">
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
......@@ -49,14 +49,32 @@
<span slot="auth-button" slot-scope="scope" :data="scope.scope">
<GLButton fn="编辑商品" type="text" @click="jump(scope.scope)">编辑</GLButton>
<GLButton fn="复制商品" type="text" @click="copy(scope.scope)">复制</GLButton>
<!-- <el-button type="text" @click="copy(scope.scope)">复制</el-button> -->
<el-button type="text" @click="toCreateLine(scope.scope)">生成商品短链</el-button>
</span>
</GLTable>
</div>
<!-- 推广弹窗 -->
<el-dialog title="商品短链" :visible.sync="isVisible" :before-close="handleClose" :close-on-click-modal="false" width="576px" class="addCardsDialog">
<div class="con-wrap flex_cc">
<div class="link flex_cc">{{ shortLink }}</div>
</div>
<div slot="footer" class="flex_cc">
<el-button size="mini" @click="handleClose">取消</el-button>
<el-button type="primary" @click="copyLink" size="mini">复制</el-button>
</div>
</el-dialog>
</div>
</template>
<script type='text/ecmascript-6'>
const cloneText = message => {
let input = document.createElement('input')
input.value = message
document.body.appendChild(input)
input.select()
input.setSelectionRange(0, input.value.length), document.execCommand('Copy')
document.body.removeChild(input)
}
import url from '@/assets/empty.png'
import { searchMixin } from '@/mixins'
export default {
......@@ -147,13 +165,50 @@ export default {
]
},
goodsBrandList: [],
selectStatus: false
selectStatus: false,
isVisible: false,
shortLink: null
}
},
mounted() {
this.getAllBrandList()
},
methods: {
handleClose() {
this.isVisible = !this.isVisible
},
copyLink(){
if(!this.shortLink)return
cloneText(this.shortLink)
this.$message.success('复制成功')
this.handleClose()
},
// 生成短链
toCreateLine(row) {
const { merchantId, sapCode } = this.$globalState.session
let base_info = `merchantId=${merchantId}`
if (sapCode) {
base_info = `${base_info}&storeCode=${sapCode}`
}
const MINI_PATH = 'packageEquity/pages/commodity/detail/detail'
const MINI_OPTIONS = {
supplier: row.supplier,
brandName: row.brandName,
id: row.id
}
const ENV = this.$custom_env
let query = `param=${encodeURIComponent(JSON.stringify(MINI_OPTIONS))}&${base_info}`
let para = {
path: MINI_PATH,
query,
appId: ENV.channel == 2 ? 'wxfe82b8d65d07808f' : 'wxe10067a63c1856ac',
envVersion: ENV.envVersion
}
this.$apis.orderApi.createShortLink(para).then(res => {
this.shortLink = res.data
this.isVisible = true
})
},
getAllBrandList() {
this.$apis.orderApi.getAllBrandList().then(res => {
this.goodsBrandList = res.data || []
......@@ -291,6 +346,22 @@ export default {
padding: 8px 16px;
// margin-bottom: 20px;
}
.con-wrap{
height: 191px;
.link{
width: 536px;
height: 62px;
background: #F9F9F9;
font-size: 14px;
font-weight: 400;
color: #666666;
}
}
.flex_cc{
display: flex;
align-items: center;
justify-content: center;
}
/deep/ .contain .el-input--small .el-input__inner {
width: 215px;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!