Commit e1bd0c3a by 王志慧

删除不需要的代码

1 parent 69432855
Showing 76 changed files with 4 additions and 3931 deletions
import { util } from 'utils'
import dayjs from 'dayjs'
// 埋点上报
const commonUrl = '/rop-scrm-bigdatautil/router'
// 心跳检测
const heartbeatUrl = '/rop-scrm-shopmall/router'
// 离开埋点url
const leaveUrl = '/rop-scrm-bigdatautil/data/report'
// 第一次进入时间
let firstEnter = true
const enter_time = new Date().format('yyyy-MM-dd hh:mm:ss')
/** 埋点 */
/**
* @param {*} id 活动id
* @param {*} view 动作类型 // 1浏览 4分享 5离开页面
* @param {*} share_channel // 分享类型(1:转发,2:朋友圈)
* @param {*} url // 基础路径
* @param {*} method 方法地址
* @param {*} leave 是否离开事件 默认是false
* @returns
*/
const reportTrack = (id, view = 1, share_channel = '', url = commonUrl, method = 'entmicro.api.customercollect.reportCustomerList', leave = false) => {
const userInfo = util.getUserInfo()
const params = util.getLocalStorage('wx_scrm_link_params') || {}
const ISWXWORK = util.getLocalStorage('is_wxwork')
if (!userInfo) return
if (ISWXWORK) {
if (userInfo.loginList.length && userInfo.loginList[0].phone) userInfo.phone = userInfo.loginList[0].phone
}
// 处理分享时间格式(1.YYYY-MM-DD HH:mm:ss,2.时间戳)
let sharedTime
if (params.sharedTime) {
if (!params.sharedTime.includes('-')) {
sharedTime = dayjs(+params.sharedTime).format('YYYY-MM-DD HH:mm:ss')
} else {
sharedTime = decodeURIComponent(params.sharedTime)
}
} else {
sharedTime = ''
}
let data = {
open_id: userInfo.openid || userInfo.uuid,
staff_id: (params && params.staffId) || null,
staff_uuid: (params && params.shareStaffUuid) || null,
user_phone: (params && params.userPhone) || null,
create_time: firstEnter ? enter_time : new Date().format('yyyy-MM-dd hh:mm:ss'), // 离开时间
enter_time, // 进入时间
item_type: 3,
customer_phone: userInfo.phone || null,
action_type: view,
item_id: id,
business_type: 1,
add_way: 104,
merchant_id: (params && params.merchantId) || null,
user_open_id: (params && params.openId) || null,
share_channel: share_channel ? share_channel : null,
sharedTime: sharedTime ? sharedTime : null,
is_exclusive: (params && params.isExclusive) || null,
exclusive_uuid: (params && params.exclusiveUuid) || null,
share_staff_type: (params && params.shareStaffType) || null, //v3.1.0版本增加
}
if (view == 4) data.user_open_id = userInfo.openid || userInfo.uuid
if (ISWXWORK) {
delete data.user_open_id
if (view == 4) data.staff_uuid = userInfo.uuid
}
// 数据上报兼容
data = {
// method: 'entmicro.api.customercollect.reportCustomerList',
method: method ? method : null,
jsonList: [JSON.stringify(data)]
}
firstEnter = false
// 是否离开事件
if (leave) {
if (navigator.sendBeacon) {
const params = JSON.stringify(data)
return navigator.sendBeacon(url, params)
} else {
return window.$HTTP({
url,
data
})
}
} else {
return window.$HTTP({
url,
data
})
}
}
// 心跳检测
const heartbeat = (id, view = 5, share_channel = '', url = heartbeatUrl, method = 'scrm.api.shopmall.customer.browse.records.heart') => {
reportTrack(id, view, share_channel, url, method)
}
//离开事件数据上报
const leaveReportTrack = (id, view = 5) => {
// console.log('离开事件数据上报')
reportTrack(id, view, '', leaveUrl, '', true)
}
export default {
reportTrack,
heartbeat,
leaveReportTrack
}
const url = '/rop-scrm-carlife/router'
import { util } from 'utils'
export default {
/**获取车品牌列表 */
getCarBrandList(data = {}) {
data.method = 'scrm.api.carlife.common.getOnlyCarBrandList'
return window.$HTTP({
url,
data
})
},
/** 获取车系列表 */
getCarSeriesList(params) {
let data = {
method: 'scrm.api.carlife.common.getCarSeriesList',
...params
}
return window.$HTTP({
url,
data
})
},
/** 获取车型 */
getCarTypeList(carSeriesId) {
let data = {
method: 'scrm.api.carlife.common.getCarTypeList',
carSeriesId
}
return window.$HTTP({
url,
data
})
}
}
......@@ -7,10 +7,7 @@
* @LastEditTime: 2021-06-17 18:23:27
*/
import ssoApi from './ssoApi'
import mapApi from './mapApi'
import wxConfig from './wxConfig'
import shopmallApi from './shopmallApi'
import bigdatautilApi from './bigdatautilApi'
import carLifeApi from './carLifeApi'
export { ssoApi, mapApi, wxConfig, shopmallApi, bigdatautilApi, carLifeApi }
export { ssoApi, wxConfig }
import md5 from './utils/md5'
import qs from './utils/qs'
const key = 'F2HBZ-KH73F-7A2J2-JC4UR-WOHCO-UVFGZ'
const secret = 'YBmrM98E5pM4gYeknWiBPaWpFR4AISUl'
const domain = 'https://apis.map.qq.com'
class QQMap {
setLocaleCompare(params) {
params.key = key
let keys = []
let obj = {}
Object.keys(params).map(e => keys.push(e))
keys.sort((a, b) => a.localeCompare(b)).map(e => (obj[e] = params[e]))
return obj
}
getSign(params, methods) {
let obj = this.setLocaleCompare(params)
let sign = `${methods}?${decodeURIComponent(qs.stringify(obj))}${secret}`
return md5(sign)
}
request(method, data) {
data.output = 'jsonp'
// data.callback = 'test'
const sig = this.getSign(data, method)
let obj = {
...this.setLocaleCompare(data),
sig
},
params = []
Object.keys(obj).map(key => {
params.push(`${key}=${encodeURIComponent(obj[key])}`)
})
// window.fetch(`${domain}${method}?${params.join('&')}`, {
// method: 'GET',
// mode: 'no-cors',
// })
let script = document.createElement('script')
script.src = `${domain}${method}?${params.join('&')}`
script.type = 'text/javascript'
document.body.insertBefore(script, document.body.children[0])
return new Promise((resolve, reject) => {
window['QQmap'] = ({ status, result }) => {
console.log(result)
if (status == '0') resolve(result)
else reject()
document.body.removeChild(script)
}
})
}
/**计算距离 */
calculateDistance(from, to) {
from = from.join(',')
to = to.join(',')
return this.request('/ws/distance/v1/', {
from,
to,
mode: 'driving'
})
}
/** 批量距离计算(矩阵) */
calculateDistanceMatrix(from, toList) {
from = from.join(',')
let to = toList.join(';')
return this.request('/ws/distance/v1/matrix/', {
from,
to,
mode: 'driving'
})
}
/**地址解析(地址转坐标) */
geocoder(address) {
return this.request('/ws/geocoder/v1/', {
address
})
}
/**逆地址解析(坐标位置描述) location=lat<纬度>,lng<经度> */
detailedAdrress(location) {
location = location.join(',')
return this.request('/ws/geocoder/v1/', {
location
})
}
/**IP定位 */
getLocationByIp() {
return this.request('/ws/location/v1/ip')
}
/**坐标转换 */
translate(locations, type = 5) {
locations = locations.join(';') //格式:纬度前,经度后
return this.request('/ws/coord/v1/translate', {
locations,
type
})
}
}
export default new QQMap()
const url = '/rop-scrm-shopmall/router'
import { util } from 'utils'
export default {
/**众筹详情 */
getActivityDetail (id) {
return window.$HTTP({
url,
data: {
method: 'scrm.api.shopmall.weapp.activity.detail',
id
},
returnAll: true
})
},
/**参团人数 */
getActivityGroup (id) {
return window.$HTTP({
url,
data: {
method: 'scrm.api.shopmall.weapp.activity.group',
id
}
})
},
/** 创建订单(立即购买) */
createOrder (data) {
data.method = 'scrm.api.shopmall.weapp.order.create'
return window.$HTTP({
url,
data,
returnAll: true
})
},
/**创建支付订单(去付款) */
payOrder (data) {
data.method = `scrm.api.shopmall.weapp.order.createPay`
return window.$HTTP({
url,
data,
returnAll: true
})
},
/**海报 */
getPoster (data) {
data.method = `scrm.api.shopmall.weapp.crowdFunding.poster`
return window.$HTTP({
url,
data
})
},
/** 订单详情 */
getOrderList (activityId) {
let data = {
activityId,
method: 'scrm.api.shopmall.weapp.crowdFunding.order.list'
}
return window.$HTTP({
url,
data
})
},
// 根据众筹id获取直播详情
getLiveDetail (id) {
let data = {
id,
method: 'scrm.api.shopmall.weapp.activity.live.broadcast.detail'
}
return window.$HTTP({
url,
data
})
},
// 直播IM用户签名
getLiveSig (data) {
data.method = 'scrm.api.shopmall.weapp.live.activity.usersig'
return window.$HTTP({
url,
data
})
},
/** 查询分享人信息 */
getStaffInfo (data) {
data.method = 'scrm.api.shopmall.activity.share.user.info'
return window.$HTTP({
url,
data
})
},
/**直播间埋点*/
liveRoomReport (data) {
const userInfo = util.getUserInfo(),
params = util.getLocalStorage('wx_scrm_link_params') || {}
let obj = {
accountId: userInfo.accountId,
accountName: userInfo.nickName,
customerAvatar: userInfo.logo,
customerOpenId: userInfo.openid,
customerUnionId: '',
customerPhone: userInfo.phone || '',
merchantId: params.merchantId,
bizDataType: 1,
operationType: 3,
operationDate: new Date().format('yyyy-MM-dd hh:mm:ss'),
visitSource: 'H5-众筹'
}
data.method = 'scrm.api.shopmall.livebroadcast.report'
return window.$HTTP({
url,
data: {
...data,
...obj
},
})
},
/**支付商户收款测试创建支付订单*/
creatCollectionsTestOrder(data) {
data.method = 'entmicro.api.payment.createTrade'
return window.$HTTP({
url: '/rop-scrm-entmicro/router',
data
})
}
}
.sprite-icon { background-image: url(../images/sprite.png);background-size: 453px 420px;}
.icon-address { width: 34px; height: 34px; background-position: -356px -232px;}
.icon-arrow { width: 7px; height: 11px; background-position: -444px -232px;}
.icon-avatar { width: 36px; height: 36px; background-position: -310px -232px;}
.icon-big-play { width: 40px; height: 40px; background-position: -376px -152px;}
.icon-close { width: 24px; height: 24px; background-position: -426px -152px;}
.icon-download { width: 30px; height: 30px; background-position: -352px -278px;}
.icon-faq-left { width: 18px; height: 22px; background-position: 0px -374px;}
.icon-faq-right { width: 18px; height: 22px; background-position: -28px -374px;}
.icon-flash { width: 10px; height: 14px; background-position: 0px -406px;}
.icon-hot { width: 15px; height: 18px; background-position: -436px -202px;}
.icon-kf-box { width: 300px; height: 350px; background-position: 0px 0px;}
.icon-kf-logo { width: 56px; height: 70px; background-position: -310px -152px;}
.icon-kf { width: 20px; height: 20px; background-position: -376px -202px;}
.icon-live-close { width: 18px; height: 18px; background-position: -56px -374px;}
.icon-music-off { width: 34px; height: 34px; background-position: -400px -232px;}
.icon-music { width: 32px; height: 32px; background-position: -310px -278px;}
.icon-order { width: 20px; height: 20px; background-position: -406px -202px;}
.icon-pause { width: 30px; height: 30px; background-position: -392px -278px;}
.icon-phone { width: 12px; height: 13px; background-position: -84px -374px;}
.icon-play { width: 30px; height: 30px; background-position: -310px -320px;}
.icon-poster { width: 20px; height: 20px; background-position: -432px -278px;}
.icon-qr { width: 143px; height: 142px; background-position: -310px 0px;}
.icon-scan { width: 30px; height: 30px; background-position: -350px -320px;}
.icon-success { width: 20px; height: 20px; background-position: -430px -320px;}
.icon-time { width: 12px; height: 11px; background-position: -106px -374px;}
.icon-title { width: 170px; height: 4px; background-position: 0px -360px;}
.icon-top { width: 30px; height: 30px; background-position: -390px -320px;}
\ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 7px 11px;}
.icon-arrow { width: 7px; height: 11px; background-position: 0px 0px;}
\ No newline at end of file

107 KB | W: | H:

582 Bytes | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template>
<div :class="['share-item', { hideBorder }]">
<div class="content">
<div class="user-info flex">
<div>
<img class="icon-head" :src="item.imageUrl" />
<!-- <div v-else class="sprite-icon icon-avatar"></div> -->
</div>
{{ item.name }}
</div>
<div :class="['text', { 'text-two-line': indexType }]" v-text="item.experience"></div>
<div :class="['img-box', { four: indexType }]">
<template v-for="(i, index) in item.activityExperienceImgs">
<div @click="jumpPreview(index)" v-if="indexType ? index < 4 : true" class="img-item" :key="index">
<img :src="i.imageUrl" />
</div>
</template>
</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'EvaluateItem',
props: {
hideBorder: Boolean,
indexType: Boolean,
item: {
type: Object,
default: () => { }
},
num: Number,
// 显示默认或真实数据头像和昵称,1-默认;2-真实数据
showAvatarNicknameFlag: Number
},
data() {
return {
}
},
mounted() {
},
methods: {
jumpPreview(index) {
let { activityExperienceImgs, experience } = this.item, item = []
activityExperienceImgs.map(e => item.push(e.imageUrl))
this.to('crowdfunding.imagePreview', { item, index, experience })
}
}
}
</script>
<style scoped lang="scss">
@import '@/assets/css/sharegoods.scss';
.user-info {
padding: 14px 0 10px;
font-size: 16px;
font-weight: 600;
color: #282829;
.sprite-icon {
margin-right: 8px;
}
}
.icon-head {
width: 36px;
height: 36px;
border-radius: 50%;
margin-right: 8px;
}
.text {
font-size: 14px;
color: #282829;
line-height: 20px;
margin-bottom: 13px;
word-break: break-all;
line-break: anywhere;
}
.img-box {
display: flex;
flex-wrap: wrap;
gap: 6px;
.img-item {
width: 110px;
height: 110px;
border-radius: 4px;
overflow: hidden;
}
}
.img-box.four {
gap: 8px;
flex-wrap: nowrap;
.img-item {
width: 75px;
height: 75px;
}
}
</style>
<template>
<div :class="['share-item', { hideBorder }, { indexType }]">
<div class="faq-item">
<div class="q flex">
<template v-if="indexType">
<div class="icon text-center">问</div>
</template>
<template v-else>
<div class="sprite-icon icon-faq-left"></div>
</template>
<div :class="['value', { 'text-hide': indexType }]">{{ item.question }}</div>
</div>
<div class="a flex">
<template v-if="indexType">
<div class="icon text-center">答</div>
</template>
<template v-else>
<div class="sprite-icon icon-faq-right"></div>
</template>
<div :class="['value', { 'text-hide': indexType }]">{{ item.answer }}</div>
</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'FAQItem',
props: {
hideBorder: Boolean,
indexType: Boolean,
item: {
type: Object,
default: () => { }
}
},
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang="scss">
@import '@/assets/css/sharegoods.scss';
.faq-item {
padding-top: 16px;
.flex {
margin-bottom: 12px;
align-items: flex-start;
.sprite-icon {
margin-right: 8px;
flex-shrink: 0;
}
}
.icon {
color: #ffffff;
font-size: 12px;
width: 14px;
height: 14px;
background: linear-gradient(108deg, #ffbe68 0%, #ff5446 60%, #f45454 100%);
border-radius: 2px;
flex-shrink: 0;
margin-right: 4px;
}
.q {
.value {
font-weight: 500;
font-size: 16px;
color: #2c2c2c;
}
}
.a {
.value {
font-size: 14px;
color: #282829;
}
.icon {
background: linear-gradient(108deg, #4f7bf6 0%, #3d6ced 60%, #3162e6 100%);
}
}
.value {
line-height: 20px;
line-break: anywhere;
word-break: break-all;
}
}
.indexType {
.faq-item {
padding-top: 0;
}
.flex {
margin-bottom: 0;
align-items: center;
}
.q {
margin-bottom: 6px;
&:last-of-type {
margin-bottom: 0;
}
.value {
color: #2c2c2c;
}
}
.value {
font-weight: 400;
font-size: 12px !important;
}
}
</style>
<template>
<van-overlay :show="show">
<div class="wrapper">
<div :class="['kf-box flex']">
<template>
<div class="qr-box">
<img src="@/assets/images/qr-bg.png" />
<img :src="detail.groupQrCode" class="qr xy-center" />
</div>
<div class="btn" @click="save">长按识别二维码加客服</div>
</template>
</div>
<div class="sprite-icon icon-close" @click.self="cancel"></div>
</div>
</van-overlay>
</template>
<script type="text/ecmascript-6">
export default {
name: 'GroupModal',
props: ['value', 'detail'],
data() {
return {
show: false,
img: null
}
},
mounted() { },
watch: {
value(n) {
this.show = n
}
},
methods: {
cancel() {
this.show = false
this.$parent.showKf = false
},
save() {
this.showToast('请长按二维码保存')
}
}
}
</script>
<style scoped lang="scss">
.van-overlay {
z-index: 3;
}
.wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
flex-direction: column;
.kf-box {
width: 273px;
height: 298px;
position: relative;
flex-direction: column;
font-size: 18px;
font-weight: 500;
background: rgba(#000000, 0.3);
border-radius: 8px;
.qr-box {
position: relative;
margin: 29px 0 19px;
width: 180px;
height: 180px;
.qr {
width: calc(100% - 38px);
height: calc(100% - 38px);
}
}
.btn {
box-shadow: inset 0px -3px 8px 0px rgba(202, 0, 0, 0.89);
background-image: linear-gradient(360deg, rgba(255, 68, 68, 1) 0, rgba(253, 108, 108, 1) 100%);
border-radius: 26px;
padding: 11px 28px 11px 29px;
font-size: 17px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #ffffff;
line-height: 24px;
}
}
.icon-close {
margin-top: 16px;
}
}
</style>
<template>
<van-overlay :show="show">
<div class="wrapper" @click.self="cancel">
<div :class="['kf-box flex', { short: !detail.customerServiceQrImg }]">
<div class="sprite-icon icon-kf-box"></div>
<div class="sprite-icon icon-kf-logo x-center"></div>
<div class="info">
<div class="name">{{ detail.customerServiceName }}</div>
<template v-if="detail.customerServicePhone">
<div class="phone flex" @click="makePhoneCall(detail.customerServicePhone)">
<div class="sprite-icon icon-phone"></div>
{{ detail.customerServicePhone }}
</div>
</template>
</div>
<template v-if="detail.customerServiceQrImg">
<div class="qr-box">
<div class="sprite-icon icon-qr"></div>
<img :src="detail.customerServiceQrImg" class="qr xy-center" />
</div>
<div class="bottom flex">
<div class="item flex">
<div class="sprite-icon icon-download"></div>
<div>
保存图片
<br />
到相册
</div>
</div>
<div class="item flex">
<div class="sprite-icon icon-scan"></div>
<div>
打开微信扫一扫
<br />
添加客服企微
</div>
</div>
</div>
</template>
</div>
</div>
</van-overlay>
</template>
<script type="text/ecmascript-6">
export default {
name: 'KfModal',
props: ['value', 'detail'],
data () {
return {
show: false,
img: null
}
},
mounted () { },
watch: {
value (n) {
this.show = n
}
},
methods: {
cancel () {
this.show = false
this.$parent.showKf = false
},
save () {
this.showToast('请长按二维码保存')
}
}
}
</script>
<style scoped lang="scss">
.van-overlay {
z-index: 3;
}
.wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
flex-direction: column;
.kf-box {
width: 300px;
height: 350px;
position: relative;
flex-direction: column;
font-size: 18px;
font-weight: 500;
color: #282829;
.icon-kf-box {
position: absolute;
}
.icon-kf-logo {
top: -15px;
}
.info {
position: relative;
z-index: 2;
text-align: center;
padding-top: 64px;
.phone {
letter-spacing: 2px;
margin-top: 1px;
}
}
.qr-box {
position: relative;
width: 143px;
height: 142px;
margin: 10px 0 16px;
.qr {
width: calc(100% - 32px);
height: calc(100% - 32px);
}
}
.bottom {
position: absolute;
left: 0;
bottom: 0;
z-index: 2;
width: 100%;
height: 70px;
background: #f7f8fa;
border-radius: 0px 0px 10px 10px;
box-sizing: border-box;
padding: 0 20px;
justify-content: space-between;
.item {
padding-left: 7px;
font-size: 12px;
color: #b1b1b3;
.sprite-icon {
margin-right: 6px;
}
}
}
}
.short {
height: 140px;
.icon-kf-box {
height: 100%;
border-radius: 12px;
}
}
}
</style>
<template>
<div>
<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="label text-hide">
<span v-if="i.key != 'plateNo'">*</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>
</template>
<template v-else-if="i.type == 'plate'">
<van-field
readonly
:placeholder="`请填写您的${i.name}`"
@click="showPlate"
v-model="params[i.key]"
class="readonly"
></van-field>
</template>
<template v-else>
<van-field
v-model="params[i.key]"
:placeholder="`请填写您的${i.name}`"
:maxlength="i.maxlength"
:type="i.type"
clearable
/>
</template>
</div>
</div>
</template>
</template>
<template v-if="userSelectGoodsList.length > 1">
<div class="goods-box">
<goods-list
:list="userSelectGoodsList"
:defaultType="false"
></goods-list>
<template v-if="totalPrice.decimal">
<div class="total-price-box flex">
<div class="total-price">
合计:
<div class="price">
<span class="unit">¥</span>
{{ totalPrice.price }}
<span class="decimal">.{{ totalPrice.decimal }}</span>
</div>
</div>
</div>
</template>
</div>
</template>
<!-- <div class="tips">
本人已阅读且同意<span @click="jump('agreement')">《隐私协议》</span>
</div> -->
<template v-if="ISWXWORK">
<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>
</template>
</div>
</van-action-sheet>
<license-plate
ref="plate"
@done="plateDone"
></license-plate>
</div>
</template>
<script type="text/ecmascript-6">
import { ssoApi } from '@/api'
import { Notify } from 'vant'
import store from '@/store'
export default {
name: 'PayModal',
props: {
value: Boolean,
list: {
type: Array,
default: () => []
},
payStatus: Number,
carInfo: {
type: Object,
default: () => { }
}
},
watch: {
value (n) {
let { phone } = this.getUserInfo()
this.showBox = n
if (n && !this.params) {
this.items = [
{ name: '姓名', key: 'userName', maxlength: 40 },
// { 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
let { hasDefaultBrands, brandInfo, userSelectGoodsList } = this.$parent.detail
if (hasDefaultBrands && !this.params.carBrandsText) {
this.params.carBrandsText = `${brandInfo.vehicleBrandName} ${brandInfo.vehicleSubBrandName}`
}
if (userSelectGoodsList) {
this.userSelectGoodsList = userSelectGoodsList
this.bus.$on('changeUserSelectGoodsList', () => {
this.setTotalPrice()
})
this.setTotalPrice()
}
}
},
payStatus () {
this.payLoading = false
},
carInfo (n) {
console.table([JSON.parse(JSON.stringify(n))])
if (this.params) {
this.params.carBrandsText = `${n.vehicleBrandName} ${n.vehicleSubBrandName}`
this.params.carTypeText = `${n.vehicleSeriesName} ${n.vehicleShapeName}`
}
},
},
data () {
return {
showBox: false,
payLoading: false,
items: [],
params: null,
hasCarBrand: false,
hasPhoneSelect: false,
userSelectGoodsList: [],
totalPrice: {}
}
},
mounted () {
},
methods: {
setTotalPrice () {
const {
userSelectGoodsList
} = this
let totalPrice = 0,
totalGoodsNumber = 0
userSelectGoodsList && userSelectGoodsList.map(e => {
totalPrice += (e.activityPrice * e.goodsNumber)
totalGoodsNumber += e.goodsNumber
})
let [price, dec] = this.decimal(totalPrice).toString().split('.')
if (dec) dec = dec.length == 1 ? `${dec}0` : dec
this.totalPrice = {
price,
decimal: dec || '00'
}
if (totalGoodsNumber == 0) this.onCancel()
},
onCancel () {
this.$emit('cancel')
},
pay () {
let { params, items, hasCarBrand, carInfo, hasPhoneSelect } = this,
obj = {},
phoneRex = /^[1]([3-9])[0-9]{9}$/,
userInfo = this.getUserInfo()
console.log(params)
const onInput = ["plateNo"]
try {
items.map(e => {
Object.keys(params).map(key => {
if (!params[key] && key == e.key && e.name && !onInput.includes(key)) throw e.name
})
})
} catch (error) {
this.showToast(`请填写${error}`)
return
}
if (params.userPhone && !phoneRex.test(params.userPhone)) {
this.showToast('请填写正确的手机号')
return
}
Object.keys(params).map(key => {
if (params[key]) obj[key] = params[key]
})
if (hasCarBrand) {
delete obj.carBrandsText
delete obj.carTypeText
obj = {
...obj,
...carInfo
}
}
if (userInfo.phone) this.emit(obj)
else {
ssoApi.captchaLogin({
mobile: params.userPhone || '88888888888',
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)
this.payLoading = true
this.$emit('pay', { obj, that: this.$parent })
},
jumpCarBrands (name) {
let { hasDefaultBrands, brandInfo } = this.$parent.detail,
{ carInfo } = this
let chooseItem = Object.keys(carInfo).length
if (name == 'carSeries') {
if (chooseItem || hasDefaultBrands) {
let id = chooseItem ? carInfo.vehicleSubBrandId : brandInfo.vehicleSubBrandId
let name = chooseItem ? carInfo.vehicleSubBrandName : brandInfo.vehicleSubBrandName
let list = [{
id,
name,
childs: null
}]
this.to('crowdfunding.carSeries', {
brandInfo: chooseItem ? carInfo : brandInfo,
list
})
return
}
}
this.to('crowdfunding.carBrands')
},
showPlate () {
this.$refs.plate.toggle()
},
plateDone ({ value }) {
this.params.plateNo = value
}
}
}
</script>
<style scoped lang="scss">
.box {
padding: 8px 16px 16px;
.item {
border-bottom: 1px solid #f1f1f1;
height: 49px;
color: #282829;
.label {
font-size: 12px;
width: 86px;
span {
color: #f13c3d;
}
}
.value {
width: calc(100% - 86px);
/deep/.van-field {
padding: 0;
font-size: 12px;
}
.readonly {
/deep/.van-field__control {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
.total-price-box {
height: 54px;
justify-content: flex-end;
padding: 0 16px;
.total-price {
display: flex;
align-items: baseline;
font-size: 14px;
color: #333333;
.price {
font-weight: 600;
font-size: 24px;
color: #f13c3d;
display: flex;
align-items: baseline;
.decimal,
.unit {
font-size: 12px;
}
}
}
}
.btn {
display: block;
font-size: 16px;
font-weight: 600;
color: #ffffff;
width: 100%;
height: 44px;
box-shadow: 0px 2px 6px 2px rgba(241, 60, 61, 0.1);
border-radius: 4px;
border: 1px solid #f13c3d;
margin: 16px auto 0;
}
.disabled {
box-shadow: 0px 2px 6px 2px rgba(177, 177, 177, 0.1);
border: 1px solid #b1b1b1;
}
}
</style>
<template>
<div class="serve" v-if="list.length">
<div class="box flex" @click="showModal = true">
服务
<div class="serve-text flex">
<template v-for="(i, index) in list">
<div :key="index" class="flex">
{{ i.title }}
<span v-if="index != list.length - 1">·</span>
</div>
</template>
</div>
<div class="sprite-icon icon-arrow"></div>
</div>
<serve-modal v-model="showModal" @cancel="showModal = false" :list="list" />
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'Serve',
props: {
list: {
type: Array,
default: () => []
}
},
data () {
return {
showModal: false
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang="scss">
@import '@/assets/css/crowdfunding.scss';
.box {
color: #999999;
font-size: 12px;
font-weight: 400;
border-radius: 4px;
line-height: 17px;
.serve-text {
width: 254px;
color: #2c2c2c;
margin-left: 20px;
overflow: hidden;
white-space: nowrap;
span {
margin: 0 4px;
}
}
.sprite-icon {
margin-left: auto;
}
}
</style>
<template>
<van-action-sheet v-model="showBox" @click-overlay="onCancel" @close="onCancel" title="服务说明">
<div class="content">
<template v-for="(i, index) in list">
<div :key="index" class="item">
<div class="title">{{ i.title }}</div>
<div class="value">{{ i.content }}</div>
</div>
</template>
</div>
</van-action-sheet>
</template>
<script type="text/ecmascript-6">
export default {
name: 'ServeModal',
props: {
value: Boolean,
list: {
type: Array,
default: () => []
}
},
data () {
return {
showBox: false
}
},
watch: {
value (n) {
this.showBox = n
}
},
mounted () {
},
methods: {
onCancel () {
this.$emit('cancel')
},
}
}
</script>
<style scoped lang="scss">
.van-popup--bottom.van-popup--round {
border-radius: 20px 20px 0 0;
}
/deep/.van-action-sheet__header {
line-height: 56px;
font-weight: 500;
font-size: 17px;
color: #2c2c2c;
}
.content {
margin: 0 16px;
border-top: 1px solid #e3e3e6;
height: 374px;
box-sizing: border-box;
overflow-y: scroll;
padding-bottom: 31px;
&::-webkit-scrollbar {
display: none;
}
.item {
padding: 14px 0 0 10px;
.title {
line-height: 20px;
font-size: 14px;
color: #2c2c2c;
position: relative;
&::after {
width: 4px;
height: 4px;
background: #fc5b32;
position: absolute;
top: 50%;
left: -10px;
content: '';
transform: translateY(-50%);
border-radius: 100%;
}
}
.value {
font-size: 12px;
color: #999999;
margin-top: 2px;
line-height: 17px;
}
}
}
</style>
<template>
<div class="box" v-if="evaList.length || faqList.length">
<template v-if="evaList.length">
<div class="sub-title flex" @click="to('crowdfunding.evaluate', { list: evaList, detail: detail })">
服务评价({{ evaList.length }})
<div class="all flex">
<span>全部</span>
<div class="sprite-icon icon-arrow"></div>
</div>
</div>
<evaluate-item :item="evaList[0]" :hideBorder="!faqList.length" indexType :num="1" :showAvatarNicknameFlag="detail.showAvatarNicknameFlag"></evaluate-item>
</template>
<template v-if="faqList.length">
<div class="sprite" v-if="evaList.length"></div>
<div class="sub-title flex faq-title" @click="to('crowdfunding.faq', { list: faqList })">
商品答疑({{ faqList.length }})
<div class="all flex">
<span>全部</span>
<div class="sprite-icon icon-arrow"></div>
</div>
</div>
<template v-for="(i, index) in faqList">
<FAQ-item :key="index" hideBorder indexType :item="i" v-if="index < 1"></FAQ-item>
</template>
</template>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'ShareGoods',
props: {
evaList: {
type: Array,
default: () => []
},
faqList: {
type: Array,
default: () => []
},
detail: {
type: Object,
default: () => { }
}
},
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang="scss">
@import '@/assets/css/sharegoods.scss';
.box {
border-radius: 4px;
}
.sprite {
margin-top: 14px;
}
.faq-title {
margin-bottom: 10px;
}
</style>
<template>
<div id="chat">
<div class="chatBox">
<div class="chatBox-middle">
<div class="chatInfo" id="chatInfo">
<div class="chatUser-box">
<div class="chatUser-info">
<span class="chatUser-info-text notice">
<img class="icon-notice" src="@/assets/images/icon-notice.png" />
欢迎来到直播间!
<p>{{ notifyTxt }}</p>
</span>
</div>
</div>
<div class="chatUser-box" v-for="(item, index) in messageList" :key="index">
<div class="chatUser-info">
<span class="chatUser-info-text">
<span class="chatUser-info-name">{{ item.userName }}:</span>
<span>{{ item.content }}</span>
</span>
</div>
</div>
</div>
</div>
<div class="chatBox-infoDesk" action="javascript:return true">
<van-field :class="['chatBox-input', isFocus ? 'focus-input' : '']" v-model="messageContent" maxlength="200" center placeholder="聊一聊..." use-button-slot @click="fixInputBeCovered($event)" @focus="handleInputFocus" @blur="handleInputFocus">
<img class="icon-send" slot="button" @click="sendTextMessage" src="@/assets/images/send.png" />
</van-field>
<action :videoFullscreen="true" class="action" v-show="isAction && !isFocus" :isImAction="true"></action>
</div>
</div>
</div>
</template>
<script>
import { Notify } from 'vant'
import { util } from 'utils'
import { shopmallApi } from '@/api'
import IM from './im.js'
let timObj = null
const msgMaxNum = 100
export default {
name: 'Im',
data() {
return {
isFocus: false,
notifyTxt: '直播间内严禁出现违法违规、低俗、涉黄、吸烟酗酒等内容,直播期间请勿相信私下交易,诱导购买等信息,以防人身或财产损失。请大家注意财产安全,谨防网络诈骗,文明观看直播。',
messageContent: '',
messageList: []
}
},
props: {
detail: {
type: Object,
default: () => { }
},
liveDetail: {
type: Object,
default: () => {
return {
imGroupId: '',
imSdkAppId: ''
}
}
},
isAction: {
type: Boolean,
default: false
}
},
computed: {},
created() {
this.getUserSig()
this.scrollToBottom()
},
updated() {
this.scrollToBottom()
},
mounted() { },
beforeDestroy() {
timObj.quit()
},
methods: {
fixInputBeCovered({ target }) {
setTimeout(function () {
target.scrollIntoView(true)
}, 100)
},
handleInputFocus() {
clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.isFocus = !this.isFocus
}, 300)
},
getUserSig() {
const userInfo = util.getUserInfo()
const userId = userInfo.openid || userInfo.uuid
// const userId = userInfo.nickName || userInfo.userName
const params = this.getLocalStorage('wx_scrm_link_params') || {}
// sourceShopId-来源门店;visitSource-访问来源;bizType-业务类型(0-众筹);bizCode-业务标识(众筹-活动ID)
const obj = {
userId: userId,
sourceShopId: params.merchantId || '',
visitSource: 'H5-众筹',
bizType: 0,
bizCode: this.detail.id
}
shopmallApi.getLiveSig(obj).then(res => {
this.userSig = res.userSig
this.initTim()
})
},
initTim() {
const userInfo = util.getUserInfo()
const imOptions = {
userID: userInfo.openid || userInfo.uuid,
userSig: this.userSig,
groupID: this.liveDetail.imGroupId,
SDKAppID: this.liveDetail.imSdkAppId,
onMessageReceived: this.onMessageReceived,
onNetStateChange: this.onNetStateChange
}
timObj = new IM(imOptions)
timObj.join(imOptions).then(res => {
// console.log('login-------')
timObj.updateMyProfile({ nick: userInfo.nickName })
})
},
// 收到消息触发
onMessageReceived(data) {
// console.log('收到消息:', data)
let msgLen = this.messageList.length
let dataLen = data.length
if (msgLen + dataLen > msgMaxNum) {
this.messageList = this.messageList.slice(msgLen - dataLen)
}
data.forEach(item => {
// 根据消息类型判断,执行不同操作
if (item.type == 'TIMTextElem') {
// 群成员发送消息
// let eleData = JSON.parse()
let eleData = {
userName: item.nick,
content: item.payload.text
}
// 获取群聊消息,消息上屏
this.updateMessageList(eleData)
}
})
},
// 网络异常处理
onNetStateChange(notify) {
Notify(notify)
},
// 更新数据push进消息列表
updateMessageList(data) {
this.messageList = [...this.messageList, data]
this.scrollToBottom()
},
// changeChatHeight(height = '230px') {
// var chatBoxDom = this.$el.querySelector('.chatBox-middle')
// chatBoxDom.style.height = height
// this.scrollToBottom()
// },
// handleFocus() {
// this.changeChatHeight('116px')
// },
//发送聊天
sendTextMessage() {
// this.changeChatHeight()
if (this.messageContent === '' || this.messageContent.trim().length === 0) {
this.messageContent = ''
return
}
// console.log(this.messageContent, '准备发咯--')
timObj.send(this.messageContent)
this.messageContent = ''
},
scrollToBottom() {
this.$nextTick(() => {
let container = this.$el.querySelector('#chatInfo')
container.scrollTop = container.scrollHeight
})
}
}
}
</script>
<style lang="scss" scoped>
html,
body {
background-color: #e8e8e8;
height: 100%;
}
#chat .chatBox {
width: 100%;
height: auto;
margin: auto 0;
border-radius: 0.625rem;
}
#chat .chatBox-middle {
width: 100%;
height: 230px;
margin: 1.25rem auto;
overflow: hidden;
}
#chat .chatBox-infoDesk {
display: flex;
margin: 0 10px 10px;
.chatBox-input {
width: 148px;
// background-color: transparent;
background-color: rgba(255, 255, 255, 0.4) !important;
border-radius: 2rem !important;
margin-right: 8px;
padding: 0 0;
color: #ffffff;
.icon-send {
width: 20px;
height: 20px;
margin-right: 10px;
}
}
.chatBox-input.focus-input {
width: 100%;
transition: width 0.5s;
.icon-send {
border-radius: 50%;
}
}
.action {
width: calc(100% - 156px);
}
}
#chat .chatInfo {
width: 100%;
height: 100%;
overflow-y: scroll;
}
#chat .chatInfo::-webkit-scrollbar {
width: 0 !important;
}
#chat .chatUser-box {
width: 100%;
margin-bottom: 3px;
display: flex;
flex-direction: row;
}
#chat .chatUser-info {
margin: 0 10px;
width: 65%;
line-height: 22px;
font-size: 12px;
}
#chat .chatUser-info-name {
color: rgb(234, 201, 36);
margin-right: 0.4rem;
font-weight: 600;
}
#chat .chatUser-info-text {
margin-top: 3px;
padding: 2px 6px;
font-size: 12px;
background: rgba(0, 0, 0, 0.3);
border-radius: 18px;
color: #ffffff;
float: left;
table-layout: fixed;
word-break: break-all;
overflow: hidden;
.icon-notice {
width: 28px;
height: 16px;
vertical-align: middle;
}
}
#chat .chatUser-info-text.notice {
padding: 2px 3px 2px 6px;
}
</style>
<style>
#chat .chatBox-infoDesk .chatBox-input .van-field__control {
/* background-color: rgba(255, 255, 255, 0.4) !important;
border-radius: 2rem !important; */
color: #ffffff;
height: 40px;
padding: 0 10px;
}
#chat .chatBox-infoDesk .van-cell::after {
border: none;
}
</style>
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2022-10-25 10:15:37
* @LastEditors: limin
* @LastEditTime: 2022-10-27 17:36:43
* @FilePath: \scrm-wx-merchant-activity\src\components\TIM\im.js
*/
// 从v2.11.2起,SDK 支持了 WebSocket,推荐接入;v2.10.2及以下版本,使用 HTTP
import TIM from 'tim-js-sdk'
import TIMUploadPlugin from 'tim-upload-plugin'
const TimOptions = {
// SDKAppID: 1400743527
}
export default class IM {
constructor(options = {}) {
this.loginResolveRejectCache = []
this.options = Object.assign({}, TimOptions, options)
this.isSDKReady = false
this.isLogin = false
this.init()
this.bindTIMEvent()
}
init() {
// 创建 SDK 实例,`TIM.create()`方法对于同一个 `SDKAppID` 只会返回同一份实例
this.tim = TIM.create({ SDKAppID: this.options.SDKAppID }) // SDK 实例通常用 tim 表示
// 设置 SDK 日志输出级别,详细分级请参见 <a href="https://web.sdk.qcloud.com/im/doc/en/SDK.html#setLogLevel">setLogLevel 接口的说明</a>
this.tim.setLogLevel(1) // 普通级别,日志量较多,接入时建议使用
// tim.setLogLevel(1); // release 级别,SDK 输出关键信息,生产环境时建议使用
// 注册腾讯云即时通信 IM 上传插件
this.tim.registerPlugin({ 'tim-upload-plugin': TIMUploadPlugin })
}
/**
* 绑定tim回调事件
*/
bindTIMEvent() {
this.tim.on(TIM.EVENT.SDK_READY, this.handleSDKReady, this)
this.tim.on(TIM.EVENT.MESSAGE_RECEIVED, this.onMessageReceived, this)
this.tim.on(TIM.EVENT.NET_STATE_CHANGE, this.onNetStateChange, this)
}
/**
* 登录
* @param {*} userID 用户唯一id
* @param {*} userSig 生成签名
* @returns
*/
login(userID, userSig) {
return new Promise((resolve, reject) => {
if (!userID) {
reject('userID is not be blank')
return null
}
if (!userSig) {
reject('userSig is not be blank')
return null
}
this.tim
.login({ userID, userSig })
.then(() => {
this.loginResolveRejectCache.push({ resolve, reject })
this.isLogin = true
return null
})
.catch(reject)
})
}
/** 更新用户标配信息
* nick,avatar,gender,selfSignature,allowType
*/
updateMyProfile(obj) {
let promise = this.tim.updateMyProfile(obj)
promise
.then(function (imResponse) {
console.log(imResponse.data) // 更新资料成功
})
.catch(function (imError) {
console.warn('updateMyProfile error:', imError) // 更新资料失败的相关信息
})
}
/**
* 加入群聊
* @returns Promise
*/
joinGroup(groupID, type = TIM.TYPES.GRP_AVCHATROOM) {
return new Promise((resolve, reject) => {
this.options.groupID = groupID
let promise = this.tim.joinGroup({ groupID, type })
promise
.then(function (imResponse) {
switch (imResponse.data.status) {
case TIM.TYPES.JOIN_STATUS_WAIT_APPROVAL: // Waiting to be approved by the admin
console.info('Waiting to be approved by the admin') // Profile of the group
resolve('Waiting to be approved by the admin')
break
case TIM.TYPES.JOIN_STATUS_SUCCESS: // Joined the group successfully
console.info('Joined the group successfully') // Profile of the group
resolve(imResponse.data.group)
break
case TIM.TYPES.JOIN_STATUS_ALREADY_IN_GROUP: // The user is already in the group
console.info('The user is already in the group')
resolve('The user is already in the group')
break
default:
reject(imResponse.data.status)
break
}
})
.catch(function (imError) {
console.warn('joinGroup error:', imError) // Error information
reject('joinGroup error:' + imError)
})
})
}
quitGroup(groupID) {
if (!groupID) {
throw new Error('groupID is not be blank')
}
return this.tim.quitGroup(groupID)
}
/**
* 登录并加入群聊
* @param {*} param0
* @returns
*/
join({ userID, userSig, groupID }) {
if (!userID) {
throw new Error('userID is not be blank')
}
if (!userSig) {
throw new Error('userSig is not be blank')
}
if (!groupID) {
throw new Error('groupID is not be blank')
}
return this.login(userID, userSig).then(() => this.joinGroup(groupID))
}
/**
* 退出群聊,并退出登录
*/
quit() {
return this.quitGroup(this.options.groupID).then(() => this.logout())
}
/**
* 登出
* @returns Promise
*/
logout() {
return new Promise((resolve, reject) => {
this.tim
.logout()
.then(imResponse => {
this.isSDKReady = false
this.isLogin = false
resolve(imResponse)
})
.catch(reject)
})
}
/**
* (内部)登录成功,且SDK Ready
*/
handleSDKReady() {
this.isSDKReady = true
this.loginResolveRejectCache.forEach(({ resolve }) => {
resolve({
msg: '登录成功,且SDK Ready'
})
})
}
/**
* 收到新消息回调
* @param {*} event 回调消息体
*/
onMessageReceived(event) {
this.options.onMessageReceived(event.data)
}
/**
* 网络波动回调
* @param {*} event 回调消息体
*/
onNetStateChange(event) {
// v2.5.0 起支持
// event.data.state 当前网络状态,枚举值及说明如下:
// TIM.TYPES.NET_STATE_CONNECTED - 已接入网络
// TIM.TYPES.NET_STATE_CONNECTING - 连接中。很可能遇到网络抖动,SDK 在重试。接入侧可根据此状态提示“当前网络不稳定”或“连接中”
// TIM.TYPES.NET_STATE_DISCONNECTED - 未接入网络。接入侧可根据此状态提示“当前网络不可用”。SDK 仍会继续重试,若用户网络恢复,SDK 会自动同步消息
let notify = {}
switch (event.data.state) {
case TIM.TYPES.NET_STATE_CONNECTED:
notify = { message: '已接入网络', type: 'success' }
break
case TIM.TYPES.NET_STATE_CONNECTING:
notify = { message: '连接中', type: 'warning' }
break
case TIM.TYPES.NET_STATE_DISCONNECTED:
notify = { message: '当前网络不可用', type: 'danger' }
break
default:
break
}
this.options.onNetStateChange(notify)
}
/**
* 发送一条消息
* @param {*} msg 消息内容
* @returns Promise
*/
send(msg) {
return new Promise((resolve, reject) => {
const message = this.createMessage(msg)
this.sendMessage(message)
.then(event => {
this.onMessageReceived(Object.assign({}, event, { data: [event.data.message] }))
resolve(event)
})
.catch(reject)
})
}
/**
* (内部)组装一条tim TEXT 消息体
* @param {*} msg 消息内容
* @returns 组装好的消息
*/
createMessage(msg) {
let message = this.tim.createTextAtMessage({
to: this.options.groupID,
conversationType: TIM.TYPES.CONV_GROUP,
payload: {
text: msg
}
})
return message
}
/**
* (内部)发送一条消息
* @param {*} message 组装好的tim消息内容
* @returns Promise
*/
sendMessage(message) {
return this.tim.sendMessage(message)
}
}
<template>
<canvas
:id="canvasId"
class="create"
></canvas>
</template>
<script type="text/ecmascript-6">
import Draw from '@/utils/draw'
export default {
name: 'createOrderImg',
props: {
canvasId: {
type: String,
default: 'canvas'
},
orderInfo: {
type: Object,
default: () => { }
},
},
watch: {
orderInfo (n) {
if (n) this.drawOrderImg()
}
},
data () {
return {
ctx: null,
}
},
mounted () {
},
methods: {
drawOrderImg (callBack) {
let {
plateNo,
payPrice,
userName,
goodsName,
orderNumber,
orderStatus,
createdDate,
vehicleBrandName,
vehicleShapeName,
formContentFirst,
vehicleSeriesName,
formDescribeFirst,
formContentSecond,
formDescribeSecond,
vehicleSubBrandName,
} = this.orderInfo
this.ctx = document.getElementById(this.canvasId)
let valueX = 95,
labelX = 17,
fontSize = 14,
valueEndX = 320 - fontSize / 2,
textBaseline = 'top',
canvasWidth = 337,
canvasHeight = 561,
carText = '',
labelList = ['姓名:'],
spacing = 0,
textYList = [],
labelEndX = 80,
lineNum = 2,
lineHeight = 24,
valueList = [userName]
const draw = new Draw(this, {
width: canvasWidth,
height: canvasHeight,
// pixelRatio: 1
})
if (plateNo) {
labelList.push('车牌号:')
valueList.push(plateNo)
}
if (vehicleBrandName) {
carText = `${vehicleBrandName || ''} ${vehicleSubBrandName || ''} ${vehicleSeriesName || ''} ${vehicleShapeName || ''}`
labelList.push('品牌车型:')
valueList.push(carText)
}
labelList = [...labelList, '商品名称:', '支付时间:']
valueList = [...valueList, goodsName, new Date(createdDate).format('yyyy年M月d日 hh:mm:ss')]
if (orderStatus != 10 && orderNumber) {
labelList.push('订单号:')
valueList.push(orderNumber)
}
if (formContentFirst) {
labelList.push(formDescribeFirst)
valueList.push(formContentFirst)
}
if (formContentSecond) {
labelList.push(formDescribeSecond)
valueList.push(formContentSecond)
}
labelList.push('支付定金')
valueList.push(`${payPrice}元`)
labelList.map((e, index) => {
if (e == '商品名称:' && draw.getTextWidth(carText, fontSize) > valueEndX - valueX) spacing = lineHeight
if ((e == formDescribeSecond && draw.getTextWidth(formContentFirst, fontSize) > valueEndX - valueX) || e === formDescribeSecond && (draw.getTextWidth(formDescribeFirst, fontSize) > labelEndX - labelX)) spacing = lineHeight * 2
if (index == labelList.length - 1) textYList.push(493)
else textYList.push(index * 32 + 109 + spacing)
})
const imgName = {
8: '-2',
10: '-3'
}[orderStatus]
draw.drawImages({
url: require(`@/assets/images/order-bg${imgName || ''}.png`),
x: 0,
y: 0,
width: canvasWidth,
height: canvasHeight,
}, () => {
if (orderStatus == 10) {
draw.drawText({
text: '订单号',
x: labelX - 1,
y: 24,
color: '#282829',
fontSize,
textBaseline
})
draw.drawText({
text: orderNumber || '',
x: labelX - 1,
y: 54,
color: '#282829',
fontSize,
textBaseline
})
}
labelList && labelList.length > 0 && (labelList.map((e, index) => {
let y = textYList[index] + fontSize / 2
let label = {
text: e,
x: labelX,
y,
color: '#999',
fontSize,
textBaseline
}
let value = {
text: valueList[index],
x: valueX,
y,
color: '#282829',
fontSize,
textBaseline,
width: valueEndX
}
if (e === '商品名称:') {
value.color = '#FC5B32'
// value.border = '#FEBAA8'
// value.background = '#FFF9F7'
}
if ((formDescribeFirst && e === formDescribeFirst) || (formDescribeSecond && e === formDescribeSecond) || (e === '品牌车型:')) {
value.lineNum = lineNum
value.lineHeight = lineHeight
if ((formDescribeFirst && e === formDescribeFirst) || (formDescribeSecond && e === formDescribeSecond)) {
label.lineNum = lineNum
label.lineHeight = lineHeight
label.width = labelEndX
label.lastFont = ':'
}
}
if (e === '支付定金') {
label.color = '#282829'
value.color = orderStatus == 8 ? '#3162E6' : '#F13C3D'
value.fontWeight = '600'
value.fontSize = 18
value.y = textYList[index] + 5
}
draw.drawText(label)
console.log('---------------', e, value)
draw.drawText(value)
}))
draw.drawLine({
startX: labelX,
startY: 478,
endX: 320,
endY: 478,
width: 1,
color: '#F1F1F1'
})
let url = this.ctx.toDataURL('image/png')
this.$emit('success', url)
if (callBack) callBack(url)
})
}
}
}
</script>
<style scoped lang="scss">
.create {
position: fixed;
top: -1000%;
left: -1000%;
}
</style>
<template>
<div>
<template v-for="(item,index) in list">
<div
:class="['goods',{'false':!defaultType}]"
:key="index"
>
<img
:src="item.goodsImage"
class="icon"
>
<div class="info">
<div class="flex">
<template v-if="defaultType">
<div class="label">
商品名称:
</div>
</template>
<div class="text-hide">
{{item.goodsName}}
</div>
</div>
<template v-if="defaultType">
<div class="flex">
<div class="label">
众筹价:
</div>
<div class="price">
{{item.crowdFundingPrice}}
</div>
</div>
</template>
<div class="flex">
<div class="label">
定金:
</div>
<div class="price">
{{item.activityPrice}}
</div>
</div>
</div>
<div class="stepper flex">
<div
:class="['minus count-box',{'opacity': item.goodsNumber == 0}]"
@click="change(index)"
></div>
{{item.goodsNumber}}
<div
:class="['add count-box', {'opacity':item.goodsNumber == item.goodsStock }]"
@click="change(index,true)"
></div>
</div>
</div>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'goodsList',
props: {
list: Array,
defaultType: {
type: Boolean,
default: true
}
},
data () {
return {
}
},
mounted () {
},
methods: {
change (index, add) {
const { list } = this,
num = add ? 1 : -1
let {
goodsNumber,
goodsStock
} = list[index]
if (goodsNumber == 0 && !add) return
if (goodsNumber == goodsStock && add) return
goodsNumber += num
this.bus.$emit('changeUserSelectGoodsList', {
index,
goodsNumber
})
}
}
}
</script>
<style scoped lang='scss'>
.flex {
display: flex;
align-items: center;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.goods {
padding: 10px;
background: #ffffff;
margin-bottom: 8px;
display: flex;
position: relative;
&:last-of-type {
margin-bottom: 0;
}
.icon {
width: 72px;
height: 72px;
flex-shrink: 0;
}
.info {
margin-left: 10px;
flex: 1;
font-size: 14px;
color: #333333;
line-height: 20px;
width: calc(100% - 82px);
> .flex {
margin-bottom: 4px;
}
.text-hide {
width: calc(100% - 70px);
}
.label {
width: 70px;
flex-shrink: 0;
text-align: right;
}
.price {
font-weight: 600;
color: #f13c3d;
}
}
.stepper {
position: absolute;
top: 50%;
right: 16px;
transform: translateY(-50%);
font-size: 16px;
color: #333333;
.count-box {
width: 14px;
height: 14px;
background-color: #f4f4f4;
margin: 0 10px;
font-size: 13px;
border-radius: 2px;
position: relative;
}
.add {
margin-right: 0;
background-color: #f13c3d;
}
.opacity::after,
.opacity::before {
opacity: 0.25;
}
.minus::after,
.add::after,
.add::before {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
content: '';
background-color: #999999;
border-radius: 8px;
}
.minus::after,
.add::before {
width: 7.5px;
height: 1.5px;
}
.add::after {
width: 1.5px;
height: 7.5px;
}
.add::before,
.add::after {
background-color: #fff;
}
}
}
.goods.false {
align-items: center;
border-bottom: 2rpx solid rgba(195, 195, 195, 0.3);
margin-bottom: 0;
padding: 10px 16px;
.icon {
width: 60px;
height: 60px;
}
.info {
> .flex {
margin-bottom: 6px;
}
.text-hide {
width: 100%;
}
.label {
width: auto;
}
}
}
</style>
\ No newline at end of file
export function Audio(url, callBack) {
// this.IsIOS = false
this.IsIOS = window.$IsIOS
this.audioContext = new (window.AudioContext || window.webkitAudioContext || window.mozAudioContext)()
this.sourceNode = null
this.buffer = null
this.isPlayingBGM = false
this.toggleBGM = function (off) {
if (typeof this.sourceNode == 'object' && !this.IsIOS) {
if (this.isPlayingBGM || off) {
this.sourceNode && this.sourceNode.stop()
this.isPlayingBGM = false
console.log('暂停——————————————', this.sourceNode)
} else this._playSourceNode()
} else {
if (this.audioContext.paused && !off) this.audioContext.play()
else this.audioContext.pause()
}
}
this.stopVideo = function () {
if (typeof this.sourceNode == 'object' && !this.IsIOS) {
if (this.isPlayingBGM) {
this.sourceNode && this.sourceNode.stop()
this.isPlayingBGM = false
console.log('暂停——————————————', this.sourceNode)
}
} else this.audioContext.pause()
}
this._playSourceNode = function () {
const audioContext = this.audioContext
audioContext.resume()
const _sourceNode = audioContext.createBufferSource()
_sourceNode.buffer = this.buffer
_sourceNode.loop = true
_sourceNode.connect(audioContext.destination)
_sourceNode.start(0)
this.sourceNode = _sourceNode
console.log('播放——————————————', this.sourceNode)
this.isPlayingBGM = true
}
let loadAndAutoPlay = audioUrl => {
let _this = this
if (!this.IsIOS) {
const audioContext = this.audioContext
const xhr = new XMLHttpRequest()
xhr.open('GET', `${audioUrl}?v=${Date.now()}`, true)
xhr.responseType = 'arraybuffer'
xhr.onreadystatechange = () => {
if (xhr.status < 400 && xhr.status >= 200 && xhr.readyState === 4) {
audioContext.decodeAudioData(xhr.response, buffer => {
this.buffer = buffer
if (buffer) {
if (wx.getNetworkType)
wx.getNetworkType({
success: function (res) {
_this._playSourceNode()
callBack()
}
})
else {
_this._playSourceNode()
callBack()
}
}
})
}
}
xhr.send()
} else {
this.audioContext = document.getElementById('audio')
this.audioContext.src = url
this.audioContext.click()
wx.getNetworkType({
success: function (res) {
_this.audioContext.play()
callBack()
}
})
}
}
loadAndAutoPlay(url)
loadAndAutoPlay = null
}
<template>
<div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
</style>
\ No newline at end of file
<template>
<div class="car-brands" :key="upData">
<van-index-bar highlight-color="#FC5B32" :index-list="indexList" @change="indexNumber = $event" ref="indexBar">
<template v-for="(item, index) in brandList">
<div :key="index">
<van-index-anchor :index="item.letter" />
<template v-for="(i, ind) in item.list">
<van-cell :key="ind" @click="showCarSeries(i)">
<template #title>
<img :src="i.logoUrl" v-if="i.logoUrl" />
<span>{{ i.name }}</span>
</template>
</van-cell>
</template>
</div>
</template>
</van-index-bar>
</div>
</template>
<script type="text/ecmascript-6">
import { carLifeApi } from '@/api'
export default {
name: 'carBrands',
data () {
return {
brandList: [],
upData: Date.now(),
indexList: [],
indexNumber: 'A',
targetName: ''
}
},
created () {
let data = this.getLocalStorage('wx_scrm_car_brand_list')
if (data) this.formatData(data)
else carLifeApi.getCarBrandList().then(carInfo => {
this.setLocalStorage('wx_scrm_car_brand_list', carInfo)
this.formatData(carInfo)
})
},
activated () {
this.$nextTick(() => {
this.$refs.indexBar.scrollTo(this.indexNumber)
})
},
beforeRouteEnter (to, from, next) {
next(vm => {
if (from.name != 'crowdfunding.carSeries') vm.targetName = from.name
})
},
methods: {
formatData (data) {
let letterList = Array.from(new Set([...data.map(e => e.letter)])),
indexList = []
let brandList = letterList.map(e => {
let list = []
data.map(i => {
if (e === i.letter) {
list.push(i)
}
})
indexList.push(e)
return {
letter: e,
list
}
})
this.setCarData(brandList)
this.indexList = indexList
},
setCarData (brandList) {
this.showLoading('加载中...')
let count = 0
let settime = setInterval(() => {
if (null != brandList[count].list && brandList[count].list.length > 0) {
this.brandList[count] = brandList[count]
}
count++
if (count >= brandList.length) {
this.hideLoading()
this.upData = Date.now()
clearInterval(settime)
}
}, 10)
},
showCarSeries (i) {
let { targetName } = this
let brandInfo = {
vehicleBrandId: i.id,
vehicleBrandName: i.name
}
this.$route.params.targetName = targetName
if (i.childs && i.childs.length) this.$router.replace({
name: 'crowdfunding.carSeries',
params: { brandInfo, list: i.childs }
})
else this.showToast('暂无该品牌车系')
}
}
}
</script>
<style scoped lang="scss">
.car-brands {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
/deep/.van-cell {
height: 56px;
}
/deep/.van-index-anchor {
height: 32px;
background: #f7f8fa;
}
/deep/.van-cell__title {
display: flex;
align-items: center;
img {
width: 34px;
height: 34px;
margin-right: 4px;
}
}
}
</style>
<template>
<div class="layout">
<van-index-bar highlight-color="#FC5B32" class="list" :index-list="indexList" :key="updata">
<template v-for="(item, index) in list">
<div class="item" :key="index">
<van-index-anchor :index="item.name" />
<template v-if="item.done">
<template v-if="item.childs && item.childs.length">
<template v-for="(i, ind) in item.childs">
<div class="card flex" :key="ind" @click="showCarType(i, item)">
{{ i.name }}
</div>
</template>
</template>
<template v-else>
<div class="loading text-center">
<van-icon name="fail" color="#282829" size="80" />
<div>暂无该车型</div>
</div>
</template>
</template>
<template v-else>
<div class="loading text-center">
<van-loading color="#282829" size="80" text-size="18" vertical>加载中...</van-loading>
</div>
</template>
</div>
</template>
</van-index-bar>
<van-popup v-model="showType" position="right" class="popup">
<div class="car-view">
<template v-for="(i, index) in carTypeList">
<div :key="index" class="flex item" @click="choose(i)">{{ i.name }}</div>
</template>
</div>
</van-popup>
</div>
</template>
<script type="text/ecmascript-6">
import { carLifeApi } from '@/api'
export default {
name: 'carSeries',
data () {
return {
list: [],
indexList: [],
showType: false,
carTypeList: [],
brandInfo: null,
updata: Date.now(),
targetName: ''
}
},
activated () {
this.showType = false
this.indexList = []
let { list, brandInfo } = this.getParams()
if (!list || !list.length) {
this.$router.back()
return
}
this.list = list
this.brandInfo = brandInfo
list.map((e, index) => {
this.getCarSeriesList(e, { index, brandId: brandInfo.vehicleBrandId })
this.indexList.push(e.name)
})
},
deactivated () {
this.targetName = ''
},
beforeRouteEnter (to, from, next) {
next(vm => {
let { targetName } = from.params
if (from.name == 'crowdfunding.carBrands') vm.targetName = targetName || from.name
})
},
methods: {
getCarSeriesList (e, { index, brandId }) {
carLifeApi.getCarSeriesList({
brandId,
childBrandId: e.id
}).then(data => {
if (!data) data = []
this.list[index].done = true
this.list[index].childs = data
this.updata = Date.now()
})
},
showCarType (i, item) {
let { brandInfo, carTypeList } = this
if (brandInfo.vehicleSeriesId == i.id && carTypeList.length) {
this.showType = true
return
}
this.brandInfo = {
...brandInfo,
vehicleSubBrandId: item.id,
vehicleSubBrandName: item.name,
vehicleSeriesId: i.id,
vehicleSeriesName: i.name
}
this.carTypeList = []
this.showLoading()
carLifeApi.getCarTypeList(i.id).then(data => {
this.hideLoading()
if (!data || !data.length) this.showToast('暂无该车型')
else this.carTypeList = data || []
this.showType = (data && data.length) ? true : false
})
},
choose (i) {
this.showType = false
let { brandInfo, targetName } = this
let carInfo = {
...brandInfo,
vehicleShapeId: i.id,
vehicleShapeName: i.name
}
let { activityInfo } = this.$store.state.app
activityInfo.carInfo = carInfo
vm.$store.dispatch('setActivityInfo', activityInfo)
if (!targetName) this.$router.back()
else this.$router.replace({ name: targetName })
}
}
}
</script>
<style scoped lang="scss">
.list {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
/deep/.van-index-anchor {
height: 26px;
background: #f7f8fa;
padding: 0 16px;
font-size: 11px;
color: #282829;
}
.loading {
aspect-ratio: 1/1;
color: #282829;
flex-direction: column;
}
.card {
height: 56px;
background-color: #fff;
padding: 0 16px;
font-size: 16px;
font-weight: 500;
color: #282829;
.logo {
width: 88px;
height: 66px;
margin-right: 8px;
}
}
}
.popup {
.car-view {
height: 100vh;
width: 75vw;
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
.item {
padding: 10px 16px;
border-bottom: 1px solid #e9e9e9;
}
}
}
</style>
<template>
<div class="box">
<template v-for="(i, index) in list">
<div class="item" :key="index" :style="`padding-bottom:${index == list.length - 1 ? '16px' : ''};`">
<evaluate-item :item="i" :hideBorder="index == list.length - 1" :num="index + 1" :showAvatarNicknameFlag="detail.showAvatarNicknameFlag" />
</div>
</template>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'evaluate',
data () {
return {
list: [],
detail: {}
}
},
activated () {
let { list, detail } = this.getParams()
if (list && list.length) this.list = list
else if (this.list.length) return
else this.to('crowdfunding')
if (detail) this.detail = detail
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang="scss">
.box {
padding-bottom: 100px;
.item {
background: #ffffff;
padding: 0 16px;
}
}
</style>
<template>
<div class="box">
<template v-for="(i, index) in list">
<div class="item" :key="index" :style="`padding-bottom:${index == list.length - 1 ? '16px' : ''};`">
<FAQ-item :item="i" :hideBorder="index == list.length - 1" />
</div>
</template>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'faq',
data () {
return {
list: []
}
},
activated () {
let { list } = this.getParams()
if (list && list.length) this.list = list
else this.to('crowdfunding')
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang="scss">
.box {
padding-bottom: 100px;
.item {
background: #ffffff;
padding: 0 16px;
}
}
</style>
<template>
<div class="imagePreview">
<template v-if="item">
<van-image-preview v-model="show" :images="item" @change="change" :show-index="false" :start-position="index" ref="preview" asyncClose></van-image-preview>
<template v-if="textStyle">
<div class="text" :style="textStyle">
{{ experience }}
</div>
</template>
</template>
</div>
</template>
<script type="text/ecmascript-6">
import { ImagePreview } from 'vant'
export default {
name: 'imagePreview',
components: {
[ImagePreview.Component.name]: ImagePreview.Component
},
data () {
return {
textStyle: '',
experience: '',
item: [],
show: true,
index: 0
}
},
activated () {
let { item, index, experience } = this.getParams()
if (item && item.length) {
this.item = item
this.experience = experience
this.index = index
document.title = `${index + 1}/${item.length}`
setTimeout(() => {
this.textStyle = `z-index:${Number(this.$refs.preview.$el.style.zIndex + 1)}`
}, 1e3)
} else this.to('crowdfunding')
},
mounted () {
},
methods: {
change (e) {
document.title = `${e + 1}/${this.item.length}`
}
}
}
</script>
<style scoped lang="scss">
.imagePreview {
position: relative;
width: 100vw;
height: 100vh;
.text {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
font-size: 14px;
color: #ffffff;
padding: 16px 16px 50px;
box-sizing: border-box;
z-index: 2;
}
}
</style>
<template>
<div v-if="detail.activityDetail">
<div class="activity-info" v-html="decodeURIComponent(detail.activityDetail)"></div>
<!-- 商品列表 -->
<template v-if="detail.userSelectGoodsList.length > 1">
<div class="goods-box">
<goods-list :list="detail.userSelectGoodsList"></goods-list>
</div>
</template>
<div class="tips text-center">
<img src="https://img02.glsx.com.cn/weapp/resource/scrm-mobile/crowdfunding/logo.png" alt="技术支持:广联数科" />
</div>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'ActivityDetails',
props: {
detail: {
type: Object,
default: () => { }
},
},
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang="scss">
.activity-info {
/deep/img {
object-fit: contain;
height: auto;
}
}
.goods-box {
padding: 8px;
}
.tips {
padding-top: 47px;
font-size: 12px;
img {
width: 143px;
height: 21px;
}
}
</style>
<template>
<div class="count-down">
<div class="bg">
<img src="https://img02.glsx.com.cn/weapp/resource/scrm-mobile/crowdfunding/timer-bg.png" />
</div>
<div :class="['timer-title', { 'timer-not-started': detail.activityStatus == 1 }]">
<img :src="`https://img02.glsx.com.cn/weapp/resource/scrm-mobile/crowdfunding/timer-${detail.activityStatus == 1 ? 1 : 2}.png`" />
</div>
<div :class="['time-box text-center', { 'not-started': detail.activityStatus == 1 }, { finished: finished }]">
<template v-if="timeFlag">
<template v-if="finished">{{ finished }}</template>
<template v-else>
<template v-if="detail.activityStatus == 1">{{ new Date(iosTimeFormat(detail.startTime)).format('M月d') }}日开始,还差</template>
<template v-if="activityTime.day">
<div class="time flex">
<span class="text-center flex">{{ activityTime.day }}</span>
<div class="unit">天</div>
</div>
</template>
<template v-for="(i, index) in activityTime.dayList">
<div class="time flex" :key="index">
<span class="text-center">{{ i.text }}</span>
<div class="unit">{{ i.unit }}</div>
</div>
</template>
</template>
</template>
</div>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'CountDown',
props: {
detail: {
type: Object,
default: () => { }
},
},
data () {
return {
activityTime: {},
timeFlag: false,
finished: ''
}
},
mounted () {
this.init()
},
methods: {
init () {
this.timeFlag = false
let { detail } = this
this.countDown([detail.startTime, detail.endTime])
this.hideLoading()
},
countDown (params) {
let {
activityStatus
} = this.detail
// activityStatus 1:未开始,2进行中,3已结束
const addZero = i => i < 10 ? `0${i}` : `${i}`
let [activityStartTime, activityEndTime] = params
const start = this.iosTimeFormat(activityStartTime)
const end = this.iosTimeFormat(activityEndTime)
if ((new Date().getTime() > new Date(end).getTime()) || activityStatus == 3) {
clearTimeout(this.time)
this.timeFlag = true
this.finished = '活动已结束'
if (activityStatus != 3) this.$emit('refresh', 3)
return
}
if (new Date().getTime() >= new Date(start).getTime() && activityStatus != 2) {
this.$emit('refresh', 2)
return
}
let starTime = new Date()
let endTime = new Date(activityStatus == 2 ? end : start)
let lefttime = parseInt((endTime.getTime() - starTime.getTime()) / 1000)
let d = parseInt(lefttime / (24 * 60 * 60))
let h = parseInt(lefttime / (60 * 60) % 24)
let m = parseInt(lefttime / 60 % 60)
let s = parseInt(lefttime % 60)
h = addZero(h)
m = addZero(m)
s = addZero(s)
let type = {
1: '距开始',
2: '距结束'
}[activityStatus]
if (this.time) clearTimeout(this.time)
this.time = setTimeout(() => {
let dayList = [{
text: h,
unit: '时'
}, {
text: m,
unit: '分'
}, {
text: s,
unit: '秒'
}]
let activityTime = {
dayList,
type
}
if (d > 0) activityTime.day = addZero(d)
this.activityTime = activityTime
this.timeFlag = true
this.countDown(params)
}, 1 * 1000)
}
}
}
</script>
<style scoped lang="scss">
@import '@/assets/css/crowdfunding.scss';
.count-down {
position: relative;
.bg {
position: absolute;
width: calc(100% + 32px);
left: -16px;
top: 0;
z-index: -1;
img {
width: 100%;
height: 200px;
}
}
}
.timer-title {
padding-top: 14px;
height: 19px;
img {
width: 105px;
}
}
.timer-not-started {
img {
width: 128px;
}
}
.time-box {
height: 56px;
border-radius: 4px;
margin: 11.5px 0;
.time {
span {
width: 34px;
height: 32px;
background: #fff;
border-radius: 4px;
font-size: 20px;
color: #fa2c18;
font-weight: 600;
}
.unit {
font-weight: 500;
font-size: 20px;
color: #fff;
margin: 0 5px 0 3px;
}
}
}
.not-started {
font-size: 14px;
font-weight: 600;
color: #fff;
border: 1px dashed #fff;
box-sizing: border-box;
.time {
margin-left: 2px;
span {
width: 26px;
height: 26px;
background: #ae0404;
box-shadow: inset 1px 1px 2px 0px rgba(111, 0, 0, 0.5);
border-radius: 3px;
color: #fff;
font-size: 18px;
}
.unit {
font-size: 14px;
}
}
}
.finished {
font-size: 20px;
font-weight: 600;
color: #fff;
border: 1px dashed #ffffff;
box-sizing: border-box;
}
</style>
<template>
<div class="guide-page" v-if="show">
<img :src="img" @click="tap" />
</div>
</template>
<script type="text/ecmascript-6">
const imgUrl = 'https://img02.glsx.com.cn/weapp/resource/scrm-mobile/crowdfunding/guide-'
export default {
name: 'GuidePage',
data () {
return {
img: '',
index: 0,
show: true
}
},
mounted () {
this.img = `${imgUrl}${this.index}.webp`
let timer = setTimeout(() => {
if (this.show) this.hide()
clearTimeout(timer)
}, 10e3)
},
methods: {
tap () {
let { index } = this
if (index == 2) {
this.hide()
return
}
++this.index
this.img = `${imgUrl}${this.index}.webp?v=${Date.now()}`
},
hide () {
this.$parent.loginLinkFlag = false
this.$parent.getActivityGroup()
this.show = false
this.setLocalStorage('login_link_flag', true)
}
}
}
</script>
<style scoped lang="scss">
.guide-page {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 10086;
background-color: #000;
}
</style>
<template>
<div class="group-list" ref="groupBox">
<div class="mask"></div>
<template v-if="list.length">
<div class="move" ref="move">
<template v-for="(i, index) in list">
<div :class="['item flex', { 'group-item': index == 0 }]" :key="index">
<img :src="i.imageUrl" />
<div class="text">{{ i.name }}刚刚参加了活动</div>
</div>
</template>
</div>
</template>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'MoveGroup',
props: {
groupInfo: {
type: Object,
default: () => { }
},
show: {
type: Boolean,
default: false
}
},
watch: {
'show' (n) {
let { groupInfo } = this
if (n && groupInfo.groupList && groupInfo.groupList.length) this.setList(groupInfo.groupList)
}
},
data () {
return {
list: [],
speed: 0.8
}
},
mounted () {
this.$refs.groupBox.style.display = 'none'
},
methods: {
setList (list) {
this.list = list
this.$refs.groupBox.style.display = 'block'
let timer = setTimeout(() => {
this.animation(list)
clearTimeout(timer)
}, 100)
},
animation (list) {
let boxHeight = this.$refs.groupBox.offsetHeight
let [item] = document.getElementsByClassName('group-item')
let itemHeight = item.offsetHeight / 7 + item.offsetHeight
let groupHeight = `${itemHeight * list.length}`
let { speed } = this
let rule = `@keyframes rowup {
0% {transform: translateY(${boxHeight}px);}
100% {transform: translateY(-${groupHeight}px);}
}`
let sheet = document.styleSheets[0]
sheet.insertRule(rule, 0)
let duration = this.decimal(speed * list.length + (boxHeight / itemHeight * speed), 2)
this.$refs.move.style.animation = `${duration}s rowup linear infinite normal`
}
}
}
</script>
<style scoped lang="scss">
.group-list {
// visibility: hidden;
position: absolute;
left: 8px;
top: 5%;
width: 180px;
height: 80%;
overflow: hidden;
.move {
width: 100%;
}
.item {
position: relative;
display: inline-flex;
padding: 0 6px 0 3px;
box-sizing: border-box;
height: 28px;
background: rgba(0, 0, 0, 0.5);
border-radius: 17px;
margin-bottom: 4px;
font-size: 12px;
font-weight: 500;
color: #ffffff;
img {
width: 22px;
height: 22px;
border-radius: 100%;
overflow: hidden;
margin-right: 3px;
}
}
@keyframes opacity-text {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.first {
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 100%);
.text {
background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #ffffff 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
// animation: opacity-text 5s forwards;
}
.last {
background: linear-gradient(360deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 100%);
.text {
background: linear-gradient(360deg, rgba(255, 255, 255, 0) 0%, #ffffff 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
}
.show {
visibility: visible;
}
</style>
<template>
<div class="page-btn">
<template v-if="detail.customerServiceName || detail.customerServicePhone || detail.customerServiceQrImg || detail.customerServerUrl">
<div class="page-item flex" @click="clickKF" @touchstart="touchstart" @touchend="touchend">
<div class="sprite-icon icon-kf"></div>
客服
</div>
</template>
<template v-if="showOrderBtn">
<div class="page-item flex order-move" @click="to('crowdfunding.orderList')" @touchstart="touchstart" @touchend="touchend">
<div class="sprite-icon icon-order"></div>
订单
</div>
</template>
</div>
</template>
<script type="text/ecmascript-6">
import { shopmallApi } from '@/api'
export default {
name: 'PageBtns',
props: {
detail: {
type: Object,
default: () => { }
},
},
data () {
return {
showOrderBtn: false,
}
},
mounted () {
this.getOrderList()
},
methods: {
clickKF () {
const { customerServerUrl } = this.detail
if (!customerServerUrl) this.$parent.showKf = true
else window.location.href = customerServerUrl
},
getOrderList () {
shopmallApi.getOrderList(this.detail.id).then(data => {
if (data && data.length) this.showOrderBtn = true
})
},
}
}
</script>
<style scoped lang="scss">
@keyframes move-btn {
10%,
90% {
transform: translateX(-1px);
}
20%,
80% {
transform: translateX(2px);
}
30%,
50%,
70% {
transform: translateX(-4px);
}
40%,
60% {
transform: translateX(4px);
}
}
.page-btn {
position: fixed;
right: 10px;
top: 426px;
z-index: 3;
.page-item {
width: 42px;
height: 42px;
background: #ffffff;
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.1);
border: 1px solid #efefef;
color: #2c2c2c;
font-size: 10px;
margin-bottom: 10px;
border-radius: 100%;
flex-direction: column;
justify-content: center;
}
.order-move {
animation: move-btn 1.5s infinite cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
}
</style>
<template>
<div id="staff" class="staff">
<img class="icon-head" :src="shareInfo.shareImageUrl || require('@/assets/images/default-head.png')" />
<div class="name text-hide">{{ shareInfo.shareName || ''}}</div>
邀请您参加本次团购
</div>
</template>
<script>
var dom = ''
var wth = 0
export default {
name: 'Staff',
data() {
return {}
},
props: {
shareInfo: {
type: Object,
default: () => { }
},
scrollY: {
type: Number,
default: 0
}
},
watch: {
scrollY(newVal, val) {
dom.style.left = newVal > 40 ? '-' + wth + 'px' : ''
}
},
mounted() {
dom = document.getElementById('staff')
wth = dom.offsetWidth + 10
},
methods: {}
}
</script>
<style lang="scss" scoped>
.staff {
position: fixed;
left: 0;
bottom: 100px;
z-index: 2;
display: flex;
box-sizing: border-box;
max-width: 80%;
height: 48px;
line-height: 28px;
opacity: 0.9;
background: #ffffff;
box-shadow: 0 4px 12px 0 rgba(159, 166, 209, 0.25);
border-radius: 0 100px 100px 0;
padding: 12px 10px;
font-size: 14px;
color: #1b233d;
transition: left 0.3s;
.icon-head {
width: 24px;
height: 24px;
border-radius: 50%;
}
.name {
max-width: 110px;
margin: 0 4px;
font-size: 16px;
font-weight: 600;
}
}
</style>
const componentsFiles = require.context(`./`, true, /.vue$/)
let components = {}
componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default
components = {
...components,
[component.name]: component
}
})
export default components
<template>
<div class="layout">
<div class="title">左右滑动查看核销凭证</div>
<div
class="content"
@touchend="end"
>
<van-swipe
:class="['img-box', { one: orderList.length == 1 }]"
:key="updata"
indicator-color="#FFFFFF"
:loop="false"
@change="change"
:style="swipeStyle"
:show-indicators="false"
ref="swipe"
duration="200"
>
<template v-for="(i, index) in orderList">
<van-swipe-item :key="index">
<create-order-img
:orderInfo="i"
:canvasId="`order-${index}`"
:ref="`order-${index}`"
/>
<van-image
:src="imgList[index]"
class="img"
>
<template v-slot:loading>
<van-loading
type="spinner"
size="20"
/>
</template>
</van-image>
</van-swipe-item>
</template>
</van-swipe>
<template v-if="orderList.length > 1">
<div class="dots x-center text-center">
<template v-for="(i, index) in orderList">
<div
:class="['dots-item', { active: itemIndex == index }]"
:key="index"
></div>
</template>
</div>
</template>
</div>
<div class="tips text-center">长按保存图片</div>
</div>
</template>
<script type="text/ecmascript-6">
import { shopmallApi } from '@/api'
const swipeStyle = 'padding-left: 9px;'
export default {
name: 'orderList',
data () {
return {
orderList: [],
imgList: [],
updata: Date.now(),
itemIndex: 0,
swipeStyle
}
},
activated () {
let { orderInfo } = this.getParams()
if (orderInfo?.goodsList) {
let orderList = []
orderInfo.goodsList.map(e => {
orderList.push({
...orderInfo.activityJoin,
orderStatus: 1,
orderNumber: e.orderCode,
goodsNumber: e.goodsNumber,
payPrice: this.centsToyuan(e.activityPrice * e.goodsNumber),
goodsName: e.goodsName
})
})
this.orderList = orderList
this.draw()
}
else this.getOrderList()
},
deactivated () {
this.imgList = []
},
methods: {
end () {
let { swipe } = this.$refs
let { track } = swipe.$refs,
{ itemIndex } = this,
{ offsetWidth } = swipe.$children[0].$el
this.$nextTick(() => {
if (itemIndex == 0) this.swipeStyle = swipeStyle
else {
let width = track.style.cssText.split('width:')[1]
let num = offsetWidth * itemIndex - 9
track.style.cssText = `transition-duration: 200; transform: translateX(-${num}px); width:${width}`
this.swipeStyle = ''
}
})
},
change (e) {
this.itemIndex = e
},
getOrderList () {
let { id } = this.getLocalStorage('wx_scrm_link_params')
shopmallApi.getOrderList(id).then(data => {
console.table(data)
data && data.length && data.map(e => {
e.createdDate = new Date(this.iosTimeFormat(e.payDate))
})
this.orderList = data || []
this.draw()
})
},
draw () {
this.$nextTick(() => {
this.orderList.map((e, index) => {
this.$refs[`order-${index}`][0].drawOrderImg(url => {
this.imgList[index] = url
this.updata = Date.now()
})
})
})
}
}
}
</script>
<style scoped lang="scss">
.layout {
user-select: none;
.title {
font-size: 12px;
color: #999999;
padding: 16px 0 8px 20px;
}
.content {
position: relative;
height: 561px;
.dots {
bottom: 15px;
&-item {
width: 5px;
height: 5px;
background: rgba(255, 255, 255, 0.5);
border-radius: 100%;
margin: 0 4px;
}
.active {
background: #ffffff;
}
}
}
.img-box {
width: 100%;
height: 561px;
/deep/.van-swipe-item {
width: 347px !important;
}
.img {
width: 337px;
height: 561px;
object-fit: contain;
margin-left: 10px;
}
}
.one {
box-sizing: border-box;
}
.tips {
width: 219px;
height: 28px;
background: #f6f6f6;
border-radius: 4px;
font-size: 14px;
color: #656566;
margin: 14px auto 0;
}
}
</style>
<template>
<div class="layout flex">
<div class="title flex">
<div class="sprite-icon icon-success"></div>
恭喜您已参团成功!
</div>
<div class="info">到店凭当前图片核销订单并支付尾款</div>
<van-image :src="img" class="img">
<template v-slot:loading>
<van-loading type="spinner" size="20" />
</template>
</van-image>
<div class="tips text-center">长按保存图片</div>
<create-order-img @success="img = $event" :orderInfo="orderInfo" />
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'success',
data () {
return {
img: null,
orderInfo: null
}
},
activated () {
let { orderInfo } = this.getParams()
if (orderInfo) this.setLocalStorage('wx_scrm_pay_info', orderInfo)
else orderInfo = this.getLocalStorage('wx_scrm_pay_info')
let {
activityJoin,
payPrice,
orderGoods: [orderGoods],
orderNumber,
goodsNumber
} = orderInfo
this.orderInfo = {
userName: activityJoin.userName,
plateNo: activityJoin.plateNo,
vehicleBrandName: activityJoin.vehicleBrandName,
vehicleSubBrandName: activityJoin.vehicleSubBrandName,
vehicleSeriesName: activityJoin.vehicleSeriesName,
vehicleShapeName: activityJoin.vehicleShapeName,
goodsName: orderGoods.goodsName,
createdDate: activityJoin.createdDate,
payPrice,
orderStatus: 1,
formContentFirst: activityJoin.formContentFirst,
formContentSecond: activityJoin.formContentSecond,
formDescribeFirst: activityJoin.formDescribeFirst,
formDescribeSecond: activityJoin.formDescribeSecond,
orderNumber,
goodsNumber
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
.layout {
flex-direction: column;
font-size: 14px;
color: #656566;
user-select: none;
.title {
font-size: 18px;
font-weight: 500;
color: #282829;
padding: 30px 0 7px;
.sprite-icon {
margin-right: 4px;
}
}
.info {
margin-bottom: 16px;
text-align: center;
}
.img {
width: 337px;
height: 561px;
object-fit: contain;
}
.tips {
width: 219px;
height: 28px;
background: #f6f6f6;
border-radius: 4px;
font-size: 14px;
color: #656566;
margin: 14px auto 0;
}
}
</style>
<template>
</template>
<script type="text/ecmascript-6">
import { wxConfig, shopmallApi } from '@/api'
import { util } from '@/utils'
export default {
name: 'testPayMerchant',
data() {
return {
testAmount: 1
}
},
created() {
this.init()
},
methods: {
async init() {
const { payMannerId, createBy } = this.getQuery()
const userInfo = util.getUserInfo()
const res = userInfo
let params = {
payMannerId: payMannerId,
totalAmount: this.testAmount,
buyerId: res.openid,
description: '账号测试',
createBy: createBy
}
if (res) {
shopmallApi.creatCollectionsTestOrder(params).then(e => {
if (e) {
const { timeStamp, nonceStr, packages, signType, paySign } = e.payParams
wxConfig.init().then(() => {
wxConfig.chooseWXPay({
timestamp: timeStamp,
nonceStr: nonceStr,
packages: packages,
signType: signType,
paySign: paySign,
}).then(() => this.to('crowdfunding.success', { orderInfo })).catch(err => console.log(err))
})
}
})
}
}
}
}
</script>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!