Commit 6f310530 by 李伟康

commit

1 parent f3738f7c
import util from '@/utils/util' import util from '@/utils/util'
import { Notify } from 'vant' import { Notify } from 'vant'
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
const url = '/rop-scrm-wechat/router' const url = '/rop-scrm-wechat/router'
const WxConfig = { const WxConfig = {
init(jsApiList) { init(jsApiList) {
...@@ -48,8 +47,9 @@ const WxConfig = { ...@@ -48,8 +47,9 @@ const WxConfig = {
}, },
/**生成小程序短链 */ /**生成小程序短链 */
createMiniprogramUrlLink(data = {}) { createMiniprogramUrlLink(data = {}) {
const { envVersion } = window.$fetchConfig
data.method = 'scrm.api.wechat.miniprogram.geturllink' data.method = 'scrm.api.wechat.miniprogram.geturllink'
data.envVersion = IS_PROD ? 'release' : 'trial' data.envVersion = envVersion
/**path 页面路径 /**path 页面路径
* query 页面参数 * query 页面参数
* isExpire 过期类型 到期失效:true,永久有效:false * isExpire 过期类型 到期失效:true,永久有效:false
......
...@@ -227,6 +227,9 @@ ...@@ -227,6 +227,9 @@
box-sizing: border-box; box-sizing: border-box;
height: 100px; height: 100px;
} }
.van-field--min-height .van-field__control{
height: 82px;
}
} }
} }
......
...@@ -14,10 +14,7 @@ ...@@ -14,10 +14,7 @@
@change="change" @change="change"
/> />
</div> </div>
<div <div class="modal-content">
class="modal-content"
:key="updata"
>
<template v-if="flag"> <template v-if="flag">
<template v-if="couponList.length"> <template v-if="couponList.length">
<template v-for="(i,index) in couponList"> <template v-for="(i,index) in couponList">
...@@ -35,7 +32,7 @@ ...@@ -35,7 +32,7 @@
<div class="right"> <div class="right">
<div class="title text-hide">{{i.couponName}}</div> <div class="title text-hide">{{i.couponName}}</div>
<div class="text flex">库存:{{i.residueAmount}}<span class="line" />预估成本:{{centsToyuan(i.anticipatedCost)}}元</div> <div class="text flex">库存:{{i.residueAmount}}<span class="line" />预估成本:{{centsToyuan(i.anticipatedCost)}}元</div>
<div class="text flex"> <div class="text flex text-tips">
<template v-if="tabIndex == 0"> <template v-if="tabIndex == 0">
<template v-if="i.useType == 0"> <template v-if="i.useType == 0">
不限次数 不限次数
...@@ -54,7 +51,7 @@ ...@@ -54,7 +51,7 @@
<template v-else> <template v-else>
有效期: 有效期:
<template v-if="i.effectiveType == 1"> <template v-if="i.effectiveType == 1">
{{i.receiveEndTime}} 领取后{{i.effectiveDays}}天
</template> </template>
<template v-if="i.effectiveType == 2"> <template v-if="i.effectiveType == 2">
{{i.effectiveStartTime}}-{{i.effectiveEndTime}} {{i.effectiveStartTime}}-{{i.effectiveEndTime}}
...@@ -63,14 +60,16 @@ ...@@ -63,14 +60,16 @@
无限期 无限期
</template> </template>
<span class="tips text-center"> <span class="tips text-center">
<template v-if="i.useType == 0"> <template v-if="tabIndex == 1">
<template v-if="i.useBarriers == 1">
无限制次数 无限制次数
</template> </template>
<template v-if="i.useType == 1"> <template v-if="i.useBarriers == 2">
可用{{i.useAmount}}次 订单满{{centsToyuan(i.full)}}元可用
</template> </template>
<template v-if="i.useType == 2"> </template>
{{i.useLimitDays}}天可用{{i.useAmount}}次 <template v-else>
可用1次
</template> </template>
</span> </span>
</template> </template>
...@@ -142,7 +141,6 @@ export default { ...@@ -142,7 +141,6 @@ export default {
tab: ['门店服务', '代金券', '折扣券', '兑换券'], tab: ['门店服务', '代金券', '折扣券', '兑换券'],
tabIndex: 0, tabIndex: 0,
couponList: [], couponList: [],
updata: new Date().getTime(),
chooseItems: [], chooseItems: [],
} }
}, },
...@@ -168,9 +166,10 @@ export default { ...@@ -168,9 +166,10 @@ export default {
}, },
getCouponList (callBack) { getCouponList (callBack) {
// 1:满减券,2:折扣券,3:代金券,4:兑换券 5:购车代金券 6:商品折扣券,7:会员服务 // 1:满减券,2:折扣券,3:代金券,4:兑换券 5:购车代金券 6:商品折扣券,7:会员服务
let { merchantId, uuid } = this.getLocalStorage('dj_scrm_userInfo')
let { tabIndex } = this let { tabIndex } = this
let discountType = [7, 3, 2, 4][tabIndex] let discountType = [7, 3, 2, 4][tabIndex]
giftApi.getCouponList({ discountType }).then(res => { giftApi.getCouponList({ discountType, merchantId, staffUUID: uuid }).then(res => {
this.couponList = res.list this.couponList = res.list
this.flag = true this.flag = true
if (callBack) callBack() if (callBack) callBack()
...@@ -192,27 +191,13 @@ export default { ...@@ -192,27 +191,13 @@ export default {
}) })
}, },
choose (index) { choose (index) {
let { couponList, tabIndex, chooseItems } = this let { couponList, chooseItems } = this
if (tabIndex == 0) {
couponList[index].active = !couponList[index].active couponList[index].active = !couponList[index].active
} else {
if (couponList[index].active) couponList[index].active = false
else {
couponList.map(e => e.active = false)
couponList[index].active = true
}
couponList.map(e => {
chooseItems.map((i, ind) => {
if (!e.active && e.id == i.couponId) delete chooseItems[ind]
})
})
}
if (!couponList[index].active) { if (!couponList[index].active) {
chooseItems.map((e, ind) => { chooseItems.map((e, ind) => {
if (e.couponId == couponList[index].id) delete chooseItems[ind] if (e.couponId == couponList[index].id) delete chooseItems[ind]
}) })
} }
this.updata = new Date().getTime()
this.setChooseItems() this.setChooseItems()
}, },
setChooseItems () { setChooseItems () {
...@@ -251,6 +236,10 @@ export default { ...@@ -251,6 +236,10 @@ export default {
}, },
confirm () { confirm () {
let { chooseItems } = this let { chooseItems } = this
if(chooseItems.length == 0) {
this.showToast('请至少选择一项')
return
}
this.$emit('confirm', { chooseItems }) this.$emit('confirm', { chooseItems })
this.toggle() this.toggle()
} }
...@@ -386,6 +375,9 @@ export default { ...@@ -386,6 +375,9 @@ export default {
flex-shrink: 0; flex-shrink: 0;
} }
} }
.text-tips {
padding-right: 16px;
}
} }
} }
.active { .active {
......
...@@ -90,11 +90,11 @@ ...@@ -90,11 +90,11 @@
<template v-if="i.active"> <template v-if="i.active">
<div class="radio-input"> <div class="radio-input">
<van-field <van-field
v-model="obj.receiveDetails" v-model="obj[i.key]"
:type="i.type || 'text'" :type="i.type || 'text'"
:maxlength="i.maxlength" :maxlength="i.maxlength"
:placeholder="i.placeholder" :placeholder="i.placeholder"
@input="input" @input="input(i,$event)"
/> />
</div> </div>
</template> </template>
...@@ -143,8 +143,8 @@ export default { ...@@ -143,8 +143,8 @@ export default {
couponList: [] couponList: []
}, },
radioObj: [ radioObj: [
{ name: '指定手机号', type: 'tel', placeholder: '客户需输入指定的手机号,才能成功领取礼包', maxlength: 11, active: true }, { name: '指定手机号', type: 'tel', placeholder: '客户需输入指定的手机号,才能成功领取礼包', maxlength: 11, active: true, key: 'phone' },
{ name: '指定车架号后6位', placeholder: '客户需输入指定的车架号,才能成功领取礼包', maxlength: 6 }, { name: '指定车架号后6位', placeholder: '客户需输入指定的车架号,才能成功领取礼包', maxlength: 6, key: 'vin' },
], ],
total: 0, total: 0,
id: '', id: '',
...@@ -160,7 +160,8 @@ export default { ...@@ -160,7 +160,8 @@ export default {
else this.flag = true else this.flag = true
}, },
methods: { methods: {
input () { input (i, e) {
if (i && i.key == 'vin') this.obj[i.key] = e.replace(/[^0-9a-zA-Z]/, '')
this.checkData() this.checkData()
}, },
getDetail (id) { getDetail (id) {
...@@ -179,6 +180,7 @@ export default { ...@@ -179,6 +180,7 @@ export default {
radioObj.map(e => e.active = false) radioObj.map(e => e.active = false)
radioObj[index].active = true radioObj[index].active = true
this.obj.receiveWay = index == 0 ? 1 : 2 this.obj.receiveWay = index == 0 ? 1 : 2
this.checkData()
}, },
showGiftModal () { showGiftModal () {
this.$refs.GiftModal.toggle() this.$refs.GiftModal.toggle()
...@@ -192,13 +194,21 @@ export default { ...@@ -192,13 +194,21 @@ export default {
}, },
checkData () { checkData () {
let { obj } = this let { obj } = this
let target = ['name', 'remarkName', 'couponList', 'receiveDetails'] let target = ['name', 'remarkName', 'couponList', 'phone', 'vin']
try { try {
target.map(key => { target.map(key => {
if (key == 'phone' || key == 'vin') {
if (obj.receiveWay == 1) {
if (!obj.phone) throw key
} else {
if (!obj.vin) throw key
}
} else {
if (!obj[key]) throw key if (!obj[key]) throw key
if (Array.isArray(obj[key])) { if (Array.isArray(obj[key])) {
if (!obj[key].length) throw key if (!obj[key].length) throw key
} }
}
}) })
} catch (error) { } catch (error) {
this.disabled = true this.disabled = true
...@@ -219,12 +229,12 @@ export default { ...@@ -219,12 +229,12 @@ export default {
if (disabled) return if (disabled) return
let { obj, disabled, id } = this let { obj, disabled, id } = this
if (obj.receiveWay == 1) { if (obj.receiveWay == 1) {
if (!phoneRex.test(obj.receiveDetails)) { if (!phoneRex.test(obj.phone)) {
this.showToast('请输入正确的手机号') this.showToast('请输入正确的手机号')
return return
} }
} else { } else {
if (obj.receiveDetails.length < 6) { if (obj.vin.length < 6) {
this.showToast('请输入车架号的后6位') this.showToast('请输入车架号的后6位')
return return
} }
...@@ -249,9 +259,9 @@ export default { ...@@ -249,9 +259,9 @@ export default {
name: obj.name, name: obj.name,
remarkName: obj.remarkName, remarkName: obj.remarkName,
receiveWay: obj.receiveWay, receiveWay: obj.receiveWay,
receiveDetails: obj.receiveDetails,
giveReason: obj.giveReason, giveReason: obj.giveReason,
couponCreateRequests couponCreateRequests,
receiveDetails: obj.receiveWay == 1 ? obj.phone : obj.vin
} }
if (id) params.id = id if (id) params.id = id
this.showLoading('提交中...') this.showLoading('提交中...')
......
...@@ -32,7 +32,10 @@ ...@@ -32,7 +32,10 @@
<div class="value">{{obj.name}}</div> <div class="value">{{obj.name}}</div>
</div> </div>
<div class="item"> <div class="item">
<div class="label">备注名称</div> <div class="label">
备注名称
<span>(仅内部可见)</span>
</div>
<div class="value">{{obj.remarkName||''}}</div> <div class="value">{{obj.remarkName||''}}</div>
</div> </div>
</div> </div>
...@@ -81,7 +84,7 @@ ...@@ -81,7 +84,7 @@
<div class="box readonly-box"> <div class="box readonly-box">
<div class="title">赠送原因</div> <div class="title">赠送原因</div>
<div class="item"> <div class="item">
{{obj.giveReason || '无'}} {{obj.giveReason || '-'}}
</div> </div>
</div> </div>
<template v-if="obj.receivedFlag == 1"> <template v-if="obj.receivedFlag == 1">
......
...@@ -139,8 +139,9 @@ export default { ...@@ -139,8 +139,9 @@ export default {
}, },
mounted () { mounted () {
this.showLoading()
this.getList() this.getList()
wxConfig.init(['sendChatMessage']) wxConfig.init(['shareAppMessage'])
}, },
methods: { methods: {
getList () { getList () {
...@@ -193,17 +194,19 @@ export default { ...@@ -193,17 +194,19 @@ export default {
this.getList() this.getList()
}, },
send (e) { send (e) {
console.log('fa')
const { shopmall_appid } = window.$fetchConfig const { shopmall_appid } = window.$fetchConfig
let { merchantId, sapCode } = this.getLocalStorage('dj_scrm_userInfo') let { merchantId, sapCode } = this.getLocalStorage('dj_scrm_userInfo')
let query = `id=${e.id}&merchantId=${merchantId}` let query = `id=${e.id}&merchantId=${merchantId}`
if (sapCode) query = `${query}&storeCode=${sapCode}` if (sapCode) query = `${query}&storeCode=${sapCode}`
wxConfig wxConfig
.createMiniprogramUrlLink({ .createMiniprogramUrlLink({
path: 'packageMine/pages/boutique/gift/gift', path: 'packageEquity/pages/directional/directional',
query: encodeURIComponent(query), query: encodeURIComponent(query),
appId: shopmall_appid appId: shopmall_appid
}) })
.then(link => { .then(link => {
console.log(link)
wxConfig wxConfig
.shareAppMessage({ .shareAppMessage({
title: e.name, title: e.name,
...@@ -223,8 +226,8 @@ export default { ...@@ -223,8 +226,8 @@ export default {
this.$router.push({ name: 'gift.detail', query: { id } }) this.$router.push({ name: 'gift.detail', query: { id } })
}, },
createQr (e) { createQr (e) {
const { envVersion } = window.$fetchConfig
let { merchantId, sapCode } = this.getLocalStorage('dj_scrm_userInfo') let { merchantId, sapCode } = this.getLocalStorage('dj_scrm_userInfo')
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
const { shopmall_appid } = window.$fetchConfig const { shopmall_appid } = window.$fetchConfig
let scene = `id=${e.id}&merchantId=${merchantId}` let scene = `id=${e.id}&merchantId=${merchantId}`
if (sapCode) query = `${query}&storeCode=${sapCode}` if (sapCode) query = `${query}&storeCode=${sapCode}`
...@@ -232,7 +235,7 @@ export default { ...@@ -232,7 +235,7 @@ export default {
giftApi.createQr({ giftApi.createQr({
appId: shopmall_appid, appId: shopmall_appid,
path: 'packageEquity/pages/directional/directional', path: 'packageEquity/pages/directional/directional',
envVersion: IS_PROD ? 'release' : 'trial', envVersion,
scene scene
}).then(res => { }).then(res => {
this.hideLoading() this.hideLoading()
...@@ -258,6 +261,13 @@ export default { ...@@ -258,6 +261,13 @@ export default {
box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5); box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
border-radius: 4px; border-radius: 4px;
margin-bottom: 10px; margin-bottom: 10px;
/deep/.van-swipe-cell__wrapper{
width: 100.1%;
}
/deep/.van-swipe-cell__right{
border-radius: 0 4px 4px 0;
overflow: hidden;
}
} }
} }
.type-0 { .type-0 {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!