Commit f739a300 by 前端

Merge branch 'v3.21.0' into 'master'

V3.21.0

See merge request !3
2 parents 23447180 e7bd0180
Showing 65 changed files with 1700 additions and 274 deletions
import { preReleaseAppId } from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 4
let index = 3
/**
*
......@@ -108,7 +108,7 @@ const defaultMerchantId = {
ip: '44211227',
dev: '44211227',
uat: '44211651',
prod: '44208317',
prod: '44209566',
preRelease: '44209566'
}[target[index]]
......
......@@ -64,9 +64,9 @@ module.exports = {
/**免费领取体验卡 */
tolqFreecard(data) {
return api.post({
method: `scrm.api.equity.h5.free.card.receive`,
...data
},
method: `scrm.api.equity.h5.free.card.receive`,
...data
},
true
)
},
......@@ -87,10 +87,10 @@ module.exports = {
/**领取优惠券 */
receiveCoupon(data) {
return api.post({
method: `scrm.api.coupon.share.receive`,
...data,
receiveSource: 4
},
method: `scrm.api.coupon.share.receive`,
...data,
receiveSource: 4
},
true
)
},
......@@ -187,4 +187,13 @@ module.exports = {
...data
})
},
/**
* 领取调查问卷 商城券
*/
reciveQuestionnaireCoupon(data) {
return api.post({
method: `scrm.api.coupon.user.questionnaire.get`,
...data
})
},
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import equityApi from './equity'
import common from './common'
import entmicroApi from './entmicro'
import strategyApi from './strategy'
import questionnaireApi from './questionnaire'
module.exports = {
wechatApi,
......@@ -23,5 +24,6 @@ module.exports = {
equityApi,
common,
entmicroApi,
strategyApi
strategyApi,
questionnaireApi
}
\ No newline at end of file
import api from '../request/http'
const projectName = 'material'
module.exports = {
/** 查询调查问卷详情 */
getQuestionnaireDetail(data = {}) {
return api.post({
method: 'marketing.api.activityQuestionnaireForm.detail',
projectName,
...data
})
},
/**
* 用户-调查问卷提交
*/
submitQuestionnaireForm(data = {}) {
return api.post({
method: 'marketing.api.activityQuestionnaireUserForm.add',
projectName,
...data
})
},
/**
* 调查问卷-领取红包
*/
receiveQuestionnaireRedEnvelope(data = {}) {
return api.post({
method: 'marketing.api.activityRedEnvelope.questionnaire.binding',
projectName,
...data
})
},
}
\ No newline at end of file
......@@ -229,4 +229,11 @@ module.exports = {
true
)
},
// 获取门店列表
getStoreList(data) {
return api.post({
method: `scrm.api.shopmall.weapp.merchant.detail.list`,
...data
},true)
},
};
......@@ -8,7 +8,7 @@
"pages/tab/strategy/index",
"pages/webView/webView",
"pages/Login/Login",
"pages/crowdfunding/blank/blank"
"pages/crowdfunding/blank/blank"
],
"requiredPrivateInfos": [
"getLocation"
......@@ -24,8 +24,7 @@
"selectedColor": "#3772EC",
"backgroundColor": "#FFFFFF",
"borderStyle": "white",
"list": [
{
"list": [{
"pagePath": "pages/tab/index/index",
"text": "首页",
"iconPath": "assets/images/home.png",
......@@ -57,8 +56,7 @@
}
]
},
"subpackages": [
{
"subpackages": [{
"root": "packageIndex",
"pages": [
"pages/carLife/index",
......@@ -100,7 +98,8 @@
"pages/device/list/list",
"pages/device/tachograph/tachograph",
"pages/vehicleInfo/index/index",
"pages/vehicleInfo/carBrandList/carBrandList"
"pages/vehicleInfo/carBrandList/carBrandList",
"pages/questionnaire/questionnaire"
]
},
{
......@@ -170,9 +169,9 @@
"authorize": "/components/Authorize/Authorize",
"popup": "/components/Popup/Popup",
"goods-action": "/components/GoodsAction/GoodsAction",
"stepper": "/components/Stepper/Stepper"
"stepper": "/components/Stepper/Stepper",
"store-select":"/components/Store/index"
},
"style": "v2",
"resolveAlias": {
"~/*": "/*"
},
......@@ -182,6 +181,5 @@
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"plugins": {},
"__usePrivacyCheck__": false
"plugins": {}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@
position: relative;
height: 100%;
}
.textarea-box .textarea {
position: absolute;
top: 0;
......@@ -16,17 +17,22 @@
line-height: 32rpx;
word-break: break-all;
}
._textarea_ {
width: 100%;
height: calc(100% - 40rpx);
height: 100%;
}
.textarea-box.showWordLimit .textarea {
height: calc(100% - 40rpx);
padding-bottom: 32rpx;
box-sizing: border-box;
}
.wordLimit {
position: absolute;
bottom: 0;
right: 0;
color: #999;
}
font-size: 24rpx;
color: #C6C6C6;
background-color: #fff;
}
\ No newline at end of file
import { IMG_URL } from '~/config';
import { env } from '~/api/env/index'
import { MERCHANT_STATIC_LIST } from '~/utils/constants'
Component({
properties: {
show: {
type: Boolean,
observer(n) {
if (n) this.getMerchantList()
}
}
},
data: {
storeList: []
},
methods: {
closeModal() {
this.setData({
show: false
})
},
// 检查是否是首次
checkFirst() {
const FIRST = wx.p.storage.get('first_enter_miniprograme')
if (FIRST) {
this.setData({
show: false
})
return true
}
},
// 获取门店信息
async getMerchantList() {
const have_enter = this.checkFirst()
if (have_enter) return
// 获取mock配置门店
const MOCKDATA = wx.p.storage.get("mock_data");
let MerchantList = MERCHANT_STATIC_LIST[env]
if (MOCKDATA && MOCKDATA.add_wuye_merchant) {
const ADD_MERCHANT_LIST = MOCKDATA.add_wuye_merchant[env]
if (ADD_MERCHANT_LIST && ADD_MERCHANT_LIST.length) {
MerchantList = [...MerchantList, ...ADD_MERCHANT_LIST]
}
}
let storeList = [], index = 0
try {
storeList = await this.getMerchantListData(MerchantList)
if(!storeList) throw false
storeList.forEach((ele, i) => {
ele.merchantId = ele.merchantNo
if (this.defaultMerchant == ele.merchantId) {
index = i
}
})
this.setData({
storeList,
show: true
})
} catch (error) {
this.setData({
storeList:[],
show: false
})
}
},
// 选择门店
toSelect(e) {
const { item } = e.currentTarget.dataset
wx.p.storage.set('merchant_info', {
merchantId: item.merchantNo,
})
wx.$merchant_id = item.merchantNo
wx.p.storage.set('first_enter_merchantId', item.merchantNo)
wx.p.storage.set('first_enter_miniprograme', true)
this.triggerEvent('freshMerchant')
wx.p.eventbus.emit('STORE')
this.setData({
show: false
})
},
// 获取门店列表
async getMerchantListData(merchantIdList) {
const res = await wx.p.api.shopmallApi.getStoreList({ merchantIdList })
if (res.code == 0) return res.data
else return false
},
},
lifetimes: {
attached() {
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.modal {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: rgba($color: #000000, $alpha: 0.6);
z-index: 9999;
}
.pannel {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 638rpx;
background: #FFFFFF;
border-radius: 8rpx;
padding-bottom: 30rpx;
.color-bg {
padding: 30rpx;
border-radius: 8rpx;
background-image: linear-gradient(180deg, #E3E8FC 0%, #FFFFFF 100%);
font-weight: 400;
font-size: 32rpx;
color: #333333;
display: flex;
align-items: center;
justify-content: center;
position: relative;
.close {
width: 32rpx;
height: 32rpx;
position: absolute;
right: 15rpx;
top: 50%;
transform: translateY(-50%);
}
}
.list_wrap {
.store_item {
padding: 20rpx 30rpx;
display: flex;
.cover {
width: 104rpx;
height: 104rpx;
transform: translateY(4rpx);
}
.info-wrap {
padding-left: 20rpx;
.title {
font-weight: 600;
font-size: 30rpx;
color: #333333;
margin-bottom: 8rpx;
}
.cell {
display: flex;
align-items: center;
margin-bottom: 4rpx;
.icon {
width: 28rpx;
height: 28rpx;
margin-right: 12rpx;
}
.text {
font-weight: 400;
font-size: 24rpx;
color: #666666;
line-height: 36rpx;
width: 400rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
}
}
}
\ No newline at end of file
<view wx:if="{{show}}" class="modal">
<view wx:if="{{storeList.length}}" class="pannel">
<view class="color-bg">
选择您所在的小区
<!-- <glsx-image class="close" bind:tap="closeModal" webp src="login/close.png"></glsx-image> -->
</view>
<view class="list_wrap">
<block wx:for="{{storeList}}" wx:key="index">
<view bind:tap="toSelect" data-item="{{item}}" class="store_item">
<glsx-image class="cover" webp src="login/banner{{index?'1':'2'}}.png"></glsx-image>
<view class="info-wrap">
<view class="title">{{item.merchantName}}</view>
<view class="cell">
<glsx-image class="icon" webp src="login/phone.png"></glsx-image>
<view class="text">{{item.merchantLegalPersonPhone || '--'}}</view>
</view>
<view class="cell">
<glsx-image class="icon" webp src="login/address.png"></glsx-image>
<view class="text">{{item.merchantAddress || '--'}}</view>
</view>
</view>
</view>
</block>
</view>
</view>
</view>
\ No newline at end of file
......@@ -4,6 +4,11 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@vant/weapp": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.11.1.tgz",
"integrity": "sha512-2QddSq3MsozbTBAgEmW1rhzsEJNWPF2VS427M5pOOn0a7/f6lW+tymwdTcOQCzQONavhFwBv6Lebbs/UjE3Yig=="
},
"glsx-applet-component": {
"version": "1.1.24",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.24.tgz",
......
......@@ -3,6 +3,7 @@
"version": "1.0.0",
"main": "app.js",
"dependencies": {
"@vant/weapp": "^1.11.1",
"glsx-applet-component": "^1.1.24",
"glsx-map-sdk": "^0.2.0",
"number-precision": "^1.6.0"
......
......@@ -36,6 +36,7 @@ Page({
buyType,
discoverGoodsSource
} = obj
console.log(obj);
let ids = [], expressFee = 0, goodsNumber = 0
if (obj.deliveryType == 1) {
this.getLocation()
......@@ -365,7 +366,7 @@ Page({
} else {
if (!contactInfo.contactName) {
contactInfo.contactAddress = ' '
contactInfo.contactName = this.data.userInfo.nickName
contactInfo.contactName = this.data.userInfo.nickName || ' '
contactInfo.contactPhone = this.data.userInfo.phone
// wx.p.wxApi.showToast('请选择收货地址')
// return
......@@ -395,13 +396,13 @@ Page({
orderSource,
orderCouponDTO,
contactAddress:contactInfo.contactAddress || ' ',
contactName: contactInfo.contactName,
contactName: contactInfo.contactName || ' ',
contactPhone: contactInfo.contactPhone,
userName: contactInfo.contactName,
userName: contactInfo.contactName || ' ',
userPhone: contactInfo.contactPhone
}
if(deliveryType==0){
query.userName = this.data.userInfo.nickName
query.userName = this.data.userInfo.nickName || this.data.userInfo.phone
query.userPhone = this.data.userInfo.phone
}
wx.p.api.shopmallApi
......
......@@ -70,11 +70,14 @@ Page({
customer_phone: phone
}
if (nickName) {
item.customer_name = nickName
item.customer_qw_nickname = nickName
}
if (headImgUrl) {
item.avatar = headImgUrl
}
if (data.unionId) {
item.union_id = data.unionId
}
let json = JSON.stringify(item)
// 数据上报
wx.p.api.common.trackHttp({ json }).then(response => { })
......@@ -133,6 +136,10 @@ Page({
if (code == 0) {
// 获取会员卡信息
wx.p.api.equityApi.checkOpenMember({ isTrialCardFlag: 1 }).then(res => {
if (res.code == -1 && res.errId == 2008) {
this.showTips(message || '服务不可用')
return
}
if (res.code == 0 && res.data) {
this.receiveRed(res.data.equityFreeCardId)
}
......@@ -148,11 +155,12 @@ Page({
})
},
receiveRed(equityFreeCardId) {
let { isOpenMember, nickName } = this.data
let { isOpenMember, nickName, bindingSource } = this.data
let params = {
equityFreeCardId,
nickName: nickName
}
if (bindingSource) params.bindingSource = bindingSource
wx.p.api.equityApi.checkReceiveRed(params).then(res => {
console.log(res, 'checkReceiveRed---')
let { code, message, data } = res
......@@ -180,6 +188,10 @@ Page({
const authStatus = await wx.p.router.intercept(false)
if (authStatus) return
wx.p.api.equityApi.checkOpenMember({ isTrialCardFlag: 1 }).then(res => {
if (res.code == -1 && res.errId == 2008) {
this.showTips(res.message || '服务不可用')
return
}
let flag = false
if (res.code == 0 && res.data) {
flag = true
......@@ -212,11 +224,15 @@ Page({
},
async onLoad(options) {
let system = wx.getSystemInfoSync()
//从调查问卷来
let system = wx.getSystemInfoSync(),
bindingSource = ''
const authStatus = await wx.p.router.intercept(false)
const { merchantId } = wx.p.storage.get('merchant_info')
if (options.bindingSource) bindingSource = options.bindingSource
this.setData({
merchantId
merchantId,
bindingSource
})
wx.p.wxApi.showLoading()
const {
......
......@@ -7,7 +7,7 @@
width: 100%;
height: 664rpx;
position: relative;
background-size: 100% 100%;
.title {
position: absolute;
left: 50%;
......@@ -86,7 +86,12 @@
transform: translateX(-50%);
}
}
.lq_g_bg{
background: url(https://img02.glsx.com.cn/weapp/resource/miniprogram/wuye/equity/coupons/lq_g_bg.png);
}
.lq_w_bag{
background: url(https://img02.glsx.com.cn/weapp/resource/miniprogram/wuye/equity/coupons/lq_w_bag.png);
}
.footer_rule_box {
width: 100%;
display: flex;
......
<view style="background: url({{IMGURL}}equity/coupons/lq_bg_max.png);background-size: 100% 100%;" class="container">
<view style="background: url({{IMGURL}}equity/coupons/{{handleStatus==1?'lq_g_bg':'lq_w_bag'}}.png);background-size: 100% 100%;" class="main_box">
<view wx:if="{{detailInfo.denomination}}" class="title">
<text class="price">{{detailInfo.denomination || ''}}</text>
<text class="unit">元</text>
<text class="tip">无门槛</text>
</view>
<view class="info_box">
<view class="cover_box">
<image class="cover" src="{{detailInfo.goodsImage}}" />
</view>
<view class="right">
<view class="name">{{detailInfo.brandName}}</view>
<view class="desc">{{detailInfo.goodsName}}</view>
</view>
</view>
<view class="btn" bind:tap="toGet"></view>
<view class="main_box {{handleStatus==1?'lq_g_bg':'lq_w_bag'}}">
<view wx:if="{{detailInfo.denomination}}" class="title">
<text class="price">{{detailInfo.denomination || ''}}</text>
<text class="unit">元</text>
<text class="tip">无门槛</text>
</view>
<view class="footer_rule_box">
<view class="title">规则</view>
<view class="box">
<view class="line">1. 同一用户每张优惠券仅能领取1次,每次1张</view>
<view class="line">2. 优惠券数量有限,领完即止</view>
</view>
<view class="info_box">
<view class="cover_box">
<image class="cover" src="{{detailInfo.goodsImage}}" />
</view>
<view class="right">
<view class="name">{{detailInfo.brandName}}</view>
<view class="desc">{{detailInfo.goodsName}}</view>
</view>
</view>
<view class="btn" bind:tap="toGet"></view>
</view>
<view class="footer_rule_box">
<view class="title">规则</view>
<view class="box">
<view class="line">1. 同一用户每张优惠券仅能领取1次,每次1张</view>
<view class="line">2. 优惠券数量有限,领完即止</view>
</view>
</view>
</view>
\ No newline at end of file
......@@ -14,7 +14,6 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.p.routerApi.decodeUrlLink(options)
if (!options.id) {
return
}
......@@ -48,8 +47,8 @@ Page({
showAuthBtn: res.data.phone ? false : true
})
if (res.data.isLogin) {
wx.p.util.setUserInfo(res.data)
wx.p.util.setSessionId(res.data.sessionId)
wx.p.cache.userInfo.setUserInfo(res.data)
wx.p.cache.storageApi.setSessionId(res.data.sessionId)
this.handlerCustomerId()
}
}
......@@ -68,8 +67,8 @@ Page({
wx.hideLoading()
if (code == '0') {
wx.p.authStatus = false
wx.p.util.setUserInfo(data)
wx.p.util.setSessionId(data.sessionId)
wx.p.cache.userInfo.setUserInfo(data)
wx.p.cache.storageApi.setSessionId(data.sessionId)
this.toCreatePackageNum()
this.handlerCustomerId()
} else wx.p.wxApi.showToast(message)
......@@ -152,8 +151,8 @@ Page({
},
// 客户id
handlerCustomerId() {
let customerId = wx.p.storage.get('srcm_shopmall_customer_id')
if (customerId) USERAPI.updataCustomerPhone()
// let customerId = wx.p.storage.get('srcm_shopmall_customer_id')
// if (customerId) USERAPI.updataCustomerPhone()
},
// 价格格式化
// priceFormat(num, point = 2) {
......@@ -173,6 +172,6 @@ Page({
// }
// },
onUnload: function () {
wx.$util.customerbehavior(2)
// wx.$util.customerbehavior(2)
}
})
......@@ -115,13 +115,14 @@
.button-item {
width: 100%;
height: 88rpx;
background: #fc5b32;
border-radius: 8rpx;
background: #3772EC;
border-radius: 48rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
color: #ffffff;
border-radius:48rpx;
}
.dis{
background: #CCCCCC;
......
import QR from '~/lib/wxqrcode'
import { IMG_URL } from '~/config';
import {
IMG_URL
} from '~/config';
Page({
/**
* 页面的初始数据
......@@ -19,7 +20,7 @@ Page({
useMemberType: 0,
list: [],
pageNum: 1,
IMGURL:IMG_URL
IMGURL: IMG_URL
},
navbarReady(e) {
this.setData({
......@@ -130,7 +131,6 @@ Page({
useMemberType,
detailInfo
}) => {
console.log(userCouponId)
wx.p.wxApi.showLoading('加载中...')
this.setData({
detailInfo
......@@ -154,6 +154,12 @@ Page({
if (options && options.couponId) {
console.log(options)
wx.p.wxApi.showLoading('加载中...')
if (options.bindingSource) {
this.setData({
bindingSource: options.bindingSource
})
return this.getCouponInfo(options.couponId)
}
this.checkCoupon(options)
if (options.activity_id) {
this.data.activiOptions = options
......@@ -166,6 +172,14 @@ Page({
if (isReceive) this.confirm()
}
},
/**调查问卷查询券详情 */
async getCouponInfo(couponId) {
const res = await wx.p.api.couponsApi.getCouponInfo({
couponId
})
wx.hideLoading()
this.setCouponData(res)
},
checkCoupon(options, callBack) {
wx.p.api.couponsApi.checkCoupon(options).then(couponInfo => {
console.log(couponInfo)
......@@ -229,8 +243,30 @@ Page({
issueDate,
userCouponId,
merchantId,
shareSource
shareSource,
bindingSource
} = this.data
// 调查问卷
if (bindingSource) {
const {
couponDetail
} = this.data
wx.p.api.couponsApi.reciveQuestionnaireCoupon({
merchantId: couponDetail.merchantId,
couponId: couponDetail.id
}).then(res => {
if (res.discountType == 3) {
this.jump()
return
}
this.setData({
qr: QR.createQrCodeImg(`t=2&c=${res.verificationCode}`),
verificationCode: res.verificationCode
})
wx.p.wxApi.showToast('领取成功')
})
return
}
if (!couponId && !userCouponId) return
wx.p.router.intercept().then(response => {
if (response) {
......
......@@ -472,11 +472,11 @@ Page({
}
// 配置升级
if (options && options.isUpgrade) {
this.isUpgrade = options.isUpgrade
this.isUpgrade = JSON.parse(options.isUpgrade)
}
// 车主优选
if (options && options.isCarOwner) {
this.isCarOwner = options.isCarOwner
this.isCarOwner = JSON.parse(options.isCarOwner)
}
this.appHide()
},
......
......@@ -218,7 +218,7 @@ Page({
}
let list = []
wx.p.api.mineApi.getOrderList(obj).then((data) => {
wx.hideLoading()
// wx.hideLoading()
data?.list?.map((e) => {
let {
orderGoods,
......
// packageMine/pages/questionnaire/components/Cascader/Cascader.js
Component({
/**
* 组件的属性列表
*/
properties: {
title: String,
data: Array,
num: Number
},
/**
* 组件的初始数据
*/
data: {
show: false,
fieldValue: '',
cascaderValue: ''
},
/**
* 组件的方法列表
*/
methods: {
onClick() {
this.setData({
show: true,
})
},
onClose() {
this.setData({
show: false
})
},
onFinish(e) {
const {
selectedOptions,
value
} = e.detail, {
num
} = this.data,
fieldValue = selectedOptions.map((option) => option.text || option.name).join('/')
this.setData({
fieldValue,
cascaderValue: value
})
this.triggerEvent('change', {
num,
value: fieldValue
})
this.onClose()
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {
"van-cascader": "@vant/weapp/cascader/index",
"van-popup":"@vant/weapp/popup/index"
}
}
\ No newline at end of file
/* packageMine/pages/questionnaire/components/Cascader/Cascader.wxss */
@import '../Select/Select.scss';
<view class="select {{!fieldValue?'default':''}} {{show?'focus':''}}" bindtap="onClick">
<view class="value">
{{fieldValue||'请选择'}}
</view>
</view>
<van-popup show="{{ show }}" round position="bottom" bind:click-overlay="onClose">
<van-cascader title="{{title}}" value="{{ cascaderValue }}" active-color="#3772EC" options="{{ data }}" bindclose="onClose" bindfinish="onFinish" >
</van-cascader>
</van-popup>
\ No newline at end of file
// packageMine/pages/questionnaire/components/Checkbox/Checkbox.js
Component({
/**
* 组件的属性列表
*/
properties: {
data: Array,
num: Number
},
/**
* 组件的初始数据
*/
data: {
chooseList: [],
valueList: []
},
/**
* 组件的方法列表
*/
methods: {
choose(e) {
const {
index,
value
} = e.currentTarget.dataset, {
chooseList,
valueList,
num
} = this.data,
item = chooseList.findIndex(i => i == index)
if (item == -1) {
chooseList.push(index)
valueList.push(value)
} else {
chooseList.splice(item, 1)
valueList.splice(item, 1)
}
this.setData({
chooseList,
valueList
})
this.triggerEvent('change', {
num,
value: valueList.join(';') || null
})
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* packageMine/pages/questionnaire/components/Checkbox/Checkbox.wxss */
.checkbox-item {
margin-bottom: 20rpx;
font-size: 28rpx;
color: #333333;
line-height: 40rpx;
display: flex;
align-items: center;
word-wrap: break-word;
.icon {
width: 24rpx;
height: 24rpx;
border: 2rpx solid #999999;
border-radius: 4rpx;
flex-shrink: 0;
margin-right: 10rpx;
transition: all .25s;
}
.active {
border-color: var(--themeColor);
position: relative;
&::after {
width: 28rpx;
height: 28rpx;
content: '';
position: absolute;
top: 50%;
left: 50%;
animation: radio-active .25s forwards;
background: url(https://img02.glsx.com.cn/weapp/resource/miniprogram/wuye/questionnaire/checkbox.png) no-repeat;
background-size: 100%;
}
}
@keyframes radio-active {
0%{
opacity: 0;
transform: translate(-50%,-50%) scale(.1);
}
100%{
opacity: 1;
transform: translate(-50%,-50%) scale(1);
}
}
}
\ No newline at end of file
<wxs module="fn">
module.exports = {
includes: function (arr, val) {
return arr.indexOf(val) != -1
}
}
</wxs>
<block wx:for="{{data}}" wx:key="index">
<view class="checkbox-item" bindtap="choose" data-index="{{index}}" data-value="{{item}}">
<view class="icon {{fn.includes(chooseList,index)?'active':''}}"></view>
{{item}}
</view>
</block>
// packageMine/pages/questionnaire/components/Finish/Finish.js
Component({
/**
* 组件的属性列表
*/
properties: {
data: Object
},
/**
* 组件的初始数据
*/
data: {
count: 5
},
lifetimes: {
async attached() {
const {
data
} = this.data
if (data.activityType) {
let url = '/packageEquity/pages/freecard/freecard',
options = {
bindingSource: 1,
notIntercept: true
}
if (data.activityType == 3) {
const {
userInfo
} = wx.p.router.getPageInstance().data
const res = await wx.p.api.questionnaireApi.receiveQuestionnaireRedEnvelope({
questionnaireId: data.id,
activityRedEnvelopeId: data.activityId,
nickName: userInfo.nickName
})
if (res.isActivityRedEnvelopeFlag && !res.isReceiveFlag) this.setData({
jumpOption: {
url: res.activityRedEnvelopeLink,
type: data.activityType
}
})
this.countDown()
} else {
if (data.activityType == 2) {
options.couponId = data.activityId
url = '/packageMall/pages/coupon/coupon'
}
this.setData({
jumpOption: {
url,
type: data.activityType,
options
}
})
this.countDown()
}
} else this.countDown()
}
},
timer: null,
/**
* 组件的方法列表
*/
methods: {
async back() {
clearTimeout(this.timer)
this.timer = null
const {
jumpOption
} = this.data
if (jumpOption) {
if (jumpOption.type == 3) wx.p.router.switchTab('/pages/tab/index/index', {
jumpH5Url: jumpOption.url
})
else wx.p.router.redirectTo(jumpOption.url, jumpOption.options)
} else wx.p.router.goHome()
},
countDown() {
this.timer = setTimeout(() => {
let {
count
} = this.data
if (this.timer && count == 0) {
clearTimeout(this.timer)
this.back()
return
}
--count
this.setData({
count
})
this.countDown()
}, 1e3)
}
},
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* packageMine/pages/questionnaire/components/Finish/Finish.wxss */
@keyframes show-finish{
0%{
left: 100vw;
}
100%{
left: 0;
}
}
.finish-box {
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
background-color: #fff;
display: flex;
flex-direction: column;
align-items: center;
font-weight: 500;
font-size: 40rpx;
color: #333333;
animation: show-finish .25s forwards;
.icon {
width: 160rpx;
height: 160rpx;
margin: 160rpx 0 30rpx;
}
.btn {
margin: 40% 0 30rpx;
width: 494rpx;
height: 88rpx;
background: #3772EC;
border-radius: 44rpx;
color: #fff;
font-weight: 500;
font-size: 32rpx;
letter-spacing: 2rpx;
display: flex;
align-items: center;
justify-content: center;
}
.tips {
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
}
// 提示
.member-dialog {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 998;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.bg {
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
background: rgba(0, 0, 0, .5);
}
.content {
position: relative;
text-align: center;
box-sizing: border-box;
.member-bg {
width: 550rpx;
height: 910rpx;
}
.count-down {
position: absolute;
top: 26rpx;
right: 26rpx;
width: 72rpx;
height: 72rpx;
line-height: 72rpx;
background: #EA4D3A;
border-radius: 36rpx;
font-weight: 600;
font-size: 42rpx;
color: #FFFFFF;
}
.open-btn {
position: absolute;
bottom: 50rpx;
left: 28%;
width: 158rpx;
height: 158rpx;
}
}
}
\ No newline at end of file
<view class="finish-box">
<view class="icon">
<glsx-image src="questionnaire/finish.png" />
</view>
提交成功
<view class="btn" bindtap="back">返回</view>
<view class="tips">{{count}}S后自动跳转</view>
</view>
<!-- 红包会员弹窗 -->
<block wx:if="{{data.activityType == 3 && jumpOption}}">
<view class="member-dialog">
<view class="bg" />
<view class="content">
<view class="count-down">{{count}}</view>
<glsx-image class="member-bg" src="equity/bg-red.png"></glsx-image>
<glsx-image bindtap="back" class="open-btn" src="equity/icon-open.png"></glsx-image>
</view>
</view>
</block>
\ No newline at end of file
// packageMine/pages/questionnaire/components/Radio/Radio.js
Component({
/**
* 组件的属性列表
*/
properties: {
data: Array,
num: Number
},
/**
* 组件的初始数据
*/
data: {
raidoIndex: -1
},
/**
* 组件的方法列表
*/
methods: {
choose(e) {
const {
index,
value
} = e.currentTarget.dataset, {
raidoIndex,
num
} = this.data
if (raidoIndex == index) return
this.setData({
raidoIndex: index
})
this.triggerEvent('change', {
num,
value
})
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* packageMine/pages/questionnaire/components/Radio/Radio.wxss */
.radio-item {
margin-bottom: 20rpx;
font-size: 28rpx;
color: #333333;
line-height: 40rpx;
display: flex;
align-items: center;
word-wrap: break-word;
.icon {
width: 24rpx;
height: 24rpx;
border: 2rpx solid #999999;
border-radius: 100%;
flex-shrink: 0;
margin-right: 10rpx;
transition: all .25s;
}
.active {
position: relative;
border-color: var(--themeColor);
&::after {
width: 18rpx;
height: 18rpx;
border-radius: 100%;
background-color: var(--themeColor);
content: '';
position: absolute;
top: 50%;
left: 50%;
animation: radio-active .25s forwards;
}
}
@keyframes radio-active {
0% {
opacity: 0;
transform: translate(-50%, -50%) scale(.1);
}
100% {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
}
}
}
\ No newline at end of file
<block wx:for="{{data}}" wx:key="index">
<view class="radio-item" bindtap="choose" data-index="{{index}}" data-value="{{item}}">
<view class="icon {{index == raidoIndex?'active':''}}"></view>
{{item}}
</view>
</block>
\ No newline at end of file
// packageMine/pages/questionnaire/components/Select/Select.js
Component({
/**
* 组件的属性列表
*/
properties: {
data: Array,
title: String,
num: Number
},
/**
* 组件的初始数据
*/
data: {
value: '',
show: false
},
/**
* 组件的方法列表
*/
methods: {
onClick() {
this.setData({
show: true,
})
},
onClose() {
this.setData({
show: false
})
},
onConfirm(e) {
const {
value
} = e.detail, {
num
} = this.data
this.setData({
value
})
this.triggerEvent('change', {
num,
value
})
this.onClose()
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {
"van-popup":"@vant/weapp/popup/index",
"van-picker": "@vant/weapp/picker/index"
}
}
\ No newline at end of file
/* packageMine/pages/questionnaire/components/Select/Select.wxss */
.select {
width: 100%;
height: 72rpx;
background: #FFFFFF;
border: 2rpx solid #D9D9D9;
border-radius: 8rpx;
box-sizing: border-box;
padding: 16rpx 20rpx;
font-size: 28rpx;
position: relative;
overflow: hidden;
color: #333;
&::after {
position: absolute;
content: '';
border: 2rpx solid #999;
border-top: none;
border-left: none;
right: 20rpx;
top: 50%;
transform: translateY(-50%) rotate(45deg);
box-sizing: border-box;
width: 16.14rpx;
height: 16.14rpx;
transition: all .25s;
}
.value {
width: calc(100% - 44rpx);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.focus {
&::after {
transform: translateY(-20%) rotate(225deg);
}
}
.default {
color: #999999;
}
.active {
color: var(--themeColor);
}
\ No newline at end of file
<view class="select {{!value?'default':''}} {{show?'focus':''}}" bindtap="onClick">
<view class="value">
{{value||'请选择'}}
</view>
</view>
<van-popup show="{{ show }}" round position="bottom" bind:click-overlay="onClose">
<van-picker show-toolbar title="{{title}}" columns="{{ data }}" bind:cancel="onClose" bind:confirm="onConfirm" active-class="active" />
</van-popup>
\ No newline at end of file
// packageMine/pages/questionnaire/questionnaire.js
Page({
/**
* 页面的初始数据
*/
data: {
finish: false
},
answerList: {},
blur(e) {
const {
value
} = e.detail, {
num
} = e.currentTarget.dataset
this.change({
detail: {
num,
value
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
async getQuestionnaireDetail(options) {
const res = await wx.p.router.intercept()
if (!res) {
const {
userInfo
} = this.data
if (!userInfo.nickName) return this.getNickNameAndHeadUrl()
try {
const data = await wx.p.api.questionnaireApi.getQuestionnaireDetail(options)
if (data.status == -1) {
return wx.showModal({
title: '温馨提示',
content: '问卷活动已结束。',
showCancel: false,
confirmText: '返回首页',
confirmColor: '#3772EC',
complete: (res) => {
if (res.confirm) wx.p.router.goHome()
}
})
}
if (data) {
data.questions.map(e => {
if (e.type != 3) {
let option = e.option.split('\n')
if (e.type == 5) {
const [, two, three] = option[0].split('/')
option.splice(0, 1)
e.data = this.transformData(option, three ? 3 : two ? 2 : 1)
} else e.data = option
}
e.answer = ''
e.userFormId = e.formId
})
this.setData({
questionnaireObj: data
})
wx.setNavigationBarTitle({
title: data.title,
})
this.shareTitle = data.cardTitle || data.title
this.shareQuery = `id=${data.id}`
this.shareImage = data.cardCover || ''
this.addTrackInfo()
} else throw '获取问卷失败'
} catch (error) {
console.log(error)
if (error) wx.p.wxApi.showToast(error)
}
}
},
transformData(data, childrenDepth) {
const result = []
data.forEach(item => {
const levels = item.split('/')
let currentLevel = result
for (let i = 0; i < childrenDepth; i++) {
const text = levels[i],
value = text,
existingOption = currentLevel && currentLevel.find((option) => option.text === text)
if (existingOption) {
if (i === childrenDepth - 1) {
continue
}
if (existingOption.children) currentLevel = existingOption.children
} else {
if (text && value) {
const newOption = {
text,
value,
}
if (levels[i + 1]) newOption.children = []
currentLevel.push(newOption)
if (i === childrenDepth - 1) delete newOption.children
currentLevel = newOption.children
}
}
}
})
return result
},
change(e) {
const {
num,
value
} = e.detail
this.answerList[num] = value
},
async submit() {
const {
questionnaireObj
} = this.data, {
merchantId,
} = wx.p.storage.get('userInfo'), {
answerList
} = this
try {
let questions = []
questionnaireObj.questions.map(e => {
if (e.required && answerList[e.num] == null) throw `请填写第${e.num}题!`
questions.push({
userFormId: e.userFormId,
num: e.num,
answer: answerList[e.num] || ''
})
})
let params = {
questions,
merchantId,
formId: questionnaireObj.id,
}
console.log(params)
const res = await wx.p.api.questionnaireApi.submitQuestionnaireForm(params)
if (res) {
this.setData({
finish: true
})
} else throw '提交失败'
console.log(res)
} catch (error) {
console.log(error)
if (error) wx.p.wxApi.showToast(error)
}
},
getNickNameAndHeadUrl() {
const redirectUrl = `https://scrm.glsx.com.cn/wy-wx-oauth`,
appid = 'wx1cf40dc91c28a7fd',
wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(redirectUrl)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
wx.p.router.jumpH5(wxUrl)
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
const {
options
} = this
if (options.id) this.getQuestionnaireDetail(options)
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
// 添加埋点信息
addTrackInfo(){
const {userInfo} = this.data
let item = {
add_way: '104',
customer_phone: userInfo.phone
}
if (userInfo.nickName) {
item.customer_qw_nickname = userInfo.nickName
}
if (userInfo.headImgUrl) {
item.avatar = userInfo.headImgUrl
}
if (userInfo.unionId) {
item.union_id = userInfo.unionId
}
let json = JSON.stringify(item)
// 数据上报
wx.p.api.common.trackHttp({ json }).then(response => { })
}
})
\ No newline at end of file
{
"usingComponents": {
"gl-radio": "./components/Radio/Radio",
"gl-checkbox": "./components/Checkbox/Checkbox",
"gl-select": "./components/Select/Select",
"gl-cascader": "./components/Cascader/Cascader",
"van-field": "@vant/weapp/field/index",
"finish": "./components/Finish/Finish",
"gl-textarea": "/components/GlTextarea/GlTextarea"
}
}
\ No newline at end of file
/* packageMine/pages/questionnaire/questionnaire.wxss */
.layout {
// padding: 30rpx 40rpx calc(198rpx + var(--constantSafeAreaInsetBottom)) 0;
// padding: 30rpx 40rpx calc(198rpx + var(--envSafeAreaInsetBottom)) 0;
padding: 30rpx 40rpx 44rpx 0;
padding: 30rpx 40rpx 44rpx 0;
background-color: #fff;
min-height: 75vh;
.tips {
font-size: 28rpx;
color: #999999;
line-height: 40rpx;
display: block;
padding-left: 40rpx;
}
.form-box {
margin-top: 28rpx;
&::before {
content: '';
width: calc(100% - 40rpx);
height: 0;
margin-left: 40rpx;
display: block;
border-top: 2rpx dotted #e6e6e6;
}
.title {
padding: 40rpx 0 30rpx;
font-weight: 600;
font-size: 32rpx;
color: #333333;
letter-spacing: 0;
line-height: 48rpx;
display: flex;
justify-content: flex-end;
.num {
flex-shrink: 0;
padding-right: 10rpx;
}
.text {
width: calc(100% - 100rpx);
}
}
.required {
.num {
position: relative;
&::before {
position: absolute;
left: -16rpx;
top: 6rpx;
content: '*';
color: #F24724;
font-weight: normal;
}
}
}
.item {
width: calc(100% - 100rpx);
margin: 0 0 20rpx 100rpx;
}
.textarea {
height: 240rpx;
background: #FFFFFF;
border: 2rpx solid #E6E6E6;
border-radius: 8rpx;
box-sizing: border-box;
padding: 20rpx;
}
}
}
.fixed-btn {
// position: fixed;
// bottom: 0;
// left: 0;
width: calc(100% - 60rpx);
background-color: #F8F8F8;
padding: 32rpx 30rpx calc(32rpx + var(--constantSafeAreaInsetBottom));
padding: 32rpx 30rpx calc(32rpx + var(--envSafeAreaInsetBottom));
.default-btn {
width: 100%;
border-radius: 48rpx;
background-color: var(--themeColor);
}
}
.van-cell {
padding: 0 !important;
height: 100%;
overflow-y: scroll;
}
.van-field__body--textarea,.van-field__control{
height: 100% !important;
}
\ No newline at end of file
<block wx:if="{{questionnaireObj.id}}">
<block wx:if="{{!finish}}">
<view class="layout">
<text class="tips">{{questionnaireObj.desc}}</text>
<view class="form-box">
<block wx:for="{{questionnaireObj.questions}}" wx:key="index">
<view class="title {{item.required?'required':''}}">
<view class="num">{{item.num}}.</view>
<view class="text">{{item.text}}</view>
</view>
<view class="item {{item.type == 3?'textarea':''}}">
<block wx:if="{{item.type == 1}}">
<gl-radio data="{{item.data}}" num="{{item.num}}" bindchange="change" />
</block>
<block wx:elif="{{item.type == 2}}">
<gl-checkbox data="{{item.data}}" num="{{item.num}}" bindchange="change" />
</block>
<block wx:elif="{{item.type == 3}}">
<gl-textarea placeholder="请输入" maxlength="{{item.maxLength}}" data-num="{{item.num}}" bindblur="blur" showWordLimit></gl-textarea>
</block>
<block wx:elif="{{item.type == 4}}">
<gl-select data="{{item.data}}" title="{{item.text}}" num="{{item.num}}" bindchange="change" />
</block>
<block wx:else>
<gl-cascader data="{{item.data}}" title="{{item.text}}" num="{{item.num}}" bindchange="change" />
</block>
</view>
</block>
</view>
</view>
<view class="fixed-btn text-center">
<button class="default-btn" bindtap="submit">提交</button>
</view>
</block>
<block wx:else>
<finish data="{{questionnaireObj}}" />
</block>
</block>
\ No newline at end of file
......@@ -22,7 +22,6 @@ Page({
item_type: 6,
view: 1
})
this
},
......
......@@ -15,26 +15,42 @@ Page({
async onLoad(options) {
const info = JSON.parse(decodeURIComponent(options.userProfile))
const res = await USERAPI.updateUserInfo({
nickName: info.nickName,
avatarUrl: info.avatarUrl
})
nickName: info.nickName,
avatarUrl: info.avatarUrl
}),
/**重新获取sessionId */
{
code,
data,
} = await wx.p.api.userApi.login()
if (data && code == '0') {
wx.p.storage.set('merchant_info', {
merchantId: data.merchantId,
merchantName: data.merchantName
})
wx.p.storage.set('userInfo', data)
wx.p.storage.set('sessionId', data.sessionId)
}
wx.p.router.back(res => {
res.setData({
nickName: info.nickName,
headImgUrl: info.avatarUrl,
hasUserInfo: true
})
res.toCheckMember()
res.toCheckMember && res.toCheckMember()
let item = {
add_way: '104',
customer_phone: res.data.userInfo.phone,
customer_name: info.nickName,
customer_qw_nickname: info.nickName,
avatar: info.avatarUrl,
merchant_id: res.data.merchantId
merchant_id: res.data.merchantId,
union_id: res.data.userInfo.unionId
}
let json = JSON.stringify(item)
// 数据上报
wx.p.api.common.trackHttp({ json }).then(response => { })
wx.p.api.common.trackHttp({
json
}).then(response => {})
})
},
......
......@@ -31,6 +31,8 @@ Page({
wx.p.storage.set('merchant_info', {
merchantId: options.merchantId,
})
wx.p.storage.set('first_enter_merchantId', options.merchantId)
wx.p.storage.set('first_enter_miniprograme', true)
}
try {
const { code, data, message } = await wx.p.api.userApi.login()
......
......@@ -29,6 +29,7 @@ Page({
wx.p.cache.storageApi.setSessionId(sid)
this.handleFreeCard(bingInfo)
}
this.shareTitle = "省钱专区"
},
navbarReady(e) {
......@@ -43,6 +44,10 @@ Page({
onShow() {
let authComponent = this.selectComponent('#authorize')
if (authComponent) authComponent.check()
const FIRST = wx.p.storage.get('first_enter_miniprograme')
this.setData({
showStore:!FIRST
})
},
goMorePage() {
......@@ -316,4 +321,5 @@ Page({
notIntercept: true
})
},
onShareAppMessage(){}
})
\ No newline at end of file
......@@ -3,7 +3,7 @@
</view>
<!-- <view class="save-money-box"> -->
<view class="save-money-box-content" style="{{user_box_style}}">
<glsx-image webp src="home/homelife_bg.png" class="save-money-img"></glsx-image>
<glsx-image webp src="home/save_money_bg.png" class="save-money-img"></glsx-image>
<view class="save-money-order-box">
<glsx-image webp src="savemoney/save_order.png" class="save-money-order-img" bind:tap="toPluginPage"></glsx-image>
<view bind:tap="toPluginPage" class="save-money-order-text-box">去下单</view>
......@@ -41,4 +41,4 @@
</view>
<!-- </view> -->
<authorize id="authorize" scopeType="userLocation" isShowCheck="{{false}}" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
<!-- <glsx-privacy appletName="业主甄选"></glsx-privacy> -->
\ No newline at end of file
<store-select show="{{showStore}}"></store-select>
\ No newline at end of file
const navStyle = "background-color: transparent;";
import { IMG_URL } from '~/config';
import { env } from '~/api/env/index'
import { MERCHANT_STATIC_LIST} from '~/utils/constants'
Page({
data: {
IMG_URL,
......@@ -29,7 +30,7 @@ Page({
let { height } = e.detail;
this.setData({
navBarHeight: height,
user_box_style: `padding-top:${height+10}px`,
user_box_style: `padding-top:${height + 10}px`,
});
},
// 处理滚动事件
......@@ -41,7 +42,14 @@ Page({
},
onLoad(options) {
this.defaultMerchant = wx.$merchant_id
this.getMerchantList()
const FIRST = wx.p.storage.get('first_enter_miniprograme')
if (FIRST) {
this.getMerchantList()
} else {
wx.p.eventbus.on('STORE', () => {
this.getMerchantList()
})
}
this.getStrategyList();
if (options?.jumpH5Url) {
this.setData({
......@@ -54,6 +62,7 @@ Page({
})
}, 1600)
}
this.shareTitle = "甄选福利"
},
// 获取省钱攻略
......@@ -81,7 +90,7 @@ Page({
toShowQrCode(e) {
const { url } = e.currentTarget.dataset;
const {currentStore} = this.data
const { currentStore } = this.data
const Name = `${currentStore.merchantId}_${url}`
this.setData({
urlName: Name,
......@@ -110,78 +119,90 @@ Page({
wx.p.storage.set('merchant_info', {
merchantId: currentStore.merchantId,
})
wx.p.eventbus.emit('MALL_FRESH')
this.setData({
currentStore
},()=>{
this.getMerchantIdDetail(currentStore.merchantId)
})
},
// 获取门店列表
getMerchantList() {
const merchantObj = {
'develop': [44211227, 44209845],
'test': [44212577, 44210895, 44212578, 44210956],
'beta': [44211427,44211428],
'production': [44209566, 44209565],
async getMerchantList() {
const HAVE_ENTER = wx.p.storage.get('first_enter_miniprograme')
if (HAVE_ENTER && !this.fresh) {
this.defaultMerchant = wx.p.storage.get('first_enter_merchantId')
}
// 获取mock配置门店
const MOCKDATA = wx.p.storage.get("mock_data");
let MerchantList = merchantObj[env]
if(MOCKDATA&&MOCKDATA.add_wuye_merchant){
let MerchantList = MERCHANT_STATIC_LIST[env]
if (MOCKDATA && MOCKDATA.add_wuye_merchant) {
const ADD_MERCHANT_LIST = MOCKDATA.add_wuye_merchant[env]
if(ADD_MERCHANT_LIST&&ADD_MERCHANT_LIST.length){
MerchantList = [...MerchantList,...ADD_MERCHANT_LIST]
if (ADD_MERCHANT_LIST && ADD_MERCHANT_LIST.length) {
MerchantList = [...MerchantList, ...ADD_MERCHANT_LIST]
}
}
let storeList = [], index = 0
MerchantList.forEach((el, i) => {
wx.$merchant_id = el
wx.p.storage.set('merchant_info', {
merchantId: el,
})
wx.p.api.homeApi.getHomeConfig({ merchantId: el }).then(data => {
let {
merchantName,
noticeContent
} = data
let bannerList = []
if (data.bannerList && data.bannerList.length) bannerList = data.bannerList
storeList.push({
merchantName,
noticeContent,
bannerList,
merchantId: el
})
if (storeList.length > 1) {
storeList.forEach((ele, i) => {
if (this.defaultMerchant == ele.merchantId) {
index = i
}
})
const currentStore = storeList[index]
wx.$merchant_id = currentStore.merchantId
wx.p.storage.set('merchant_info', {
merchantId: currentStore.merchantId,
})
this.setData({
storeList,
currentStore
})
if( this.fresh){
wx.stopPullDownRefresh()
}
}
})
storeList = await this.getMerchantListData(MerchantList) || []
storeList.forEach((ele, i) => {
ele.merchantId = ele.merchantNo
if (this.defaultMerchant == ele.merchantId) {
index = i
}
})
const currentStore = storeList[index]
wx.$merchant_id = currentStore.merchantId
wx.p.storage.set('merchant_info', {
merchantId: currentStore.merchantId,
})
this.setData({
storeList,
currentStore
}, () => {
this.getMerchantIdDetail(currentStore.merchantId)
})
},
onPullDownRefresh(){
onPullDownRefresh() {
this.fresh = true
this.defaultMerchant = this.getStorageMerchantId()
this.getMerchantList()
this.getStrategyList();
},
onShow() {
const FIRST = wx.p.storage.get('first_enter_miniprograme')
this.setData({
showStore: !FIRST
})
},
// 获取门店id
getStorageMerchantId() {
const {
merchantId
} = wx.p.storage.get('merchant_info')
this.defaultMerchant = merchantId
this.getMerchantList()
this.getStrategyList();
}
return merchantId
},
// 获取门店列表
async getMerchantListData(merchantIdList) {
const res = await wx.p.api.shopmallApi.getStoreList({ merchantIdList })
if(res.code==0) return res.data
else return false
},
// 获取选择门店的信息
getMerchantIdDetail(merchantId) {
wx.$merchant_id = merchantId
wx.p.api.homeApi.getHomeConfig({ merchantId }).then(data => {
let {
noticeContent
} = data
let bannerList = [], { currentStore } = this.data
if (data.bannerList && data.bannerList.length) bannerList = data.bannerList
currentStore.noticeContent = noticeContent
currentStore.bannerList = bannerList
this.setData({
currentStore
})
})
},
onShareAppMessage(){}
});
......@@ -61,4 +61,4 @@
<image bind:tap="closeModal" class="close_icon" src="{{IMG_URL}}home/close_modal.png" />
</view>
</view>
<!-- <glsx-privacy appletName="业主甄选"></glsx-privacy> -->
\ No newline at end of file
<store-select show="{{showStore}}" bind:freshMerchant="freshMerchant"></store-select>
\ No newline at end of file
......@@ -14,23 +14,23 @@ Component({
*/
properties: {
height: null,
channelID: {
type: Number,
observer: function (val) {
if (val) {
// this.setList(val);
}
},
},
merchantid: {
type: [String, Number],
observer: function (val) {
if (val) {
this.init()
// this.setList(val);
}
},
},
// channelID: {
// type: Number,
// observer: function (val) {
// if (val) {
// // this.setList(val);
// }
// },
// },
// merchantid: {
// type: [String, Number],
// observer: function (val) {
// if (val) {
// this.init()
// // this.setList(val);
// }
// },
// },
},
/**
......@@ -66,8 +66,11 @@ Component({
toSeri: `toCategory-${index}`,
categoryStyle: item.categoryStyle || 0
})
this.triggerEvent('showShoppingCar', item.categoryStyle)
this.getCategoryGoodsList(item.id)
// this.triggerEvent('showShoppingCar', item.categoryStyle)
const {
merchantId
} = wx.p.storage.get('merchant_info')
this.getCategoryGoodsList(item.id, merchantId)
},
//获取分类
getCategoryList() {
......@@ -84,17 +87,18 @@ Component({
categoryList: res,
categoryStyle: res[0].categoryStyle || 0
})
this.triggerEvent('showShoppingCar', res[0].categoryStyle)
// console.log(res[0].id,'res[0].id');
this.getCategoryGoodsList(res[0].id)
this.getCategoryGoodsList(res[0].id, merchantId)
} else {
this.setData({
categoryList: [],
categoryStyle: 0,
goodsList: []
})
}
})
},
//获取商品列表
async getCategoryGoodsList(categoryId) {
const {
merchantId
} = wx.p.storage.get('merchant_info')
async getCategoryGoodsList(categoryId, merchantId) {
let _para = {
merchantId,
categoryId,
......@@ -157,6 +161,7 @@ Component({
item
} = e.currentTarget.dataset
const B_userInfo = wx.p.storage.get('userInfo')
this.jumpEvent = true
if (B_userInfo && B_userInfo.userType) {
wx.navigateTo({
url: '/pages/Login/Login'
......@@ -212,20 +217,20 @@ Component({
// });
// },
// 获取购物车列表
async getBuyCarList() {
const authStatus = await wx.p.router.intercept(false)
if (authStatus) return
const B_userInfo = wx.p.storage.get('userInfo')
if (B_userInfo && B_userInfo.userType) return;
const {
merchantId
} = wx.p.storage.get('merchant_info')
const res = await shopmallApi.getShoppingcartList({
cartType: 4,
merchantId
})
eventbus.emit('getBuyCarList', res)
},
// async getBuyCarList() {
// const authStatus = await wx.p.router.intercept(false)
// if (authStatus) return
// const B_userInfo = wx.p.storage.get('userInfo')
// if (B_userInfo && B_userInfo.userType) return;
// const {
// merchantId
// } = wx.p.storage.get('merchant_info')
// const res = await shopmallApi.getShoppingcartList({
// cartType: 4,
// merchantId
// })
// eventbus.emit('getBuyCarList', res)
// },
// 加入购物车
async toAddBuuCar(e) {
const {
......@@ -233,6 +238,7 @@ Component({
} = e.currentTarget.dataset
const authStatus = await wx.p.router.intercept()
if (authStatus) return
this.jumpEvent = true
if (this.data.hasCarOwnerCouponFlag) {
wx.p.router.go(`/packageMall/pages/getCoupon/getCoupon?discoverGoodsType=2&from=2`, { notIntercept: true });
return
......@@ -244,12 +250,12 @@ Component({
goodsId: item.id,
}
let _para = {
goodsList:deliveryType==1? goodsListItem:[goodsListItem],
goodsList: [goodsListItem],
isCarOwner: true,
showAddr: deliveryType==0?1:0,
showAddr: deliveryType == 0 ? 1 : 0,
buyType: 'pay',
discoverGoodsSource: item.discoverGoodsSource,
deliveryType:deliveryType
deliveryType: 0
}
wx.p.router.go('/packageDiscovery/pages/pay/index', _para)
// const res = await shopmallApi.addShoppingcart(_para)
......@@ -275,7 +281,9 @@ Component({
this.init()
},
init() {
this.getCategoryList()
if (!this.jumpEvent) {
this.getCategoryList()
}
// const B_userInfo = wx.p.storage.get('userInfo')
// if (B_userInfo && B_userInfo.userType) return
// this.getBuyCarList()
......@@ -284,7 +292,14 @@ Component({
},
lifetimes: {
ready: function () {
// this.init()
wx.p.eventbus.on('MALL_FRESH', () => {
this.getCategoryList()
this.setData({
curCategoryIdx:0,
curPlayIdx:0,
toCategory: 'toCategory-0',
})
})
}
}
})
......@@ -82,7 +82,7 @@ page {
.titleBg {
box-sizing: border-box;
width: 750rpx;
width: 722rpx;
height: 160rpx;
margin-left: -20rpx;
background-image: url(https://img02.glsx.com.cn/weapp/resource/miniprogram/wuye/mall/goodsBg.png);
......
......@@ -7,90 +7,92 @@ Page({
}
},
onShow() {
let {
merchantId
} = this.data
const merchantInfo = wx.p.storage.get('merchant_info')
let newMerchantId = merchantInfo.merchantId
// let {
// merchantId
// } = this.data
// const merchantInfo = wx.p.storage.get('merchant_info')
// let newMerchantId = merchantInfo.merchantId
if (newMerchantId != merchantId && newMerchantId ) {
this.setData({
merchantId: newMerchantId
})
this.getDiscoverInfo(newMerchantId, 6)
}
// if (newMerchantId != merchantId && newMerchantId ) {
// this.setData({
// merchantId: newMerchantId
// })
// this.getDiscoverInfo(newMerchantId, 6)
// }
// this.getDiscoverInfo(merchantInfo.merchantId, 6)
this.getComponentPage().onShow && this.getComponentPage().onShow()
},
getDiscoverInfo(merchantId, channel) {
discoveryApi.getDiscoverConfig({
merchantId
}).then(res => {
if (res && res.length) {
// console.log(JSON.stringify(res), channel);
this.handlerDiscoverSetting(JSON.stringify(res), channel)
}
})
},
// 处理发现配置数据
handlerDiscoverSetting(query, channel) {
const list = JSON.parse(query)
let {
currentChannel,
curTabIndex
} = this.data
if (list && list.length) {
if (channel) {
list.forEach((el, index) => {
if (el.channelType == channel) {
curTabIndex = index
currentChannel = el
}
})
} else {
currentChannel = list[0]
}
// this.computeBannerHeight(list.length)
}
const FIRST = wx.p.storage.get('first_enter_miniprograme')
this.setData({
discoverSettingList: list,
showPage: true,
currentChannel,
curTabIndex
showStore:!FIRST
})
},
// getDiscoverInfo(merchantId, channel) {
// discoveryApi.getDiscoverConfig({
// merchantId
// }).then(res => {
// if (res && res.length) {
// // console.log(JSON.stringify(res), channel);
// this.handlerDiscoverSetting(JSON.stringify(res), channel)
// }
// })
// },
// 处理发现配置数据
// handlerDiscoverSetting(query, channel) {
// const list = JSON.parse(query)
// let {
// currentChannel,
// curTabIndex
// } = this.data
// if (list && list.length) {
// if (channel) {
// list.forEach((el, index) => {
// if (el.channelType == channel) {
// curTabIndex = index
// currentChannel = el
// }
// })
// } else {
// currentChannel = list[0]
// }
// // this.computeBannerHeight(list.length)
// }
// this.setData({
// currentChannel,
// })
// },
// 计算高度
computeBannerHeight(len) {
let query = wx.createSelectorQuery().in(this)
query
.select('.banner_wrapper')
.boundingClientRect(res => {
this.setData({
'heightInfo.bannerH': res.height
})
})
.exec()
query
.select('.tab_wrapper')
.boundingClientRect(react => {
if (len == 1) {
this.setData({
'heightInfo.tabH': 20
})
} else {
this.setData({
'heightInfo.tabH': react.height
})
}
})
.exec()
},
// computeBannerHeight(len) {
// let query = wx.createSelectorQuery().in(this)
// query
// .select('.banner_wrapper')
// .boundingClientRect(res => {
// this.setData({
// 'heightInfo.bannerH': res.height
// })
// })
// .exec()
// query
// .select('.tab_wrapper')
// .boundingClientRect(react => {
// if (len == 1) {
// this.setData({
// 'heightInfo.tabH': 20
// })
// } else {
// this.setData({
// 'heightInfo.tabH': react.height
// })
// }
// })
// .exec()
// },
//隐藏购物车
showShoppingCarFn(e) {
this.setData({
showCarFlag: e.detail != 2
})
},
// showShoppingCarFn(e) {
// this.setData({
// showCarFlag: e.detail != 2
// })
// },
navbarReady(e) {
let { height } = e.detail;
this.setData({
......@@ -101,5 +103,11 @@ Page({
getComponentPage() {
return this.selectComponent(`#currentChannel_6`)
},
freshMerchant(){
this.onShow()
},
onShareAppMessage(){},
onLoad(){
this.shareTitle = "甄选专区"
}
})
\ No newline at end of file
......@@ -9,4 +9,4 @@
</view>
<carOwner id="currentChannel_6" bindshowShoppingCar="showShoppingCarFn" merchantid="{{merchantId}}" channelID="{{currentChannel.id}}"></carOwner>
</view>
<!-- <glsx-privacy appletName="业主甄选"></glsx-privacy> -->
\ No newline at end of file
<store-select show="{{showStore}}" bind:freshMerchant="freshMerchant"></store-select>
\ No newline at end of file
......@@ -70,6 +70,7 @@ Page({
memberUrl: options.isOpenMember ? 'bg-member' : 'bg-member-first'
})
}
this.shareTitle = "我的"
},
navbarReady(e) {
let {
......@@ -179,7 +180,14 @@ Page({
this.toCheckMember()
this.getUserCarList()
this.getMemberCardData()
const FIRST = wx.p.storage.get('first_enter_miniprograme')
this.setData({
showStore:!FIRST
})
},
freshMerchant(){
this.getMemberCardData()
},
onShareAppMessage(){}
})
\ No newline at end of file
......@@ -159,4 +159,4 @@
<glsx-image bindtap="handleChangeVal" data-attr="isMemberShow" data-val="{{false}}" class="member-close" src="mine/icon-member-close.png"></glsx-image>
</view>
</view>
<!-- <glsx-privacy appletName="业主甄选"></glsx-privacy> -->
\ No newline at end of file
<store-select show="{{showStore}}" bind:freshMerchant="freshMerchant"></store-select>
\ No newline at end of file
......@@ -13,6 +13,7 @@ Page({
*/
onLoad(options) {
this.getStrategyList();
this.shareTitle = "攻略专区"
},
navbarReady(e) {
......@@ -40,5 +41,12 @@ Page({
id,
notIntercept: true
})
},
onShareAppMessage(){},
onShow(){
const FIRST = wx.p.storage.get('first_enter_miniprograme')
this.setData({
showStore:!FIRST
})
}
});
......@@ -13,3 +13,4 @@
</view>
</view>
</view>
<store-select show="{{showStore}}"></store-select>
\ No newline at end of file
......@@ -167,4 +167,13 @@
100% {
opacity: 1;
}
}
/* van组件样式 */
.van-cascader__title{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.van-picker__confirm {
color: var(--themeColor) !important;
}
\ No newline at end of file
......@@ -18,10 +18,21 @@ export const STORAGE_OBJECTkEY = {
guest_no: 'guest_no',
scrm_shopmall_car_brand_list:"scrm_shopmall_car_brand_list",
shareStaff:"shareStaff",
miaoshatrack:'miaoshatrack'
miaoshatrack:'miaoshatrack',
first_enter_miniprograme:"first_enter_miniprograme",
first_enter_merchantId:"first_enter_merchantId"
}
// 设置默认门店信息
export const MERCHANT_STATIC_LIST = {
'develop': [44211227, 44209845],
'test': [44212577, 44210895, 44212578, 44210956],
'beta': [44211427, 44211428],
'production': [44209566, 44209565],
}
export default{
DEFAULT_GET_STORAGEKEY,
STORAGE_OBJECTkEY
STORAGE_OBJECTkEY,
MERCHANT_STATIC_LIST
}
\ No newline at end of file
......@@ -93,8 +93,8 @@ class Share {
}
}
getCommonData() {
const WXUSERINFO = wx.p.storage.get('wx_user_info'), //针对没登录用户,有openid
USERINFO = wx.p.storage.get('userInfo') //这个是针对登录的
const WXUSERINFO = wx.p.storage.get('wx_user_info') || {}, //针对没登录用户,有openid
USERINFO = wx.p.storage.get('userInfo') || {} //这个是针对登录的
const {
merchantId
} = wx.p.storage.get('merchant_info')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!