Commit ab9d69e6 by 李伟康

修改新用户购买相关BUG

1 parent 909e46e1
......@@ -27,7 +27,8 @@ export default {
data.method = 'scrm.api.shopmall.weapp.order.create'
return window.$HTTP({
url,
data
data,
returnAll: true
})
},
/**创建支付订单(去付款) */
......
<template>
<div :class="['action isFullSucreen flex', { bgBlack: bgBlack }]"
v-if="show">
<div class="btn-box flex"
v-show="!bgBlack">
<div class="item"
@click="getPoster">
<div
:class="['action isFullSucreen flex', { bgBlack: bgBlack }]"
v-if="show"
>
<div
class="btn-box flex"
v-show="!bgBlack"
>
<div
class="item"
@click="getPoster"
>
<div class="sprite-icon icon-poster"></div>
海报
</div>
......@@ -14,10 +20,12 @@
{{ detail.price }}
<span>.{{ detail.decimal }}</span>
</div>
<div :class="['btn text-center', { disabled: iSMiniprogram || detail.activityStatus == 3 || detail.buyFlag == 2 }, { short: detail.buyFlag == 3 }]"
@click="submit"
@touchstart="touchstart"
@touchend="touchend">
<div
:class="['btn text-center', { disabled: iSMiniprogram || detail.activityStatus == 3 || detail.buyFlag == 2 }, { short: detail.buyFlag == 3 }]"
@click="submit"
@touchstart="touchstart"
@touchend="touchend"
>
<template v-if="detail.activityStatus == 1 && detail.buyFlag != 2">预热下单</template>
<template v-else-if="detail.activityStatus == 3">活动已结束</template>
<template v-else>
......@@ -26,22 +34,32 @@
<template v-else>立即参团</template>
</template>
</div>
<pay-modal v-model="showModal"
:list="formList"
@cancel="showModal = false"
@pay="checkOut"
:payStatus="payStatus"
:carInfo="carInfo" />
<van-overlay :show="showPoster"
@click.self="showPoster = false">
<div class="wrapper"
@click.stop>
<van-image :src="posterImg"
width="100%"
height="100%">
<pay-modal
v-model="showModal"
:list="formList"
@cancel="showModal = false"
@pay="checkOut"
:payStatus="payStatus"
:carInfo="carInfo"
/>
<van-overlay
:show="showPoster"
@click.self="showPoster = false"
>
<div
class="wrapper"
@click.stop
>
<van-image
:src="posterImg"
width="100%"
height="100%"
>
<template v-slot:loading>
<van-loading type="spinner"
size="20" />
<van-loading
type="spinner"
size="20"
/>
</template>
</van-image>
</div>
......@@ -57,7 +75,7 @@ export default {
watch: {
watchUpdataCarInfo: {
immediate: true,
handler(n) {
handler (n) {
let {
activityInfo: { carInfo },
activityInfo }
......@@ -68,7 +86,7 @@ export default {
},
watchInfo: {
immediate: true,
handler(n) {
handler (n) {
if (n.id) {
let [price, decimal] = this.centsToyuan(n.retailPrice).toString().split('.')
if (!decimal) decimal = '00'
......@@ -121,14 +139,14 @@ export default {
}
},
computed: {
watchInfo() {
watchInfo () {
return this.$store.state.app.activityInfo
},
watchUpdataCarInfo() {
watchUpdataCarInfo () {
return this.$store.state.app.updataCarInfo
}
},
data() {
data () {
return {
show: false,
showModal: false,
......@@ -146,11 +164,11 @@ export default {
default: false
}
},
mounted() {
mounted () {
this.iSMiniprogram = window.__wxjs_environment === 'miniprogram'
},
methods: {
submit() {
submit () {
let { detail, iSMiniprogram } = this
if (iSMiniprogram) {
this.showToast('参团请拨打短信中咨询热线')
......@@ -183,11 +201,15 @@ export default {
shareStaffName: linkParams.shareStaffName || '',
shareStaffImageUrl: linkParams.shareStaffImageUrl || ''
}
shopmallApi.createOrder(params).then(data => {
that.pay(data)
shopmallApi.createOrder(params).then(({ data, code, message }) => {
if (code == '0') that.pay(data)
else {
that.payStatus = Date.now()
that.showToast(message)
}
})
}, 1e3),
pay(orderInfo) {
pay (orderInfo) {
this.showLoading('结算中')
this.payStatus = Date.now()
shopmallApi.payOrder({
......@@ -228,7 +250,7 @@ export default {
} else this.showToast(message)
})
},
getPoster() {
getPoster () {
let { id } = this.detail
let userInfo = this.getUserInfo()
let { phone, nickName, logo } = userInfo
......
<template>
<van-action-sheet v-model="showBox" @click-overlay="onCancel" :lock-scroll="false">
<van-action-sheet
v-model="showBox"
@click-overlay="onCancel"
:lock-scroll="false"
>
<div class="box">
<template v-for="(i, index) in items">
<template v-if="i.name">
<div class="item flex" :key="index">
<div
class="item flex"
:key="index"
>
<div class="label text-hide">
<span>*</span>
{{ i.name }}
</div>
<div class="value">
<template v-if="i.route">
<van-field readonly :placeholder="`请选择您的${i.name}`" @click="jumpCarBrands(i.route)" v-model="params[i.key]" class="readonly" right-icon="arrow"></van-field>
<van-field
readonly
:placeholder="`请选择您的${i.name}`"
@click="jumpCarBrands(i.route)"
v-model="params[i.key]"
class="readonly"
right-icon="arrow"
></van-field>
</template>
<template v-else>
<van-field v-model="params[i.key]" :placeholder="`请填写您的${i.name}`" :maxlength="i.maxlength" :type="i.type" clearable />
<van-field
v-model="params[i.key]"
:placeholder="`请填写您的${i.name}`"
:maxlength="i.maxlength"
:type="i.type"
clearable
/>
</template>
</div>
</div>
......@@ -23,10 +43,19 @@
本人已阅读且同意<span @click="jump('agreement')">《隐私协议》</span>
</div> -->
<template v-if="ISWXWORK">
<van-button color="#b1b1b1" class="btn disabled">企微暂不支持支付</van-button>
<van-button
color="#b1b1b1"
class="btn disabled"
>企微暂不支持支付</van-button>
</template>
<template v-else>
<van-button color="#f13c3d" class="btn" @click="pay" loading-text="支付中..." :loading="payLoading">立即支付</van-button>
<van-button
color="#f13c3d"
class="btn"
@click="pay"
loading-text="支付中..."
:loading="payLoading"
>立即支付</van-button>
</template>
</div>
</van-action-sheet>
......@@ -60,13 +89,17 @@ export default {
// { name: '电话', key: 'userPhone', maxlength: 11, type: 'tel' },
...this.list
]
console.log(this.items)
let params = {}
this.items.map(e => {
params[e.key] = ''
if (e.route) this.hasCarBrand = true
if (e.key == 'userPhone') {
this.hasPhoneSelect = true
if (phone) params[e.key] = phone
}
})
this.params = params
if (!this.params.userPhone) this.params.userPhone = phone
let { hasDefaultBrands, brandInfo } = this.$parent.detail
if (hasDefaultBrands && !this.params.carBrandsText) {
this.params.carBrandsText = `${brandInfo.vehicleBrandName} ${brandInfo.vehicleSubBrandName}`
......@@ -78,9 +111,11 @@ export default {
},
carInfo (n) {
console.table([JSON.parse(JSON.stringify(n))])
this.params.carBrandsText = `${n.vehicleBrandName} ${n.vehicleSubBrandName}`
this.params.carTypeText = `${n.vehicleSeriesName} ${n.vehicleShapeName}`
}
if (this.params) {
this.params.carBrandsText = `${n.vehicleBrandName} ${n.vehicleSubBrandName}`
this.params.carTypeText = `${n.vehicleSeriesName} ${n.vehicleShapeName}`
}
},
},
data () {
return {
......@@ -88,7 +123,8 @@ export default {
payLoading: false,
items: [],
params: null,
hasCarBrand: false
hasCarBrand: false,
hasPhoneSelect: false
}
},
mounted () {
......@@ -99,7 +135,7 @@ export default {
this.$emit('cancel')
},
pay () {
let { params, items, hasCarBrand, carInfo } = this,
let { params, items, hasCarBrand, carInfo, hasPhoneSelect } = this,
obj = {},
phoneRex = /^[1]([3-9])[0-9]{9}$/,
userInfo = this.getUserInfo(),
......@@ -116,7 +152,7 @@ export default {
this.showToast(`请填写${error}`)
return
}
if (!phoneRex.test(params.userPhone)) {
if (params.userPhone && !phoneRex.test(params.userPhone)) {
this.showToast('请填写正确的手机号')
return
}
......@@ -139,19 +175,22 @@ export default {
}
}
if (userInfo.phone) this.emit(obj)
else ssoApi.captchaLogin({
mobile: params.userPhone,
captcha: 8888,
source: 'CROWDFUNDING_H5'
}).then(({ code, data, message }) => {
if (code == '0') {
this.setUserInfo(data)
this.setSessionId(data.sessionId)
store.dispatch('registerHttp', data.sessionId)
this.emit(obj)
}
else Notify(message)
})
else {
if (!hasPhoneSelect) this.emit(obj)
else ssoApi.captchaLogin({
mobile: params.userPhone,
captcha: 8888,
source: 'CROWDFUNDING_H5'
}).then(({ code, data, message }) => {
if (code == '0') {
this.setUserInfo(data)
this.setSessionId(data.sessionId)
store.dispatch('registerHttp', data.sessionId)
this.emit(obj)
}
else Notify(message)
})
}
},
emit (obj) {
console.log(obj)
......
<template>
<canvas :id="canvasId" class="create"></canvas>
<canvas
:id="canvasId"
class="create"
></canvas>
</template>
<script type="text/ecmascript-6">
......@@ -58,21 +61,22 @@ export default {
canvasWidth = 337,
canvasHeight = 561,
carText = '',
labelList = ['姓名:', '手机:'],
labelList = ['姓名:'],
spacing = 0,
textYList = [],
labelEndX = 80,
lineNum = 2,
lineHeight = 24
lineHeight = 24,
valueList = [userName]
const draw = new Draw(this, {
width: canvasWidth,
height: canvasHeight,
// pixelRatio: 1
})
let valueList = [
userName,
userPhone,
]
if (userPhone) {
labelList.push('手机:')
valueList.push(userPhone)
}
if (plateNo) {
labelList.push('车牌号:')
valueList.push(plateNo)
......@@ -84,7 +88,7 @@ export default {
}
labelList = [...labelList, '商品名称:', '支付时间:']
valueList = [...valueList, goodsName, new Date(createdDate).format('yyyy年M月d日 hh:mm:ss')]
if(orderStatus != 10 && outTradeNo){
if (orderStatus != 10 && outTradeNo) {
labelList.push('商户订单号:')
valueList.push(outTradeNo)
}
......@@ -176,6 +180,7 @@ export default {
value.y = textYList[index] + 5
}
draw.drawText(label)
console.log('---------------', e, value)
draw.drawText(value)
}))
draw.drawLine({
......
......@@ -10,7 +10,7 @@
module.exports = {
title: '加载中...',
request: {
baseURL: 'http://scrm.test.glsx.com.cn', // 本地测试项目地址,
baseURL: 'http://scrm.dev.glsx.com.cn', // 本地测试项目地址,
// 设置超时时间
timeout: 180000,
// 携带凭证
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!