Commit 98a6e7a6 by 前端

Merge branch 'v1.0.0' into 'master'

svn迁移git

See merge request !1
2 parents 5199667f 23d98016
Showing 709 changed files with 4911 additions and 0 deletions
{"containers":[],"config":{}}
\ No newline at end of file \ No newline at end of file
.DS_Store
node_modules
/dist
/.history
/cache
/copyDirTarget
miniprogram_npm
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
\ No newline at end of file \ No newline at end of file
import api from './request'
import indexApi from './indexApi'
import ssoApi from './ssoApi'
import discoveryApi from './discoveryApi'
import shopmallApi from './shopmallApi'
import mineApi from './mineApi'
import couponsApi from "./coupons"
import equityApi from "./equity"
import entmicroApi from "./entmicroApi"
import boutiquecouponApi from './boutiquecouponApi'
import psdApi from './psdApi'
import sopApi from './sopApi'
import carlifeApi from './carlifeApi'
import bigdatautilApi from './bigdatautil'
const common = 'scrm.api.carlife.common.'
module.exports = {
ssoApi,
indexApi,
discoveryApi,
shopmallApi,
mineApi,
couponsApi,
equityApi,
entmicroApi,
boutiquecouponApi,
psdApi,
sopApi,
carlifeApi,
bigdatautilApi,
commonApi: {
/**上传图片
*/
uploadImg(data) {
return api.post({
method: `${common}uploadImg`,
...data,
noSignAttr: ['file']
})
},
/**视频上传
*/
uploadVideo(data) {
return api.post({
method: `${common}uploadVideo`,
...data,
noSignAttr: ['file']
})
},
// /**根据sceneId 查参数 */
// getSceneById(data) {
// return api.post('dj.api.smartcarlife.common.getSceneById', data)
// },
/** 首页、发现列表 搜索接口 */
search(data) {
return api.post({
method: 'scrm.api.carlife.weapp.homeSearch.search',
pageSize: 10,
...data
})
},
/** 根据sap编码获取商户详情 */
getBySapCode(data) {
return api.post({
method: `scrm.api.carlife.merchant.getBySapCode`,
...data,
}, true)
},
/**获取图片版本号 */
getImgVersion() {
return api.getMock()
},
}
}
\ No newline at end of file \ No newline at end of file
import api from './request'
module.exports = {
/**埋点 数据上报*/
reportCustomer(params) {
return api.post({
method:'entmicro.api.customercollect.reportCustomer',
...params,
projectName:'customercollect'
})
},
}
\ No newline at end of file \ No newline at end of file
import api from './request'
module.exports = {
/**分页查询核销用户券 */
getBoutiquecouponList(data) {
return api.post({
method: `scrm.api.boutiquecoupon.customer.coupon.search`,
...data
})
},
/**获取商户券详情 */
getMerchantCoupon(id) {
return api.post({
method: `scrm.api.boutiquecoupon.merchantCoupon.getById`,
id
})
},
/** 获取精品礼券详情 */
getCouponDetail(id) {
return api.post({
method: 'scrm.api.boutiquecoupon.customer.coupon.detail',
id
})
},
/** 领取礼券 生成待核销码 */
getCoupon(data) {
return api.post({
method: `scrm.api.boutiquecoupon.customer.coupon.add`,
...data
})
},
/**获取园区店信息 */
getYqInfo(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.serviceMerchant.getByMerchantId',
...data
})
},
/** 精品交付单列表 */
getUserBoutiqueList(data) {
data.pageSize = 10
return api.post({
method: 'scrm.api.boutiquecoupon.goodsOrder.listMyOrder',
...data
}, true)
},
/**扫码后根据订单号获取订单详情 */
scanGetDetailByOrderCode(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.order.detailScan',
...data
})
},
/**根据订单号获取订单详情 */
getDetailByOrderCode(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.order.detail',
...data
})
},
/**评价 */
addComment(data) {
return api.post({
method: 'scrm.api.boutiquecoupon.orderComment.add',
...data
})
}
}
\ No newline at end of file \ No newline at end of file
import api from './request'
module.exports = {
/** 获取用户绑定设备信息 */
getUserDevInfo() {
return api.post({
method: 'scrm.api.carlife.devicebind.get.accountbinding',
deviceType: 'GPS'
})
},
/** 绑定设备 */
bindDev(data) {
return api.post({
method: 'scrm.api.carlife.devicebind.binding',
appType: 'CgacarMiniprogram',
...data
}, true)
},
/** 解绑设备 */
unbindDev(data) {
return api.post({
method: 'scrm.api.carlife.devicebind.unbinding',
...data
})
},
/**获取设备最新位置信息 */
getCarPosition(data) {
return api.post({
method: 'scrm.api.carlife.deviceposition.get.vehicle.position',
...data
})
},
/**获取设备最近行程 */
getPathList(data) {
return api.post({
method: 'scrm.api.carlife.deviceposition.get.recently.journey',
pageSize: 10,
...data
})
},
/** 获取设备总里程 */
getDevMileage(data) {
return api.post({
method: 'scrm.api.carlife.deviceposition.get.total.mileage',
...data
})
},
/** 获取线索列表 */
getClueList(data) {
return api.post({
method: 'scrm.api.carlife.weapp.clue.listWithPage',
pageSize: 10,
channelType: 'GH',
...data
})
},
/**获取设备日行程 */
getPathListByDay(data) {
return api.post({
method: 'scrm.api.carlife.deviceposition.get.journey.bydate',
pageSize: 10,
...data
})
},
/**获取指定行程信息 */
getPathDetail(journeyId) {
return api.post({
method: 'scrm.api.carlife.deviceposition.get.journey.by.id',
journeyId
}, true)
},
/**底部商城导航栏跳转至第三方倍礼安商城 */
async getBizjiaUrl(data = {}) {
let {
openId
} = getApp().globalData
if (!openId) {
let res = await getApp().login()
openId = res.data.openId
}
data.wechatOpenId = openId
return api.post({
method: `scrm.api.carlife.cgacar.api.shopmall`,
...data,
})
},
/**判断是否绑定车架号 */
checkBindVIN(data) {
return api.post({
method: `scrm.api.carlife.cgacar.commom.list.veh`,
...data,
})
}
}
\ No newline at end of file \ No newline at end of file
import api from './request'
const path = 'scrm.api.coupon.'
const ghPath = 'scrm.api.carlife.cgacar.'
import {
defaultMerchantId
} from '../api/environment'
module.exports = {
/**获取卡券列表 */
getCardData(data) {
return api.post({
method: `${path}app.list`,
...data,
// discountTypes: [3, 7]
})
},
/**获取卡券数量 */
getCouponNum() {
return api.post({
method: 'scrm.api.coupon.list.by.account.id',
useMemberType: 0,
})
},
/**获取首页可以领取的券 */
getHomeCardData(data) {
let merchantId = wx.getStorageSync('srcm_shopmall_merchant_id')
if (merchantId) {
merchantId = Number(JSON.parse(merchantId))
data.merchantId = merchantId
}
if (merchantId) {
data.merchantId = merchantId
}
return api.post({
method: `${path}list.merchant.account`,
...data,
})
},
/**领取优惠券 */
toReciveCard(data) {
let merchantId = wx.getStorageSync('srcm_shopmall_merchant_id')
if (merchantId) {
merchantId = Number(JSON.parse(merchantId))
data.merchantId = merchantId
} else {
data.merchantId = defaultMerchantId
}
return api.post({
method: `${path}customer.receive`,
...data,
receiveWay: 1,
receiveSource: 3,
})
},
/**卡券详情 */
couponsDetail(data) {
return api.post({
method: `${path}verification.code.detail`,
...data,
})
},
/**广汇卡券 卡券全部列表 */
ghCouponsData() {
return api.post({
method: `${ghPath}coupon.list.benefits`,
})
},
/**广汇卡券 抵用记录列表 */
ghDealNote() {
return api.post({
method: `${ghPath}coupon.list.credit.cards`,
})
},
/**广汇卡券 发布确认列表 */
ghDealPublish() {
return api.post({
method: `${ghPath}coupon.list.card.deal`,
})
},
/**广汇卡券 抵用确认列表 */
ghDealResist() {
return api.post({
method: `${ghPath}coupon.list.resist.deal`,
})
},
/**抵用确认提交 */
ghSumbitResist(data) {
return api.post({
method: `${ghPath}coupon.resist.deal`,
...data
})
},
/**发布确认提交 */
ghSumbitPublish(data) {
return api.post({
method: `${ghPath}coupon.card.deal`,
...data
})
},
/**免费领取体验卡 */
tolqFreecard(data) {
return api.post({
method: `scrm.api.equity.h5.free.card.receive`,
...data
}, true)
},
/**获取体验卡天数 */
getFreeCardDay(data) {
return api.post({
method: `scrm.api.equity.class.free.day.get`,
...data
})
},
/** 获取企微分享优惠卷信息 */
getCouponInfo(data) {
return api.post({
method: `${path}share.info`,
...data,
})
},
/**领取优惠券 */
receiveCoupon(data) {
return api.post({
method: `${path}share.receive`,
...data,
receiveSource: 4
}, true)
},
/**获取套餐详情(权益) */
packageInfo(data) {
return api.post({
method: `scrm.api.equity.main.page.package.detail.get`,
...data
})
},
/**获取门店单号(权益) */
createOrderNum(data) {
return api.post({
method: `scrm.api.equity.merchant.order.code.create`,
...data
})
},
/**创建门店订单(权益) */
createOrder(data) {
return api.post({
method: `scrm.api.equity.merchant.order.create`,
...data
})
},
/**获取折扣券 兑换券详情 */
getWWCoupon(data) {
return api.post({
method: `scrm.api.coupon.verification.code.detail`,
...data
})
},
/** 检查是否领取优惠券 */
checkCoupon(data) {
return api.post({
method: `scrm.api.coupon.share.receive.check`,
...data
})
},
// 定向礼包详情
giftsDetail(data) {
return api.post({
method: `scrm.api.coupon.directional.gift.detail`,
...data
})
},
// 定向礼包领取
giftsRecive(data) {
return api.post({
method: `scrm.api.coupon.user.directional.gift.create`,
...data
})
},
/**查询会员开通的套餐列表 */
getVipList(data) {
return api.post({
method: `scrm.api.equity.package.info.list.with.account`,
pageSize: 9999,
...data
})
},
/** 查询包含已使用卡券的会员套餐列表 */
getVipUsedList(data){
return api.post({
method: `scrm.api.equity.package.info.list.with.used.service`,
pageSize: 9999,
...data
})
},
/** 查询包含失效卡券的会员套餐列表 */
getVipFailList(data){
return api.post({
method: `scrm.api.equity.package.info.list.with.invalid.service`,
pageSize: 9999,
...data
})
},
// 获取优惠券详情--道路救援
getDigitalCoupons(data){
return api.post({
method: `scrm.api.coupon.detail`,
...data
})
}
}
\ No newline at end of file \ No newline at end of file
import api from './request'
const path = 'scrm.api.shopmall.zoneInfo.weapp.'
module.exports = {
/**查询商户的指定类型专区列表 */
getZoneInfo(zoneType) {
return api.post({
method: `${path}listByMerchantId`,
zoneType //专区类型(1发现频道,2商城专区)
})
},
/** 晒单详情 */
getOrderShareRecordDetail(id) {
return api.post({
method: 'scrm.api.shopmall.weapp.orderShareRecord.detail',
id
})
},
}
import api from './request'
module.exports = {
getServiceCode(data) {
return api.post({
method: 'dracIm.api.entmicro.findMiniProgramIm',
...data
},true)
},
/**数字化道路救援 */
getDigitalPageInfo(data){
return api.post({
method: 'entmicro.api.drac.rescue.getRescueCustomerView',
...data
})
},
/**刷新数字化道路救援二维码 */
toFreshCode(data){
return api.post({
method: 'entmicro.api.drac.rescue.getRescueStaffCode',
...data
})
},
/**重新定位获取数据 */
toRegetDigitalData(data){
return api.post({
method: 'entmicro.api.drac.rescue.rescueReacquireLocation',
...data
})
},
/**智能外呼-联系人 */
findByActivityIdAndPhone(data){
return api.post({
method: 'dracIm.api.entmicro.findByActivityIdAndPhone',
...data
},true)
},
}
\ No newline at end of file \ No newline at end of file
const target = [
'ip',
'dev',
'uat',
'prod'
]
/**
*
0本地
1开发
2测试
3生产
*/
const index =2
const secretKey = {
ip: {},
dev: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b',
},
},
uat: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b',
},
},
prod: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b',
},
},
} [target[index]]
const domain = {
// ip: 'http://192.168.2.94:8558',
// ip: 'http://192.168.2.3:8315',
ip: 'http://192.168.3.181:8394',
/**登录: 192.168.2.3:8315
商城: 192.168.2.3:8558 */
dev: 'https://scrm.dev.glsx.com.cn',
uat: 'https://scrm.test.glsx.com.cn',
prod: 'https://scrm.cgacar.com',
} [target[index]]
const pathEnum = {
sso: '/rop-scrm-sso/',
shopmall: '/rop-scrm-shopmall/',
coupon: '/rop-scrm-coupon/',
carlife: '/rop-scrm-carlife/',
live: '/rop-scrm-live/',
equity: '/rop-scrm-equity/',
entmicro: '/rop-scrm-entmicro/',
wechat: '/rop-scrm-wechat/',
boutiquecoupon: '/rop-scrm-boutiquecoupon/',
material: '/rop-scrm-marketing/', //素材
sop: '/rop-scrm-sop/',
customercollect:'/rop-scrm-bigdatautil/',
drac:'/rop-scrm-entmicro/'
}
const defaultMerchantId = {
ip: '44184606',
dev: '44184606',
uat: '44184606',
prod: '44189923',
} [target[index]]
module.exports = {
index,
domain,
pathEnum,
secretKey,
defaultMerchantId
}
\ No newline at end of file \ No newline at end of file
import api from "./request";
module.exports = {
/**激活卡(权益) */
activeEquity(data) {
return api.post({
method: `scrm.api.equity.open.card.by.cardno`,
...data,
});
},
/**获取代驾服务接口*/
getEdjurl(data) {
return api.post({
method: `scrm.api.equity.edj.url`,
...data,
});
},
/**获取所有权益 */
getAllEquity(data) {
return api.post({
method: `scrm.api.equity.third.get`,
...data,
});
},
//查询是否开通会员
checkOpenMember(data) {
return api.post({
method: `scrm.api.equity.info`,
...data,
},
true
);
},
// 获取商品信息
commodityMsg(data) {
return api.post({
method: `scrm.api.equity.coupon.detail`,
...data,
});
},
// 查询商品库存
checkStock(data) {
return api.post({
method: `scrm.api.equity.goods.stock.get`,
...data,
},
true
);
},
// 首页--附近优惠 新接口
getLasteCommodity(data) {
return api.post({
method: `scrm.api.equity.main.page.carefully.chosen.page`,
...data,
});
},
// 首页--附近优惠
lasteCommodity(data) {
return api.post({
method: `scrm.api.equity.main.page.carefully.chosen.get`,
...data,
});
},
// 首页--门店套餐
storePackage(data) {
return api.post({
method: `scrm.api.equity.main.page.merchant.package.get`,
...data,
});
},
// 首页--获取会员卡信息
memberCard(data) {
return api.post({
method: `scrm.api.equity.open.card.price.get.by.merchantid`,
...data,
});
},
// 购买权益卡
buyMemberCard(data) {
return api.post({
method: `scrm.api.equity.open.card.to.buy`,
...data,
});
},
// 首页--获取养车服务
serviceDataOfhome(data) {
return api.post({
method: `scrm.api.equity.service.h5.main.page.service.get`,
...data,
});
},
// 查询服务条款
serviceTerms(data) {
return api.post({
method: `scrm.api.equity.service.h5.items.terms.get`,
...data,
});
},
// 根据身份证查询订单
checkOrderByIdcard(data) {
return api.post({
method: `scrm.api.equity.service.h5.order.by.card`,
...data,
});
},
// 首页--检测是否领取了权益卡
checkCustomCardNote(data) {
return api.post({
method: `scrm.api.equity.service.h5.customer.equity.card.get`,
...data,
});
},
// 通过购买售前权益套餐后领卡
openCardByPreSale(data) {
return api.post({
method: `scrm.api.equity.open.card.receive.by.package`,
...data,
},
true
);
},
// 购买商品获取订单号
getOrderCode(data) {
return api.post({
method: `scrm.api.equity.ordercode.get`,
...data,
});
},
/** 会员商城商品数据 */
getMerchantGoodsList(data) {
return api.post({
method: `scrm.api.shopmall.goods.page.curMerchant.wechat`,
pageNum: 1,
pageSize: 999,
...data,
});
},
// 支付订单号
payGoodsOrder(data) {
return api.post({
method: `scrm.api.equity.create.order`,
...data,
});
},
// 服务项目详情
serviceDetailMsg(data) {
return api.post({
method: `scrm.api.equity.service.h5.bill.detail.get`,
...data,
});
},
// 门店订单套餐详情
packageOrderDetail(data) {
return api.post({
method: `scrm.api.equity.h5.package.order.detail.get`,
...data,
});
},
// 获取直充商品数据
chargeData(data) {
return api.post({
method: `scrm.api.equity.charge.detail`,
...data,
});
},
// 获取订单详情
orderDetailData(data) {
return api.post({
method: `scrm.api.equity.h5.order.detail.get`,
...data,
});
},
// 创建售后
createdSale(data) {
return api.post({
method: `scrm.api.equity.order.refund.detail.create`,
...data,
});
},
// 获取售后详情
saleDetailInfo(data) {
return api.post({
method: `scrm.api.equity.h5.order.refund.detail.get`,
...data,
});
},
// 套餐申请售后
packageApply(data) {
return api.post({
method: `scrm.api.equity.merchant.order.refund`,
...data,
});
},
// 我的卡券
cardListData(data) {
return api.post({
method: `scrm.api.equity.h5.order.list.get`,
...data,
});
},
// 确认收货
comfirmRevice(data) {
return api.post({
method: `scrm.api.equity.h5.order.finish.confirm`,
...data,
});
},
// 查询热线电话
hotLine(data) {
return api.post({
method: `scrm.api.equity.service.package.merchant.hotline.get`,
...data,
});
},
// 查询商户信息
getMerchantInfo(data) {
return api.post({
method: `scrm.api.equity.common.merchant.detail.det`,
...data,
});
},
// 查询是否开通售前权益配置
preSaleSetting(data) {
return api.post({
method: `scrm.api.equity.service.merchant.config.get`,
...data,
});
},
// 生成理赔核销码
createdQrCode(data) {
return api.post({
method: `scrm.api.equity.service.order.h5.writeOff.code.generate`,
...data,
});
},
// 新增救援服务线索
addClueRescue(data) {
return api.post({
method: `scrm.api.carlife.weapp.clue.rescue`,
...data,
});
},
// 获取权益功能菜单
equityFnMenu(data) {
return api.post({
method: `scrm.api.equity.main.page.third.equity.get`,
...data,
});
},
// 会员套餐列表
equityPacks(data) {
return api.post({
method: `scrm.api.equity.main.page.group.package.get`,
...data,
});
},
// 会员开通记录
equityOpenNote(data) {
return api.post({
method: `scrm.api.equity.card.user.record`,
...data,
});
},
// 会员套餐服务列表
equityServices(data) {
return api.post({
method: `scrm.api.equity.package.service.list`,
...data,
});
},
// 新版购买权益卡+套餐
equityBuy(data) {
return api.post({
method: `scrm.api.equity.merchant.order.gh.create`,
...data,
});
},
// 新版查看已购买套餐
checkHaveBuyPackage(data) {
return api.post({
method: `scrm.api.equity.package.info.list.with.account`,
...data,
});
},
// 会员商城专区
getZoneInfo(data) {
return api.post({
method: `scrm.api.shopmall.zoneInfo.weapp.listByMerchantId`,
...data,
});
},
// 购买套餐默认回显上次填写的车牌号(只查车牌号不查车架号)
getLastBindPlatNum(data) {
return api.post({
method: `scrm.api.equity.merchant.order.bind.car.record`,
...data,
}, true);
},
// 集团套餐详情
equityJTpackageDetail(data) {
return api.post({
method: `scrm.api.equity.main.page.group.package.detail`,
...data,
});
},
// 理赔需要上传的附件列表
claimsphotoList(data) {
return api.post({
method: `scrm.api.equity.service.attachment.classify.list`,
...data,
});
},
// 理赔需要上传的附件列表
claimsSubmit(data) {
return api.post({
method: `scrm.api.equity.mini.service.claims.save`,
...data,
});
},
// 理赔案件详情
claimsDetail(data) {
return api.post({
method: `scrm.api.equity.mini.service.claims.detail`,
...data,
});
},
// 理赔案件列表
claimsList(data) {
return api.post({
method: `scrm.api.equity.mini.service.claims.list`,
...data,
});
},
// 获取国任省市区列表
areaList(data) {
return api.post({
method: `scrm.api.equity.service.claims.area`,
...data,
});
},
// 签字授权
signSumbit(data) {
return api.post({
method: `scrm.api.equity.mini.service.claims.confirm`,
...data,
});
},
// 兑换码兑换
equityExchange(data) {
return api.post({
method: `scrm.api.equity.open.card.by.exchangeCode`,
...data,
});
},
// 首页门店套餐获取
getHomeStorePackage(data) {
return api.post({
method: `scrm.api.equity.package.gh.md.list`,
...data,
});
},
};
\ No newline at end of file \ No newline at end of file
import sha1 from './sha1.js'
import qs from './qs'
import environment from './environment.js'
const sign = (params, secret, noSignAttr = []) => {
delete params.sign
var objStr = qs.stringify(params, {
arrayFormat: 'indices',
allowDots: true,
encodeValuesOnly: true
})
var objVal = objStr.split('&')
var realObj = {}
objVal.forEach(item => {
const idx = item.indexOf('=')
realObj[item.split('=')[0]] = decodeURIComponent(item.slice(idx + 1))
})
const keys = Object.keys(realObj).sort()
var str = []
var obj = null
for (const key in realObj) {
obj = realObj[key]
if (obj === null) {
obj = ''
} else if (typeof obj === 'object') {
obj = JSON.stringify(obj)
}
realObj[key] = obj
}
keys.forEach(e => {
!noSignAttr.includes(e) && str.push(e + realObj[e])
})
realObj.sign = sha1(secret + str.join('') + secret).toUpperCase()
return realObj
}
module.exports = {
...environment,
sign
}
\ No newline at end of file \ No newline at end of file
import api from './request'
const path = 'scrm.api.shopmall.'
module.exports = {
/**获取商户小程序首页配置 */
getHomeConfig(data) {
return api.post({ method: `${path}weapp.homeConfig.getByMerchant`, ...data })
},
/**查询当前商户的分类列表 */
getClassifyList(data) {
return api.post({ method: `${path}classify.weapp.listByMerchantId`, ...data })
},
/**获取附近商户接口 */
getMerchantList(data) {
return api.post({ method: `scrm.api.carlife.merchant.recently.merchant`, storeCount: 10, ...data })
},
/** 分页查询活动 */
getActivityList(data) {
return api.post({ method: `${path}weapp.activity.page`, pageSize: 10, ...data })
},
/**分页查询直播 */
getLiveList(data) {
return api.post({ method: `scrm.api.live.weapp.live.page`, pageSize: 10, ...data })
},
/** 广汇获取城市列表 */
getCityList() {
return api.post({ method: 'scrm.api.carlife.cgacar.api.cities' })
},
/** 广汇获取车辆品牌列表 */
getBrandList() {
return api.post({ method: 'scrm.api.carlife.cgacar.api.brands' })
},
/** 广汇获取门店列表 */
getGHStoreList(data) {
return api.post({ method: 'scrm.api.carlife.cgacar.api.stores', pageSize: 10, ...data })
},
/** 创建维保预约单接口 */
createMaintainOrder(data) {
return api.post({ method: 'scrm.api.carlife.cgacar.commom.maintain.create', ...data })
},
/**新车频道 */
/**获取品牌列表 */
newBrandList(data){
return api.post({ method: 'scrm.api.carlife.weapp.clue.vehicle.brandList', ...data })
},
/**获取车系列表 */
newCarSeriesList(data){
return api.post({ method: 'scrm.api.carlife.weapp.clue.vehicle.seriesList', ...data })
},
/**获取车型列表 */
newCarTypeList(data){
return api.post({ method: 'scrm.api.carlife.weapp.clue.vehicle.shapeList', ...data })
},
/**新增试驾预约 */
addAppointment(data){
return api.post({ method: 'scrm.api.carlife.weapp.clue.drive.add', ...data })
},
/**新增新车询价 */
addNewCarEnquiry(data){
return api.post({ method: 'scrm.api.carlife.weapp.clue.newCar', ...data })
}
}
\ No newline at end of file \ No newline at end of file
import api from './request'
const path = 'scrm.api.shopmall.weapp.'
const carlife = 'scrm.api.carlife.weapp.'
const carlifeApi = {
/** 获取车品牌列表 */
getCarBrandList() {
return api.post({
method: 'scrm.api.carlife.common.getOnlyCarBrandList'
})
},
/** 获取车系列表 */
getCarSeriesList(data) {
return api.post({
method: 'scrm.api.carlife.common.getCarSeriesList',
...data
})
},
/** 获取车型 */
getCarTypeList(carSeriesId) {
return api.post({
method: 'scrm.api.carlife.common.getCarTypeList',
carSeriesId
})
},
/** 获取当前用户的车辆列表 */
getUserCarList(data) {
return api.post({
method: `${carlife}userCar.list`,
...data
})
},
/**新增用户车辆 */
addUserCar(data) {
return api.post({
method: `${carlife}userCar.add`,
...data
})
},
/** 更新用户车辆 */
updateUserCar(data) {
return api.post({
method: `${carlife}userCar.update`,
...data
})
},
/** 获取用户车辆 */
getUserCar(carId) {
return api.post({
method: `${carlife}userCar.getById`,
carId
})
},
/**删除用户车辆 */
delUserCar(carId) {
return api.post({
method: `${carlife}userCar.delete`,
carId
})
},
/**获取当前用户的收货地址列表 */
getUserAddressList(data) {
return api.post({
method: `${carlife}userAddress.list`,
...data
})
},
/**根据ID获取用户收货地址 */
getUserAddress(data) {
return api.post({
method: `${carlife}userAddress.getById`,
...data
})
},
/** 新增用户收货地址 */
addUserAddress(data) {
return api.post({
method: `${carlife}userAddress.add`,
...data
})
},
/**编辑用户收货地址 */
updateUserAddress(data) {
return api.post({
method: `${carlife}userAddress.update`,
...data
})
},
/** 更改为默认收货地址 */
setUserAddressDefault(data) {
return api.post({
method: `${carlife}userAddress.updateDefault`,
...data
})
},
/** 删除用户收货地址 */
delUserAddress(data) {
return api.post({
method: `${carlife}userAddress.delete`,
...data
})
},
/** 获取用户默认收货地址 */
getUserAddressDefault() {
return api.post({
method: `${carlife}userAddress.getDefault`
}, true)
},
/** 预约历史 */
getAppointmentList(pageNum) {
return api.post({
method: 'scrm.api.carlife.cgacar.commom.list.appointment',
pageNum
})
},
}
module.exports = {
...carlifeApi,
/**获取集团或者门店详细信息 */
getMerchantDetail(data) {
return api.post({
method: 'scrm.api.carlife.merchant.detail',
...data
})
},
/**. 分页查询订单 */
getOrderList(data) {
return api.post({
method: `${path}order.page`,
pageSize: 9999,
...data
})
},
/** 获取用户卷列表 */
getUserCouponList() {
return api.post({
method: 'scrm.api.coupon.user.list',
discountTypes: [3, 7]
})
},
/** 广汇车辆列表接口 */
getGHUserCarList() {
return api.post({
method: 'scrm.api.carlife.cgacar.commom.list.veh'
}, true)
},
/** 广汇客户车辆绑定接口 */
bindGHVehicle(data) {
return api.post({
method: 'scrm.api.carlife.cgacar.commom.vehicle.bind',
...data
}, true)
},
/** 获取广汇用户信息 */
getGHUserInfo() {
return api.post({
method: 'scrm.api.carlife.cgacar.commom.user.info.get'
}, true)
},
/** 获取当前用户顾问配置 */
getConsultantInfo(data) {
return api.post({
method: 'scrm.api.carlife.config.consultant.get',
...data
}, true)
},
/** 获取顾问列表*/
getConsultantList(data) {
return api.post({
method: 'scrm.api.carlife.config.consultant.list',
...data
}, true)
},
// 服务顾问配置更新
updateConsultant(data) {
return api.post({
method: 'scrm.api.carlife.config.consultant.update',
...data
})
},
}
\ No newline at end of file \ No newline at end of file
import api from './request'
module.exports = {
/** 素材发送/阅读埋点 */
viewReadBuriedPoint(params) {
return api.post({
method: 'marketing.api.open.material.sendReadBuriedPoint',
list: [params],
projectName: 'material'
})
},
/** 素材详情 */
getPsdDetail(data) {
return api.post({
method: `marketing.api.material.detail`,
...data,
flag: 1
}, true)
},
}
\ No newline at end of file \ No newline at end of file
This diff is collapsed. Click to expand it.
import {
secretKey,
pathEnum,
domain,
index,
sign
} from './http.js'
import util from '../utils/util.js'
let INTERRUPT = false
/**接口 */
class Request {
get(params, returnAll = false) {
return this.request('GET', params, returnAll)
}
post(params, returnAll = false) {
return this.request('POST', params, returnAll)
}
reportTrack(params) {
return this.request('POST', params, true)
}
request(RequestMethods, params, returnAll) {
return new Promise((resolve, reject) => {
wx.showNavigationBarLoading()
let header = RequestMethods === 'POST' ? {
'content-type': 'application/x-www-form-urlencoded'
} : {}
const merchantId = wx.$util.getStorageSync('srcm_shopmall_merchant_id')
if (merchantId) header.merchantId = merchantId
let projectName = params.projectName
if (!projectName) projectName = this.getRopProject(params.method)
const path = pathEnum[projectName]
params = this.getData(params)
wx.request({
url: `${domain}${path}router?method=${params.method}`,
data: params,
method: RequestMethods,
header,
dataType: 'json',
responseType: 'text',
success(response) {
/**业务代码 */
let {
data: {
code,
message
},
data
} = response
if (returnAll) {
resolve(data)
return
}
if (code == 20 || code == 21) {
wx.hideLoading()
const thisPage = wx.$router.getPageInstance()
if (thisPage && thisPage.pageRefresh) thisPage.pageRefresh()
if (!wx.$authStatus) {
if (INTERRUPT) return
INTERRUPT = true
wx.showLoading()
getApp().login().then(() => {
if (thisPage.init && thisPage.data.userInfo) thisPage.init()
if (thisPage.loginCallBack && thisPage.data.userInfo) thisPage.loginCallBack(thisPage.data.userInfo)
if (thisPage.onRoute) thisPage.onRoute()
thisPage.onLoad()
thisPage.onShow()
INTERRUPT = false
})
}
} else {
if (code == '0') {
resolve(data.data)
} else {
console.log(data)
wx.showToast({
title: message || '系统异常',
icon: 'none'
})
}
}
},
fail(error) {
wx.hideLoading()
console.error(`接口异常:`, error)
wx.showToast({
title: '系统异常',
icon: 'error'
})
reject(error)
},
complete() {
wx.stopPullDownRefresh()
wx.hideNavigationBarLoading()
}
})
})
}
getData(params) {
let projectName = params.projectName
if (!projectName) projectName = this.getRopProject(params.method)
else delete params.projectName
let appKey = '48e5e13229b82c1b4e6e8c96151f0637'
let secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
if (secretKey[projectName]) {
appKey = secretKey[projectName].appKey
secret = secretKey[projectName].secret
}
const sessionId = util.getSessionId()
let noSignAttr = []
if (!params.sessionId && sessionId) params.sessionId = sessionId
if (params.noSignAttr) {
noSignAttr = params.noSignAttr
delete params.noSignAttr
}
params.v = '1.0.0'
params.format = 'json'
params.locale = 'zh_CN'
params.source = 'dj-wechat'
params.appKey = appKey
return sign(params, secret, noSignAttr)
}
getRopProject(method) {
const projectName = method.split('.')[2]
return projectName
}
getMock() {
const configModule = 'gh-shopmall',
env = {
'1': 'develop',
'2': 'test',
'3': 'production',
'4': 'beta'
} [index],
configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`
return new Promise((resolve) => {
wx.request({
url: configUrl,
data: {},
method: 'GET',
header: {},
dataType: 'json',
responseType: 'text',
success(response) {
resolve(response.data)
}
})
})
}
}
export default new Request()
\ No newline at end of file \ No newline at end of file
function encodeUTF8(s) {
var i, r = [], c, x;
for (i = 0; i < s.length; i++)
if ((c = s.charCodeAt(i)) < 0x80) r.push(c);
else if (c < 0x800) r.push(0xC0 + (c >> 6 & 0x1F), 0x80 + (c & 0x3F));
else {
if ((x = c ^ 0xD800) >> 10 == 0) //对四字节UTF-16转换为Unicode
c = (x << 10) + (s.charCodeAt(++i) ^ 0xDC00) + 0x10000,
r.push(0xF0 + (c >> 18 & 0x7), 0x80 + (c >> 12 & 0x3F));
else r.push(0xE0 + (c >> 12 & 0xF));
r.push(0x80 + (c >> 6 & 0x3F), 0x80 + (c & 0x3F));
};
return r;
}
// 字符串加密成 hex 字符串
function sha1(s) {
var data = new Uint8Array(encodeUTF8(s))
var i, j, t;
var l = ((data.length + 8) >>> 6 << 4) + 16, s = new Uint8Array(l << 2);
s.set(new Uint8Array(data.buffer)), s = new Uint32Array(s.buffer);
for (t = new DataView(s.buffer), i = 0; i < l; i++)s[i] = t.getUint32(i << 2);
s[data.length >> 2] |= 0x80 << (24 - (data.length & 3) * 8);
s[l - 1] = data.length << 3;
var w = [], f = [
function () { return m[1] & m[2] | ~m[1] & m[3]; },
function () { return m[1] ^ m[2] ^ m[3]; },
function () { return m[1] & m[2] | m[1] & m[3] | m[2] & m[3]; },
function () { return m[1] ^ m[2] ^ m[3]; }
], rol = function (n, c) { return n << c | n >>> (32 - c); },
k = [1518500249, 1859775393, -1894007588, -899497514],
m = [1732584193, -271733879, null, null, -1009589776];
m[2] = ~m[0], m[3] = ~m[1];
for (i = 0; i < s.length; i += 16) {
var o = m.slice(0);
for (j = 0; j < 80; j++)
w[j] = j < 16 ? s[i + j] : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1),
t = rol(m[0], 5) + f[j / 20 | 0]() + m[4] + w[j] + k[j / 20 | 0] | 0,
m[1] = rol(m[1], 30), m.pop(), m.unshift(t);
for (j = 0; j < 5; j++)m[j] = m[j] + o[j] | 0;
};
t = new DataView(new Uint32Array(m).buffer);
for (var i = 0; i < 5; i++)m[i] = t.getUint32(i << 2);
var hex = Array.prototype.map.call(new Uint8Array(new Uint32Array(m).buffer), function (e) {
return (e < 16 ? "0" : "") + e.toString(16);
}).join("");
return hex;
}
module.exports = sha1
import api from "./request";
const path = "scrm.api.shopmall.weapp.";
const couponpath = "scrm.api.coupon.";
const wechatPath = "scrm.api.wechat.";
module.exports = {
/** 分页查询商城专区的商品信息 */
getGoodsList(data) {
return api.post({
method: `scrm.api.shopmall.zoneInfo.weapp.goodsPage`,
pageNum: 1,
pageSize: 999,
...data,
});
},
/** 根据商品ID获取商品 */
getGoodsDetail(id) {
return api.post(
{
method: `${path}goods.getById`,
id,
viewAmount: true,
},
true
);
},
/** 添加购物车 */
addShoppingcart(data) {
return api.post({
method: `${path}shoppingcart.add`,
...data,
});
},
/** 购物车删除商品 */
delShoppingcart(id) {
return api.post({
method: `${path}shoppingcart.delete`,
id,
});
},
/** 分页获取购物车 */
getShoppingcartList() {
return api.post({
method: `${path}shoppingcart.list`,
});
},
/** 购物车商品变更(比如修改数量) */
updateShoppingcart(data) {
return api.post({
method: `${path}shoppingcart.update`,
...data,
});
},
/**购物车结算 */
settlementShoppingcart(data) {
return api.post({
method: `${path}shoppingcart.settlement`,
...data,
});
},
/**根据规格值组合获取规格组合库存及零售价 */
getGoodsSpecificationExtra(data) {
return api.post({
method: `${path}goods.getGoodsSpecificationExtra`,
...data,
});
},
/** 创建订单(立即购买) */
createOrder(data) {
return api.post({
method: `${path}order.create`,
...data,
});
},
/**创建支付订单(去付款) */
payOrder(data) {
return api.post({
method: `${path}order.createPay`,
...data,
});
},
/** 确认收货 */
confirmReceipt(orderCode) {
return api.post({
method: `${path}order.confirmReceipt`,
orderCode,
});
},
/**订单详情 */
getOrderDetail(orderCode) {
return api.post({
method: `${path}order.detail`,
orderCode,
});
},
/** 申请售后 */
afterSale(data) {
return api.post(
{
method: `${path}orderRefund.apply`,
...data,
},
true
);
},
/**活动详情 */
getActivityDetail(id) {
return api.post(
{
method: `${path}activity.detail`,
id,
},
true
);
},
/** 直播活动详情 */
getLiveActivityDetail(data) {
return api.post(
{
method: `${path}live.activity.detail`,
...data,
},
true
);
},
/**获取订单的售后详情 */
getOrderRefundDetail(orderCode) {
return api.post({
method: `${path}orderRefund.detail`,
orderCode,
});
},
/** 为售后添加退货快递信息 */
addDelivery(data) {
return api.post({
method: `${path}orderRefund.addDelivery`,
...data,
});
},
/** 获取商品关联优惠券列表 */
getGoodscouponList(id) {
return api.post(
{
method: `${path}goods.user.coupons.get`,
...id,
},
true
);
},
/** 领取商品详情优惠券 */
getCoupon(data) {
return api.post(
{
method: `${couponpath}customer.receive`,
...data,
},
true
);
},
/** 领取确认订单最大优惠券 */
getMaxCoupon(orderGoods) {
return api.post(
{
method: `${path}order.coupons.get`,
orderGoods,
},
true
);
},
/**更换优惠券*/
updateCoupon(orderGoods) {
return api.post(
{
method: `${path}order.coupons.change`,
orderGoods,
},
true
);
},
//立即评价
addComment(data) {
return api.post(
{
method: `${path}orderGoodsComment.saveByOrder`,
...data,
},
true
);
},
//评论列表
getCommentList(data) {
return api.post(
{
method: `${path}orderGoodsComment.page`,
...data,
},
true
);
},
//获取订单的评论详情
getOrderCommentDetails(orderCode) {
return api.post(
{
method: `${path}orderGoodsComment.customerOrderGoodsComment`,
orderCode,
},
true
);
},
//取消付款
cancelPay(orderCode) {
return api.post(
{
method: `${path}order.cancelPay`,
orderCode,
},
true
);
},
//申请售后待审核的订单取消售后
cancelOrder(orderCode) {
return api.post(
{
method: `${path}orderRefund.cancel`,
orderCode,
},
true
);
},
/** 直播活动详情id */
getLiveActivityId(id) {
return api.post(
{
method: `${wechatPath}get.scene.by.id`,
...id,
},
true
);
},
/** 获取活动分享链接 */
getActivitylink(id) {
return api.post(
{
method: `scrm.api.shopmall.activity.get.shared`,
id,
},
true
);
},
/** 获取商品分享链接 */
getGoodslink(id) {
return api.post(
{
method: `scrm.api.shopmall.goods.get.shared`,
id,
},
true
);
},
// scrm.api.shopmall.weapp.
requestSubscribeMessage() {
return api.post(
{
method: `scrm.api.shopmall.weapp.order.listSubscribeMsgTemplateIds`,
},
true
);
},
/** 小程序端根据优惠券id查询可使用商品列表(分页) */
getCouponGoodsPage(data) {
// let merchantId = wx.$util.getStorageSync('srcm_shopmall_merchant_id')
// if (merchantId) data.merchantId = merchantId
data.pageSize = 8;
return api.post({
method: "scrm.app.shopmall.coupon.goods.page",
...data,
});
},
};
import api from './request'
module.exports = {
/** sop用户行为记录(埋点调用)
*/
customerbehavior(data) {
return api.post({
method: 'scrm.api.sop.task.customerbehavior.add',
flag: 1,
...data
})
},
customerbehaviorByEventId(data){
return api.post({
method: 'scrm.api.sop.event.customerbehavior.add',
...data
})
}
}
\ No newline at end of file \ No newline at end of file
import api from './request'
const path = 'scrm.api.sso.weapp.'
module.exports = {
/**wx.login登录 */
jsCodeLogin(data) {
return api.post({
method: `${path}jscode.login`,
...data
}, true)
},
/**授权用户信息 */
authUserInfo(data) {
return api.post({
method: 'scrm.api.sso.weapp.auth.userinfo',
...data
}, true)
},
/**授权手机号 */
authUserPhone(data) {
return api.post({
method: `${path}auth.phone`,
...data
}, true)
},
/**退出 */
logout() {
return api.post({
method: `scrm.api.sso.user.logout`
}, true)
},
//保存用户授权信息
saveuserProfile(data) {
return api.post({
method: `scrm.api.wechat.auth.userProfile.save`,
...data
}, true)
},
/**更新客户手机号 */
updataCustomerPhone(data) {
return api.post({
method: `scrm.api.sso.weapp.mark.phone`,
...data
})
},
/**展会演示 openId登录系统 */
loginByOpenId(data) {
return api.post({
method: `scrm.api.sso.weapp.auth.openIdLogin`,
...data
})
},
/**获取验证码 */
getSmsCode(data) {
return api.post({
method: `scrm.api.sso.sms.login.get.captcha`,
...data
}, true)
},
/*
*手机号短信登录
*/
phoneLogin(data) {
return api.post({
method: 'scrm.api.sso.weapp.auth.phone.mini',
source: 'MINIAPP',
...data
}, true)
}
}
\ No newline at end of file \ No newline at end of file
let loginCount = null,
loginCache = null,
loginTimer = null
import api from './request'
module.exports = {
async login() {
const appEnter = wx.getEnterOptionsSync()
try {
if (appEnter.scene === 1154 && appEnter.mode === 'singlePage') throw 'login:fail rejected due to no permission currently'
if (!loginCount) {
loginCache = null
loginCount = Date.now()
const {
code
} = await this.getWxCode(),
data = await api.post({
method: 'scrm.api.sso.weapp.jscode.login',
appId: wx.getAccountInfoSync().miniProgram.appId,
code,
delSessionId: true
},
true
)
loginCache = data
loginCount = null
return Promise.resolve(data)
} else {
return new Promise((resolve) => {
loginTimer = setInterval(() => {
if (loginCache) {
clearInterval(loginTimer)
loginCount = null
resolve(loginCache)
}
}, 1e3)
})
}
} catch (error) {
if (loginTimer) clearInterval(loginTimer)
loginCount = null
return Promise.reject(error)
}
},
/**调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、微信开放平台帐号下的唯一标识(unionid,若当前小程序已绑定到微信开放平台帐号)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。 */
getWxCode() {
return new Promise((resolve, reject) => {
wx.login({
success: res => resolve(res),
fail: err => reject(err)
})
})
}
}
\ No newline at end of file \ No newline at end of file
// app.js
import router from './router/index.js'
import util from './utils/util.js'
import {
ssoApi,
commonApi,
shopmallApi
} from './api/api'
import './utils/Track'
import eventbus from './utils/evenbus'
import userApi from './api/userApi'
App({
onLaunch(options) {
/**挂载到wx对象 */
wx.$authStatus = false
wx.$util = util
wx.$router = router
// wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/cgacar/'
wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram-test/cgacar/'
wx.$eventbus = eventbus
this.globalData.appId = wx.getAccountInfoSync().miniProgram.appId
const systemInfo = wx.getStorageSync('srcm_shopmall_system_info')
if (!systemInfo) wx.getSystemInfo({
success(res) {
util.setStorageSync('srcm_shopmall_system_info', res)
}
})
},
/**页面不存在时触发 */
onPageNotFound(e) {
wx.$router.goHome()
},
getUpdateManager() {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新版本下载失败
})
},
onShow(options) {
this.getUpdateManager()
let query = Object.keys(options.query)
if (query.length) query.map(e => {
let params = decodeURIComponent(e).split('&')
params.map(i => {
let [key, val] = i.split('=')
if (!val) val = options.query[key]
this.setPageParmas({
[key]: val
})
})
})
else {
if (this.autoLogin) return
this.login()
}
},
setPageParmas(query) {
if (query.merchantId) util.setStorageSync('srcm_shopmall_merchant_id', query.merchantId)
if (query.customerId) util.setStorageSync('srcm_shopmall_customer_id', query.customerId)
let storeCode = query.storeCode || util.filterUrlParam(decodeURIComponent(query.scene))['storeCode']
if (query.scene) {
let scene = decodeURIComponent(query.scene)
let [key, val] = scene.split('=')
if (key == 'storeCode') {
this.getGHMerchant(val)
return
}
shopmallApi.getLiveActivityId({
id: val
}).then(({
code,
data,
}) => {
if (code == 0) {
let op = {}
data.scene.split('&').map(item => {
const [key, val] = item.split("=")
op[key] = val
})
if (op.merchantId) util.setStorageSync('srcm_shopmall_merchant_id', op.merchantId)
if (op.openId) this.openId = op.openId
if (op.storeCode) this.getGHMerchant(op.storeCode)
if (op.packageType==1&&op.id) util.setStorageSync('packageId', +op.id)
}
})
return
}
if (storeCode) {
this.getGHMerchant(storeCode)
return
}
if (query.merchantId) {
util.setStorageSync('srcm_shopmall_merchant_id', query.merchantId)
this.login()
return
}
},
getGHMerchant(storeCode, callBack) {
util.setStorageSync('srcm_shopmall_store_code', storeCode)
commonApi.getBySapCode({
sapCode: storeCode
}).then(({
code,
data
}) => {
if (code == '0') util.setStorageSync('srcm_shopmall_merchant_id', data.merchantNo)
if (this.openId) {
this.loginByOpenId(this.openId, data)
return
}
this.login().then(res => {
if (callBack) callBack(res)
})
})
},
login(returnResponse) {
return new Promise(async (resolve, reject) => {
try {
const res = await userApi.login()
wx.$isGroup = res.data.group
wx.$authStatus = res.code != 0
if (res && res.data) {
this.globalData.openId = res.data.openId
if (res.data.sapCode) util.setStorageSync('srcm_shopmall_store_code', res.data.sapCode)
}
if (returnResponse) {
resolve(res)
} else {
if (res.data) wx.setStorageSync('merchant_info', {
merchantId: res.data.merchantId,
merchantName: res.data.merchantName,
sapCode: res.data.sapCode || '',
})
if (res.code != -1) {
if (res.code == 0) {
util.setUserInfo(res.data)
util.setSessionId(res.data.sessionId)
let customerId = util.getStorageSync('srcm_shopmall_customer_id')
let merchantId = util.getStorageSync('srcm_shopmall_merchant_id')
if (customerId) {
ssoApi.updataCustomerPhone({
customerId,
merchantId
}).then(() => {
wx.removeStorageSync('srcm_shopmall_customer_id')
})
}
// 登录完加载权益会员信息接口(目前只针对权益商品页面)
util.customerbehavior() // sop埋点
eventbus.emit('EQUITYGOODS', true)
wx.removeStorageSync('isShowPreModal')
} else {
util.showToast(res.message || '网络异常')
}
}
resolve(res)
}
} catch (error) {
wx.$authStatus = true
reject()
}
})
},
// 通过openId静默登录
loginByOpenId(openId, merchants) {
ssoApi.loginByOpenId({
openId
}).then(res => {
res.merchantId = merchants.merchantId
res.merchantName = merchants.merchantName
this.autoLogin = true
util.setUserInfo(res)
util.setSessionId(res.sessionId)
util.setStorageSync('showRevicesModal', true)
})
},
globalData: {
latesParam: {
appearance: 1,
pageSize: 0,
pageCount: 3,
},
loaded: false,
commodityList: []
// appId: '',
// merchantId: '44189923' // 44184606 44189923
},
onHide() {
util.customerbehavior(2)
}
})
\ No newline at end of file \ No newline at end of file
{
"pages": [
"pages/tab/index/index",
"pages/tab/equity/equity",
"pages/tab/discovery/discovery",
"pages/tab/mall/mall",
"pages/tab/mine/mine",
"pages/webView/webView",
"pages/h5Pay/h5Pay",
"pages/blank/blank",
"pages/relogin/relogin",
"pages/serviceCode/serviceCode",
"pages/psdView/psdView",
"pages/login/login",
"pages/visitorPage/visitorPage"
],
"requiredPrivateInfos": [
"getLocation"
],
"lazyCodeLoading": "requiredComponents",
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#979899",
"selectedColor": "#FC5B32",
"backgroundColor": "#FFFFFF",
"borderStyle": "white",
"list": [
{
"pagePath": "pages/tab/index/index",
"text": "首页",
"iconPath": "images/home.png",
"selectedIconPath": "images/home_active.png",
"rootName": "packageIndex"
},
{
"pagePath": "pages/tab/equity/equity",
"text": "权益",
"iconPath": "images/equity.png",
"selectedIconPath": "images/equity_active.png",
"rootName": "packageEquity"
},
{
"pagePath": "pages/tab/mall/mall",
"text": "商城",
"iconPath": "images/mall.png",
"selectedIconPath": "images/mall_active.png",
"rootName": "packageMall"
},
{
"pagePath": "pages/tab/mine/mine",
"text": "我的",
"iconPath": "images/mine.png",
"selectedIconPath": "images/mine_active.png",
"rootName": "packageMine"
}
]
},
"subpackages": [
{
"root": "packageIndex",
"pages": [
"pages/search/search",
"pages/live/live",
"pages/activity/index/index",
"pages/cgacarCommon/aboutUs/aboutUs",
"pages/navigation/navigation",
"pages/storeCoupons/storeCoupons",
"pages/reservation/index/index",
"pages/reservation/success/success",
"pages/reservation/merchantList/merchantList",
"pages/gps/index/index",
"pages/gps/bind/bind",
"pages/gps/info/info",
"pages/gps/path/path",
"pages/gps/pathDetail/pathDetail",
"pages/gps/myCar/myCar",
"pages/newCars/index/index",
"pages/newCars/enquiry/enquiry",
"pages/newCars/carDetail/carDetail",
"pages/newCars/appointment/appointment",
"pages/newCars/carSeries/carSeries",
"pages/road/digital/digital",
"pages/common/contact/contact",
"pages/agreement/agreement"
]
},
{
"root": "packageEquity",
"pages": [
"pages/subpage/subpage",
"pages/freecard/freecard",
"pages/package/package",
"pages/success/success",
"pages/active/active",
"pages/reviceVip/reviceVip",
"pages/jobDetail/jobDetail",
"pages/serviceList/serviceList",
"pages/goodsList/goodsList",
"pages/noPay/noPay",
"pages/allEquity/allEquity",
"pages/commodity/detail/detail",
"pages/commodity/list/list",
"pages/commodity/charge/charge",
"pages/open/open",
"pages/agreement/index",
"pages/packageDetail/packageDetail",
"pages/commodity/chargeDetail/chargeDetail",
"pages/kaqDetail/kaqDetail",
"pages/saleApply/saleApply",
"pages/saleDetail/saleDetail",
"pages/chargeWait/chargeWait",
"pages/directional/directional",
"pages/road/index/index",
"pages/road/roadInfo/roadInfo",
"pages/note/note",
"pages/tire/tire",
"pages/introduce/introduce",
"pages/vipPackage/vipPackage",
"pages/oil/oil",
"pages/keyboard/keyboard",
"pages/newEquity/index",
"pages/serviceApply/serviceApply",
"pages/claimsNote/claimsNote",
"pages/claimsNoteDetail/claimsNoteDetail",
"pages/signature/signature",
"pages/fullSignture/fullSignture"
],
"plugins": {
"ty-plugin": {
"version": "1.2.4",
"provider": "wx1f1ea04b716771be"
}
}
},
{
"root": "packageMall",
"pages": [
"pages/commentDetails/commentDetails",
"pages/addComment/addComment",
"pages/comment/comment",
"pages/detail/detail",
"pages/search/search",
"pages/shoppingCart/shoppingCart",
"pages/pay/pay",
"pages/coupon/coupon"
]
},
{
"root": "packageMine",
"pages": [
"pages/counselor/index/index",
"pages/address/index/index",
"pages/address/detail/detail",
"pages/setting/index/index",
"pages/vehicleInfo/index/index",
"pages/vehicleInfo/carBrandList/carBrandList",
"pages/coupon/index/index",
"pages/order/index/index",
"pages/order/detail/detail",
"pages/order/complete/complete",
"pages/order/afterSale_step_one/afterSale_step_one",
"pages/order/afterSale_step_two/afterSale_step_two",
"pages/order/afterSale_step_three/afterSale_step_three",
"pages/order/afterSaleDetail/afterSaleDetail",
"pages/coupon/success/success",
"pages/coupon/center/center",
"pages/coupon/detail/detail",
"pages/GHVehicleInfo/index/index",
"pages/GHVehicleInfo/list/list",
"pages/reservation/index/index",
"pages/boutique/index/index",
"pages/boutique/gift/gift",
"pages/boutique/detail/detail",
"pages/boutiquePages/index/index",
"pages/boutiquePages/detail/detail",
"pages/boutiquePages/boutiqueOrder/boutiqueOrder",
"pages/coupon/recommend/recommend",
"pages/coupon/failed/failed",
"pages/mineAgree/index/index"
]
}
],
"usingComponents": {
"upload": "/components/Upload/Upload",
"coupon-goods": "/components/CouponGoods/CouponGoods",
"store": "/components/Store/Store",
"marquee": "components/Marquee/Marquee",
"tab-view": "components/TabView/TabView",
"authorize": "components/Authorize/Authorize",
"gl-textarea": "/components/GlTextarea/GlTextarea",
"navigation-bar": "/components/NavigationBar/NavigationBar",
"search-box": "/components/SearchBox/SearchBox",
"goods": "/components/Goods/Goods",
"activity": "/components/Activity/Activity",
"tab": "/components/Tab/Tab",
"live": "/components/Live/Live",
"posts": "/components/Posts/Posts",
"goods-action": "/components/GoodsAction/GoodsAction",
"sku": "/components/Sku/Sku",
"stepper": "/components/Stepper/Stepper",
"gh-car-card": "/components/GHCarCard/GHCarCard",
"popup": "/components/Popup/Popup",
"search-input": "/components/SearchInput/SearchInput",
"index-list": "/components/IndexList/IndexList",
"login": "/components/Login/Login",
"license-plate": "/components/LicensePlate/LicensePlate",
"calendar": "/components/Calendar/Calendar",
"merchant-list": "../../../../components/MerchantList/MerchantList",
"various-pop": "/components/VariousPop/VariousPop",
"visitor-component":"/components/VisitorComponent/VisitorComponent",
"glsx-privacy": "glsx-applet-component/GlsxPrivacy/index"
},
"style": "v2",
"sitemapLocation": "sitemap.json",
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"plugins": {},
"__usePrivacyCheck__": true
}
\ No newline at end of file \ No newline at end of file
@import "./common.wxss";
@import "./sprite.wxss";
page {
background-color: #F7F7F7;
color: #282829;
font-size: 28rpx;
--themeColor: #F13C3D;
--btnColor: #FC5B32;
--borderRadius: 8rpx;
--margin: 32rpx;
}
image {
width: 100%;
height: 100%;
vertical-align: top;
}
.icon-mine-arrow {
width: 16rpx !important;
height: 28rpx !important;
transform: translateY(7rpx);
}
\ No newline at end of file \ No newline at end of file
/**app.wxss**/
.sticky {
position: sticky;
top: 0;
left: 0;
z-index: 2;
background-color: #fff;
}
.flex {
display: flex;
align-items: center;
}
.y-center {
top: 50%;
transform: translateY(-50%);
}
.x-center {
left: 50%;
transform: translateX(-50%);
}
.box-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-two-line {
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.isFullSucreen {
/* padding-bottom: 34px !important; */
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
.isFullSucreen-bottom {
bottom: constant(safe-area-inset-bottom) !important;
bottom: env(safe-area-inset-bottom) !important;
}
.default-btn {
width: 686rpx;
height: 88rpx;
background: var(--btnColor);
border-radius: var(--borderRadius);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: var(--margin);
}
.list-nothing {
width: 100%;
padding: 8rpx 0 30rpx;
text-align: center;
font-size: 28rpx;
color: #C1C2C3;
}
.list-nothing .icon {
width: 320rpx;
height: 320rpx;
}
.list-not {
display: flex;
align-items: center;
justify-content: center;
color: #999;
font-size: 24rpx;
height: 100%;
}
@keyframes show-box {
0% {
opacity: 0;
transform: scale(2.5);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes show-box-opacity {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
\ No newline at end of file \ No newline at end of file
// components/Activity/Activity.js
import {
componentsMixin,
countdownMixin
} from '../../mixins/index'
Component({
behaviors: [componentsMixin, countdownMixin],
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object,
observer: function (n) {
if (n) {
n.price = wx.$util.centsToyuan(n.activityPrice)
if (n.price >= 10000) {
n.price = Number(n.price / 10000).toFixed(2)
n.unit = '万'
}
this.setData({
i: n
})
this.countDown({
timer: [n.startTime, n.endTime],
targetObject: {
name: 'i',
key: 'activityStatus'
}
})
}
}
}
},
/**
* 组件的初始数据
*/
data: {},
attached() {
},
/**
* 组件的方法列表
*/
methods: {
jump(e) {
let {
id
} = e.currentTarget.dataset
wx.$router.go('packageMall.detail', {
id,
isActivity: true,
notIntercept: true
})
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<block wx:if="{{i}}">
<view class="item activity" bindtap="jump" data-id="{{i.id}}">
<view class="img">
<image webp src="{{i.activityImg}}"></image>
</view>
<view class="info">
<view class="title text-two-line">{{i.promotion}}</view>
<block wx:if="{{i.activityStatus == 2 && timeFlag}}">
<view class="time-box">
<view class="activity-time">
<image class="icon" webp src="{{IMGURL}}mall/ms.png?v={{img_version}}"></image>
<view class="activity-title">倒计时:</view>
<view class="time">
{{activityTime.day || ''}}
<block wx:for="{{activityTime.dayList}}" wx:key="index">
{{item}}
<view class="unit" wx:if="{{index < 2}}">:</view>
</block>
</view>
</view>
</view>
</block>
<view class="price-box">
<view class="price">
<view class="num ">
<text class="unit">¥</text>{{i.price}}<text wx:if="{{i.unit}}" class="unit up">{{i.unit}}</text>
</view>
</view>
<view class="text text-center">秒杀</view>
</view>
</view>
</view>
</block>
\ No newline at end of file \ No newline at end of file
.item {
border-radius: 8rpx;
width: 314rpx;
/* min-height: 520rpx; */
margin-bottom: 32rpx;
position: relative;
overflow: hidden;
transition: all .5s;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.item .img {
width: 100%;
height: 324rpx;
}
.item .info {
padding: 20rpx 22rpx 24rpx 24rpx;
background: #F7F8FA;
}
.item .title {
width: 100%;
box-sizing: border-box;
font-size: 28rpx;
color: #282829;
line-height: 40rpx;
max-height: 80rpx;
word-break: break-all;
}
.text-two-line {
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.item .price-box {
margin-top: 20rpx;
width: 100%;
height: 64rpx;
position: relative;
border-radius: 8rpx;
overflow: hidden;
background: #FCECD1;
font-weight: 500;
}
.item .price-box .price {
position: absolute;
width: calc(100% - 76rpx);
height: 100%;
left: 0;
top: 0;
clip-path: polygon(0% 0%, 100% 0, 90% 50%, 100% 100%, 0% 100%);
background-image: linear-gradient(270deg, #F8532F 10%, #F13A37 100%);
border-radius: 8rpx 2rpx 2rpx 2rpx 8rpx;
display: flex;
align-items: center;
}
.item .price-box .price .num {
color: #fff;
font-size: 32rpx;
box-sizing: border-box;
padding-left: 20rpx;
display: flex;
align-items: baseline;
}
.item .price-box .price .num .unit {
font-size: 20rpx;
margin-right: 4rpx;
}
.item .price-box .price .num .up {
transform: translateY(-2rpx);
}
.item .price-box .text {
width: 76rpx;
height: 100%;
font-size: 28rpx;
color: #F23D36;
margin-left: auto;
}
.time-box {
border-radius: 20rpx;
background-image: linear-gradient(180deg, #F13A37 50%, #F8532F 100%);
padding: 2rpx;
overflow: hidden;
margin-top: 16rpx;
animation: show-activity-time .5s forwards;
}
.activity-time {
display: flex;
align-items: center;
font-size: 20rpx;
color: #F44335;
padding: 4rpx 11rpx;
background-color: #F7F8FA;
border-radius: 19rpx;
overflow: hidden;
}
.activity-time .icon{
width: 26rpx;
height: 24rpx;
margin-right: 7rpx;
flex-shrink: 0;
}
@keyframes show-activity-time {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.activity-time .time {
display: flex;
align-items: center;
flex-shrink: 0;
}
// components/Authorize/Authorize.js
import {
componentsMixin
} from '../../mixins/index'
Component({
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
properties: {
scopeType: String,
/**是否自动打开 */
autoOpen: Boolean,
show: Boolean,
title: {
type: String,
value: '是否打开授权设置?'
},
confirmText: {
type: String,
value: '确定'
},
cancelText: {
type: String,
value: '取消'
},
buttonType: String,
confirmColor: String,
cancelColor: String,
isShowCheck: {
type: Boolean,
value: true
},
init: {
type: Boolean,
observer(n) {
if (n) this.check()
}
}
},
observers: {
'show': function (newVal) {
this.setData({
openSet: newVal
})
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
/**
* 禁止滑动
*/
noScroll: wx.$util.noScroll(),
cancel(e) {
let {
confirm
} = e.currentTarget.dataset
let {
buttonType,
title
} = this.data
let _this = this
if (buttonType == 'getUserInfo' && confirm) {
wx.getUserProfile({
desc: title,
success(res) {
_this.triggerEvent('success', {
message: '授权成功',
data: res
})
}
})
}
this.setData({
openSet: false
})
this.triggerEvent('cancel')
},
/**检验是否已授权位置 */
check() {
const _this = this
let {
buttonType,
scopeType,
autoOpen
} = this.properties
if (buttonType != 'getPhoneNumber') {
let type = `scope.${scopeType}`
buttonType = 'openSetting'
if (type === 'scope.userInfo') buttonType = 'getUserInfo'
this.setData({
buttonType
})
wx.getSetting({
success(res) {
if (!res.authSetting[type]) {
wx.authorize({
scope: type,
success() {
_this.triggerEvent('success', {
message: '授权成功'
})
},
fail() {
_this.triggerEvent('fail', {
message: '未授权'
})
if (autoOpen) {
_this.setData({
openSet: true
})
}
}
})
} else {
_this.triggerEvent('success', {
message: '已授权'
})
}
}
})
}
},
/**授权手机号 */
getPhoneNumber({
detail
}) {
console.log(detail)
this.triggerEvent('getphonenumber', detail)
}
},
pageLifetimes: {
show: function () {
if (this.data.isShowCheck || this.data.init) this.check()
},
hide: function () {}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class="open-seting-bg text-center" wx:if="{{openSet}}" catchtap="cancel" catchtouchmove="noScroll">
<view class="open-set-inner">
<view class="set-title"><text>{{title}}</text></view>
<view class="btn-openset">
<view catchtap="cancel" class="btn text-center" style="color:{{cancelColor}};">{{cancelText}}</view>
<view class="btn text-center" style="color:{{confirmColor}};">
{{confirmText}}
<block wx:if="{{buttonType == 'getPhoneNumber'}}">
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" class="button-style"></button>
</block>
<block wx:else>
<button open-type="{{buttonType}}" class="button-style" catchtap="cancel" data-confirm></button>
</block>
</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/Authorize/Authorize.wxss */
.open-seting-bg {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 998;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.open-set-inner {
width: 564rpx;
height: 400rpx;
background: #FFFFFF;
border-radius: 16px;
}
@keyframes show-auth-box {
0% {
opacity: 0;
transform: scale(2);
}
100% {
opacity: 1;
transform: scale(1);
}
}
.set-title {
font-size: 36rpx;
min-height: 286rpx;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
flex-direction: column;
}
.btn-openset {
display: flex;
font-size: 36rpx;
height: 112rpx;
border-top: 2rpx solid #E5E5E5;
font-weight: 500;
letter-spacing: 1rpx;
}
.btn {
flex: 1;
height: 100%;
position: relative;
}
.button-style {
position: absolute;
width: 100% !important;
height: 100%;
box-sizing: border-box;
opacity: 0;
top: 0;
left: 0;
}
\ No newline at end of file \ No newline at end of file
// components/Calendar/Calendar.js
import Calendar from './Calendar_Function'
import _component_ from './Static_Properties'
const CalendarFunction = Symbol('CalendarFunction')
import {componentsMixin } from '../../mixins/index'
Component({
behaviors:[componentsMixin],
/**
* 组件的属性列表
*/
properties: _component_.properties,
/**
* 组件的初始数据
*/
data: _component_.data,
/**
* 组件的方法列表
*/
methods: {
noScroll() {},
setCalenderBodyHeight() {
this[CalendarFunction].setCalenderBodyHeight()
},
showCalendar(e) {
let type = e && e.currentTarget && e.currentTarget.dataset.type || ''
let result = type === 'show'
if (!result) {
this.setData({
hideCalendar: true
})
setTimeout(() => {
this.setData({
show: result,
hideCalendar: false
})
}, 300)
} else {
this.setData({
show: result
})
if (!this.data.calenderBodyHeight) this[CalendarFunction].setCalenderBodyHeight()
}
},
dateChange(e) {
let {
current
} = e.detail
this.setData({
current
})
},
choose(e) {
let {
dateType,
minDate,
maxDate
} = this.data
let {
data
} = e.currentTarget.dataset
if ((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data))) return
this[CalendarFunction][dateType](e)
},
done() {
let {
dateType
} = this.data
this[CalendarFunction].done(dateType)
},
changeDate(e) {
let { value } = e.detail
this.setData({
current: value
})
},
showShortcutPicker() {
this.setData({
showShortcut: !this.data.showShortcut
})
},
chooseAll() {
this[CalendarFunction].chooseAll()
}
},
attached() {
this[CalendarFunction] = new Calendar(this)
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='calender-picker' bindtap="showCalendar" data-type='show'>
<slot></slot>
</view>
<!-- 弹框模式 -->
<view class='calender-box' hidden='{{!show}}' catchtouchmove="noScroll">
<view class='calender-bg' bindtap="showCalendar"></view>
<view class='calender-view {{hasRadius}} {{hideCalendar?"hideCalendar":""}} {{!showConfirm?"isFullSucreen":""}}' style="height:{{height}}">
<view class='calender-header'>
<view class='calender-title' wx:if='{{showTitle}}'>
<block wx:if="{{rangeAll && dateType == 'range'}}">
<view class="calender-all" style="color:{{calenderColor}};" bindtap="chooseAll">全选</view>
</block>
{{title||'日期选择'}}
<view class='calender-close' bindtap="showCalendar">
<image webp src="./images/close.png?v={{img_version}}" class='calender-close-image'></image>
</view>
</view>
<block wx:if='{{showSubTitle}}'>
<picker class='calender-subtitle' bindchange="changeDate" bindcancel='showShortcutPicker' value="{{current}}" range="{{dateList}}" wx:if='{{shortcut}}'>
<view class='calender-subtitle-text' bindtap="showShortcutPicker">
{{dateList[current]}}
<view class='arrow {{showShortcut}}'></view>
</view>
</picker>
<view class='calender-subtitle' wx:else>{{dateList[current]}}</view>
</block>
<view class='calendar-weekdays'>
<block wx:for='{{weekdays}}' wx:key='index'>
<view class='calendar-weekday'>{{item}}</view>
</block>
</view>
</view>
<view class='calender-body' style="height:calc(100% - {{calenderBodyHeight}})">
<swiper class='calender-swiper' bindchange='dateChange' current='{{current}}' vertical='{{vertical}}'>
<block wx:for='{{monthList}}' wx:key='index'>
<swiper-item>
<view class='calender-mark box-center' wx:if="{{!hideMark}}">{{item.mark}}</view>
<view class='calender-month'>
<block wx:for='{{item.data}}' wx:for-item='i' wx:for-index='ind' wx:key='ind'>
<view class='calender-day {{ind == 0?i.week:""}} {{i.active?"active":""}} {{i.disable?"disable":""}}' style="background:{{i.active?calenderColor:''}};color:{{i.middle?calenderColor:''}}" bindtap="choose" data-index='{{index}}' data-ind='{{ind}}' data-data='{{i.data}}'>
<view class='calender-middle' style="background:{{calenderColor}};" wx:if='{{i.middle}}'></view>
<view class='box-center text'>
{{i.day}}
<view wx:if='{{dateType==="range"}}' class='calender-tips'>
<view wx:if='{{i.start}}'>{{rangeText.start}}</view>
<view wx:if='{{i.end}}'>{{rangeText.end}}</view>
</view>
</view>
</view>
</block>
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class='calender-footer isFullSucreen' wx:if='{{showConfirm}}'>
<view class='calender-btn {{dateType === "range" && !rangeDate.end ?"disable":""}} {{dateType === "multiple" && multipleDate.length < 1 ?"disable":""}}' style="background:{{calenderColor}}" bindtap="done">
{{confirmText||'确定'}}
</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/Calendar/Calendar.wxss */
.calender-box {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 99;
}
.calender-bg {
position: absolute;
background: rgba(0, 0, 0, .5);
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.calender-view {
position: absolute;
left: 0;
width: 100%;
background: #fff;
animation: show-calender .5s forwards;
color: #333;
}
.calender-view.true {
border-radius: 40rpx 40rpx 0 0;
}
.calender-view.isFullSucreen {
box-sizing: border-box;
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
.isFullSucreen {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
@keyframes show-calender {
from {
bottom: -100%;
}
to {
bottom: 0;
}
}
.calender-view.hideCalendar {
animation: hide-calender .5s forwards;
}
@keyframes hide-calender {
from {
bottom: 0;
}
to {
bottom: -100%;
}
}
.calender-header {
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.10);
}
.calender-title,
.calender-subtitle {
width: 100%;
height: 88rpx;
text-align: center;
position: relative;
font-size: 32rpx;
display: flex;
align-items: center;
justify-content: center;
}
.calender-all {
position: absolute;
top: 50%;
left: 24rpx;
transform: translateY(-50%);
font-size: 20rpx;
}
.calender-subtitle-text {
display: flex;
align-items: center;
justify-content: center;
}
.calender-subtitle {
font-size: 28rpx;
}
.calender-subtitle .arrow {
width: 14rpx;
height: 14rpx;
border-top: 2rpx solid transparent;
border-right: 2rpx solid #ccc;
border-bottom: 2rpx solid #ccc;
border-left: 2rpx solid transparent;
transform: rotate(45deg) translateY(-4rpx);
margin-left: 16rpx;
transition: all .3s;
}
.calender-subtitle .arrow.true {
transform: rotate(225deg) translateY(0) translateX(-4rpx);
}
.calender-close {
position: absolute;
width: 40rpx;
height: 40rpx;
top: 50%;
right: 24rpx;
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
}
.calender-close-image {
width: 24rpx;
height: 24rpx;
}
.calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
font-size: 24rpx;
line-height: 60rpx;
}
.calendar-weekday {
text-align: center;
}
.calender-body {
width: 100%;
padding: 20rpx 0;
box-sizing: border-box;
}
.calender-swiper {
height: 100%;
}
.calender-mark {
color: rgba(0, 0, 0, .1);
text-shadow: 0 4rpx 20rpx rgba(0, 0, 0, .1);
font-size: 320rpx;
width: 100%;
text-align: center;
}
.box-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.calender-month {
height: 100%;
position: relative;
z-index: 1;
display: grid;
grid-template-rows: repeat(minmax(5, 6), 1fr);
grid-template-columns: repeat(7, 1fr);
}
.calender-day {
position: relative;
font-size: 32rpx;
display: flex;
}
.calender-day.active {
color: #fff;
border-radius: 8rpx;
}
.calender-day.disable {
opacity: .25;
}
.calender-day .calender-middle {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0.1;
}
.calender-day .text {
text-align: center;
width: 100%;
}
.calender-tips {
font-size: 14rpx;
}
.week-1 {
grid-column-start: 2;
}
.week-2 {
grid-column-start: 3;
}
.week-3 {
grid-column-start: 4;
}
.week-4 {
grid-column-start: 5;
}
.week-5 {
grid-column-start: 6;
}
.week-6 {
grid-column-start: 7;
}
.calender-footer {
position: absolute;
width: 100%;
left: 0;
bottom: 0;
padding: 14rpx 32rpx;
box-sizing: border-box;
}
.calender-footer.true {
padding-bottom: 34px !important;
}
.calender-footer .calender-btn {
width: 100%;
height: 72rpx;
font-size: 28rpx;
color: #fff;
border-radius: 8rpx;
display: flex;
justify-content: center;
align-items: center;
}
.calender-footer .calender-btn.disable {
opacity: .3;
}
\ No newline at end of file \ No newline at end of file
const _CalendarObject_ = Symbol('_CalendarObject_')
const _nowDate_ = Symbol('_nowDate_')
const _separator_ = Symbol('_separator_')
class Calendar {
[_CalendarObject_] = {};
[_nowDate_] = new Date();
[_separator_] = '-';
constructor(calendarObject) {
this[_CalendarObject_] = calendarObject
this[_separator_] = calendarObject.data.separator
this.setCalenderHeight()
this.setMonthList()
let {
weekdays,
firstDayOfWeek
} = calendarObject.data
let firstDay = weekdays[firstDayOfWeek - 1]
let [last, first] = weekdays.join('').split(firstDay)
calendarObject.setData({
weekdays: [firstDay, ...first, ...last]
})
}
/**设置日历高度 */
setCalenderHeight() {
let _this = this[_CalendarObject_]
let {
data: calenderHeight
} = _this
let height = '80%'
if (typeof calenderHeight === 'number') {
wx.$util.getPhoneInfo(res => {
let {
windowHeight
} = res
if (calenderHeight > windowHeight) calenderHeight = windowHeight
if (calenderHeight < windowHeight * 0.5) calenderHeight = windowHeight * 0.5
height = `${calenderHeight}px`
})
}
if (typeof calenderHeight === 'string') {
if (calenderHeight.includes('%')) {
height = calenderHeight
let [num] = calenderHeight.split('%')
if (num < 50) height = '50%'
if (num > 100) height = '80%'
} else {
if (calenderHeight < 50) calenderHeight = '50'
if (calenderHeight > 100) calenderHeight = '80'
height = `${calenderHeight}%`
}
}
_this.setData({
height
})
}
/**设置日期高度 */
setCalenderBodyHeight() {
let _this = this[_CalendarObject_]
wx.$util.getViewInfo('.calender-header', header => {
wx.$util.getViewInfo('.calender-footer', footer => {
let headerHeight = header.height
let footerHeight = footer && footer.height || 0
_this.setData({
calenderBodyHeight: `${headerHeight + footerHeight}px`
})
}, _this)
}, _this)
}
/**设置日期列表 */
setMonthList() {
let {
separator,
previous,
minDate,
maxDate,
next
} = this[_CalendarObject_].data
if (maxDate || minDate) {
if (!minDate) {
let nowMonth = new Date().getMonth()
minDate = new Date(new Date().setMonth(nowMonth - previous)).format(`yyyy${separator}MM${separator}dd`)
}
if (!maxDate) {
maxDate = this[_nowDate_].format(`yyyy${separator}MM${separator}dd`)
}
previous = this.getMonthDifference(minDate, this[_nowDate_].format(`yyyy${separator}MM${separator}dd`))
next = this.getMonthDifference(this[_nowDate_].format(`yyyy${separator}MM${separator}dd`), maxDate)
} else {
previous = previous < 0 ? 0 : previous
next = next < 0 ? 0 : next
}
let nowMonth = this[_nowDate_].getMonth()
let now = new Date().setDate(1)
for (let i = nowMonth - previous; i <= nowMonth + next; i++) {
this.init(new Date(now).setMonth(i))
}
}
/**初始化日期 */
init(date) {
let _this = this[_CalendarObject_]
let {
firstDayOfWeek,
allowSameDay,
multipleDate,
monthList,
rangeDate,
dateList,
dateType,
current,
minDate,
maxDate,
value,
} = _this.data
let separator = this[_separator_]
let [year, month] = new Date(date).format(`yyyy${separator}MM`).split(separator)
let days = this.getDayNumber(year, Number(month))
let week = new Date(year, Number(month) - 1, 1).getDay()
let dateFormat = `yyyy${separator}MM${separator}dd`
let today = value || this[_nowDate_].format(dateFormat)
let nextDay = ''
let arr = []
dateList.push(`${year}${separator}${month}`)
if (dateType === 'range') {
nextDay = new Date(new Date().setDate(new Date(new Date(today)).getDate() + 1)).format(dateFormat)
}
let [now_year, now_month, now_day] = today.split(separator)
let [next_year, next_month, next_day] = allowSameDay ? today.split(separator) : nextDay.split(separator)
for (let i = 1; i <= days; i++) {
let todayStr = `${year}${separator}${month}${separator}${now_day}`
let dayStr = `${year}${separator}${month}${separator}${i < 10 ? `0${i}`:i}`
let obj = {
day: i,
data: dayStr,
active: now_year == year && now_month == month && i == Number(now_day)
}
if ((minDate && Date.parse(minDate) > Date.parse(dayStr)) || (maxDate && Date.parse(maxDate) < Date.parse(dayStr))) obj.disable = true
if (dateType === 'multiple') multipleDate.push(todayStr)
if (nextDay) {
if (now_year == year && now_month == month && i == Number(now_day)) {
obj.start = true
rangeDate.start = todayStr
}
if (next_year == year && next_month == month && i == Number(next_day)) {
obj.active = true
obj.end = true
rangeDate.end = `${year}${separator}${next_month}${separator}${next_day}`
}
}
firstDayOfWeek = firstDayOfWeek == 7 ? 0 : firstDayOfWeek
if (i === 1) obj.week = `week-${week - firstDayOfWeek}`
arr.push(obj)
}
monthList.push({
data: arr,
mark: Number(month)
})
if (current <= 1) {
let [nowYear, nowMonth] = today.split(separator)
current = dateList.findIndex(e => e === `${nowYear}${separator}${nowMonth}`)
}
_this.setData({
multipleDate,
date: today,
rangeDate,
monthList,
dateList,
current
})
}
/**当设置最小日期或者最大日期时 自动设置前后月份 */
getMonthDifference(date1, date2) {
let separator = this[_separator_]
//获取年,月数
let [year1, month1] = date1.split(separator)
let [year2, month2] = date2.split(separator)
let months = (parseInt(year2) - parseInt(year1)) * 12 + (parseInt(month2) - parseInt(month1))
return months
}
/**单选 */
single(e) {
let _this = this[_CalendarObject_]
let {
index,
data,
ind
} = e.currentTarget.dataset
let {
showConfirm,
monthList
} = _this.data
monthList.map(x => {
x.data.map(i => i.active = false)
})
monthList[index].data[ind].active = true
_this.setData({
monthList,
date: data
})
if (!showConfirm) this.done()
}
/**多选 */
multiple(e) {
let _this = this[_CalendarObject_]
let {
index,
ind,
} = e.currentTarget.dataset
let {
monthList
} = _this.data
let arr = []
monthList[index].data[ind].active = !monthList[index].data[ind].active
monthList.map(x => x.data.map(i => {
if (i.active) arr.push(i.data)
}))
_this.setData({
[`monthList[${index}].data`]: monthList[index].data,
multipleDate: arr
})
}
/**范围选择 */
range(e) {
const _this = this[_CalendarObject_]
let {
index,
data,
ind
} = e.currentTarget.dataset
let {
allowSameDay,
showConfirm,
monthList,
rangeDate
} = _this.data
const start = Date.parse(rangeDate.start)
if (rangeDate.end || start > Date.parse(data)) {
monthList = this.clearStatus({
monthList,
index,
ind
})
rangeDate.start = data
rangeDate.end = ''
} else {
if (!allowSameDay && Date.parse(data) == Date.parse(rangeDate.start)) return
monthList[index].data[ind].active = true
monthList[index].data[ind].end = true
rangeDate.end = data
monthList.map(x => {
x.data.map(i => {
let day = Date.parse(i.data)
i.middle = day > start && day < Date.parse(data)
})
})
}
_this.setData({
monthList,
rangeDate
})
if (!showConfirm && rangeDate.end) this.done()
}
/**点击完成 */
done() {
let _this = this[_CalendarObject_]
let {
multipleDate,
rangeDate,
dateType,
date
} = _this.data
let targer = {
'single': date,
'multiple': multipleDate,
'range': rangeDate
}
if ((dateType === 'multiple' && multipleDate.length < 1) || (dateType === 'range' && !rangeDate.end)) return
_this.triggerEvent('select', {
date: targer[dateType]
})
_this.showCalendar()
}
/**清空范围选择状态 */
clearStatus(params) {
let {
monthList,
index,
ind
} = params
monthList.map(x => x.data.map(i => {
i.active = false
i.start = false
i.end = false
i.middle = false
}))
monthList[index].data[ind].active = true
monthList[index].data[ind].start = true
return monthList
}
/**
* 获取月份天数
*/
getDayNumber(year, month) {
let days = 31
switch (month) {
case 2:
days = (year % 4 == 0 && year % 100 !== 0) || year % 400 == 0 ? 29 : 28
break;
case 4:
case 6:
case 9:
case 11:
days = 30
break;
}
return days
}
/**日期范围 点击全选 */
chooseAll() {
let _this = this[_CalendarObject_]
let {
monthList,
minDate,
maxDate
} = _this.data
monthList.map((e, index) => {
e.data.map((i, ind) => {
let obj = {
currentTarget: {
dataset: {
index,
ind,
data: i.data
}
}
}
if (i.data == minDate) this.range(obj)
if(i.data == maxDate) this.range(obj)
})
})
}
}
export default Calendar
\ No newline at end of file \ No newline at end of file
export default {
properties: {
calenderHeight: {
type:String
// type: [String,Number], 企微暂不支持
},
title: String, // 标题名称
hasRadius: {
type: Boolean,
value: true
}, // 是否圆角
showTitle: {
type: Boolean,
value: true
}, // 是否显示标题
showSubTitle: {
type: Boolean,
value: true
}, // 是否显示副标题
confirmText: String, // 确定按钮文本
showConfirm: {
type: Boolean,
value: true
}, // 是否显示确定按钮
calenderColor: {
type: String,
value: '#FC5B32'
}, // 日历主题色
previous: {
type: Number,
value: 3
}, // 当前月的前几个月 ,默认3个月
next: {
type: Number,
value: 3
}, // 当前月的后几个月 , 默认3个月
vertical: Boolean, //是否纵向滑动
/** 选择类型默认单选,single 单选, multiple多个日期,range日期范围 */
dateType: {
type: String,
value: 'single'
},
value: String, //单选绑定数据
shortcut: Boolean, //日期快捷切换 默认为false
/** 分隔符,默认为 "-" */
separator: {
type: String,
value: '-'
},
/** 日期范围-开始结束文本 */
rangeText: {
type: Object,
value: {
start: '开始',
end: '结束'
}
},
/**是否显示日期范围 全选 */
rangeAll: Boolean,
/** 是否允许日期范围的起止时间为同一天, 默认为false */
allowSameDay: Boolean,
/** 周起始日,默认周日 */
firstDayOfWeek: {
type: Number,
// type: [Number, String], 企微暂不支持
value: 7
},
/**
* 可选最小日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致。 */
minDate: String,
/** 可选最大日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致 */
maxDate: String,
/**隐藏水印 */
hideMark: Boolean
},
data: {
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
monthList: [],
dateList: [],
current: 0,
height: '80%',
rangeDate: {},
multipleDate: []
}
}
\ No newline at end of file \ No newline at end of file
// components/CarBrands/CarBrands.js
import {
shopmallApi
} from '../../api/api'
import {
defaultMerchantId
} from '../../api/environment'
import {componentsMixin } from '../../mixins/index'
Component({
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
observer: function (n) {
if (n) setTimeout(() => {
}, 0.5 * 1000)
}
},
only: {
type: Boolean,
value: true
},
couponData: {
type: Object,
observer(n) {
if (n.length > 0) this.setData({
noData: true
})
return n
}
},
order: {
type: Number
},
defaultData: String
},
observers: {
'couponData': function (newVal) {
return newVal
}
},
/**
* 组件的初始数据
*/
data: {
noData: false
},
/**
* 组件的方法列表
*/
methods: {
getCoupon(e) {
let merchantId = wx.$util.getStorageSync('srcm_shopmall_merchant_id')
let {
item
} = e.currentTarget.dataset;
wx.$util.showLoading('领取中...')
shopmallApi.getCoupon({
couponIdList: [item.couponId],
receiveWay: 1,
receiveSource: 3,
merchantId: Number(merchantId) || defaultMerchantId
}).then(({
code,
data,
message
}) => {
console.log(data)
wx.hideLoading()
if (code == '0') {
wx.showToast({
title: '领取成功',
icon: 'none'
})
let thisPage = wx.$router.getPageInstance()
if (thisPage.getGoodscouponList) thisPage.getGoodscouponList()
}
})
},
// 更换优惠券
selectCoupon(e) {
let {
index
} = e.currentTarget.dataset;
for (let i = 0; i < this.data.couponData.length; i++) {
if (index == i) {
this.data.couponData[i].isChecked = !this.data.couponData[i].isChecked
} else {
this.data.couponData[i].isChecked = false
}
this.setData({
couponData: this.data.couponData
})
}
},
//确认
confirm() {
this.triggerEvent('click', this.data.couponData)
this.setData({
couponData: this.data.couponData
})
}
},
lifetimes: {
attached() {
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<popup title="优惠详情" model:show="{{show}}" only="{{only}}" bindconfirm="confirm" height="75%">
<view class="coupon-box">
<view class="box">
<scroll-view style="height:100%;" scroll-y>
<block wx:if="{{noData}}">
<view class="coupon-wrap" wx:for="{{couponData}}" wx:key="index">
<view class="left_icon_box">
<image webp wx:if="{{true}}" class="left_bg" src="{{IMGURL}}coupons/coupons_active.png?v={{img_version}}" />
<image webp wx:else class="left_bg" src="{{IMGURL}}coupons/coupons.png?v={{img_version}}" />
<view class="left_text_one left_text_two">
<text class="price_icon">¥</text>
<text>{{(item.denomination)/100}}</text>
</view>
<view class="left_text_five left_text_three" wx:if="{{item.full}}">满{{(item.full)/100}}可用</view>
</view>
<view class="main_box">
<view class="title_text">{{item.couponName}}</view>
<view class="h4_text" wx:if="{{item.useBarriers == 1}}">无限制</view>
<view class="h4_text" wx:if="{{item.useBarriers == 2}}">满减</view>
<!-- 未领取,effectiveType == 1,就显示effectiveDays有效,effectiveType == 2 显示时间段,effectiveType == 3 无限制 -->
<view class="h4_text drive" wx:if="{{item.couponStatus == 0&&item.effectiveType == 1}}">领取后{{item.effectiveDays}}天内有效</view>
<view class="h4_text drive" wx:if="{{item.couponStatus == 0&&item.effectiveType == 2}}">{{item.effectiveStartTime}}-{{item.effectiveEndTime}}</view>
<view class="h4_text drive" wx:if="{{item.couponStatus == 0&&item.effectiveType == 3}}">无期限</view>
<!-- 已领取,effectiveType == 1 或者2,都显示时间段,effectiveType == 3 无限制 -->
<view class="h4_text drive" wx:if="{{item.couponStatus == 1&&item.effectiveType == 1||item.couponStatus == 1&&item.effectiveType == 2 }}">{{item.effectiveStartTime}}-{{item.effectiveEndTime}}</view>
<view class="h4_text drive" wx:if="{{item.couponStatus == 1&&item.effectiveType == 3}}">无期限</view>
</view>
<block wx:if="{{order == 0}}">
<view class="box_btn box_btn_color" bindtap="toDetail" wx:if="{{item.couponStatus == 0&&item.residueAmount >0}}" data-item="{{item}}" bindtap="getCoupon">领取</view>
<view class="box_btn_color_been_gray " bind:tap="toDetail" wx:elif="{{item.couponStatus != 1&&item.residueAmount ==0}}">已抢光</view>
<view class="box_btn_color_been" bind:tap="toDetail" wx:elif="{{item.couponStatus == 1}}">已领取</view>
<view class="already" wx:if="{{item.couponStatus == 1}}">
<image webp src="{{IMGURL}}coupons/been.png?v={{img_version}}" />
</view>
</block>
<block wx:else>
<view class="circle-selected" data-item="{{item}}" data-index="{{index}}" wx:if="{{item.isChecked}}" bindtap="selectCoupon">
<image webp src="{{IMGURL}}coupons/select.png?v={{img_version}}" />
</view>
<view class="noSelect" data-item="{{item}}" data-index="{{index}}" wx:if="{{!item.isChecked}}" bindtap="selectCoupon"></view>
</block>
</view>
</block>
<!-- <block>
<view class="dissatisfy">以下不满足使用条件</view>
<view class="coupon-wrap gray" >
<view class="left_icon_box">
<image webp class="left_bg" src="../../packageMall/images/coupons.png?v={{img_version}}" />
<view class="left_text_one left_text_two">
<text class="price_icon">¥</text>
<text>50</text>
</view>
<view class="left_text_five left_text_three">满99可用</view>
</view>
<view class="main_box">
<view class="title_text">优惠券名称</view>
<view class="h4_text">满300减50,仅限会场商品</view>
<view class="h4_text drive">无限期</view>
</view>
<view class="circle-gray"></view>
<view class="reason">不可用原因:仅可购买XXX商品A</view>
</view>
</block> -->
</scroll-view>
</view>
</view>
<view wx:if="{{!noData}}" class="no_data">
<image webp class="nodata_bg" src="{{IMGURL}}coupons/no_card_bg.png?v={{img_version}}" />
<view class="nodata_text">暂无优惠券</view>
</view>
</popup>
\ No newline at end of file \ No newline at end of file
/* components/CarBrands/CarBrands.wxss */
.coupon-wrap {
width: 686rpx;
height: 196rpx;
background: rgba(252, 91, 50, 0.05);
border-radius: 8rpx;
box-sizing: border-box;
padding: 20rpx;
display: flex;
align-items: center;
position: relative;
margin-top: 24rpx;
}
.gray {
width: 686rpx;
height: 196rpx;
background: rgba(201, 202, 204, 0.1) !important;
border-radius: 8rpx;
box-sizing: border-box;
padding: 20rpx;
display: flex;
align-items: center;
position: relative;
margin-top: 24rpx;
}
.left_icon_box {
width: 156rpx;
height: 156rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
}
.left_bg {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 156rpx;
height: 156rpx;
z-index: 1;
}
.left_text_one {
font-size: 36rpx;
font-weight: 600;
color: #FFFFFF;
z-index: 2;
}
.left_text_two {
display: flex;
align-items: flex-end;
}
.left_text_four {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.left_text_three {
font-size: 28rpx;
margin-top: 6rpx;
width:156rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
text-align: center;
}
.left_text_five {
font-size: 28rpx;
color: #FFFFFF;
z-index: 2;
}
.anText {
font-size: 70rpx;
/* color: rgba(white, white, white, 0.45); */
font-weight: 600;
color: #FFF;
opacity: 0.45;
}
.price_icon {
font-size: 20rpx;
margin-right: 4rpx;
margin-bottom: 7rpx;
}
.main_box {
height: 156rpx;
box-sizing: border-box;
padding: 4rpx 0 4rpx 20rpx;
}
.box_btn {
position: absolute;
right: 20rpx;
top: 50%;
transform: translate(0, -50%);
width: 132rpx;
height: 50rpx;
background: #B1B1B3;
border-radius: 22rpx;
color: #FFF;
font-size: 20rpx;
text-align: center;
line-height: 50rpx;
}
.box_btn_color {
background: var(--btnColor);
color: #FFFFFF;
}
.box_btn_color_grey {
background: #B1B1B3;
}
.title_text {
color: #282829;
font-weight: 600;
color: #282829;
font-size: 28rpx;
width: 420rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.box_btn_color_been {
font-size: 28rpx;
font-weight: 400;
color: #FC5B32;
line-height: 40rpx;
white-space: nowrap;
position: absolute;
right: 20rpx;
top: 50%;
transform: translate(0, -50%);
}
.h4_text {
font-weight: 400;
color: #B1B1B3;
font-size: 24rpx;
}
.drive {
margin-top: 38rpx;
}
.y-center {
display: flex;
align-items: center;
}
.no_data {
padding-top: 48rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.nodata_bg {
width: 320rpx;
height: 320rpx;
}
.nodata_text {
color: #B1B1B3;
font-size: 28rpx;
line-height: 44rpx;
margin-top: 8rpx;
}
.already {
width: 75rpx;
height: 74rpx;
position: absolute;
bottom: 0;
right: 0;
z-index: 99;
}
.dissatisfy {
font-size: 28rpx;
font-weight: 500;
color: #282829;
line-height: 44rpx;
margin-top: 32rpx;
}
.circle-gray {
width: 40rpx;
height: 40rpx;
background: #E3E3E6;
border: 2rpx solid rgba(177, 177, 179, 1);
border-radius: 50%;
}
.reason {
width: 686rpx;
height: 60rpx;
background: rgba(253, 194, 62, 0.06);
font-size: 24rpx;
font-weight: 400;
color: #F13C3D;
line-height: 60rpx;
padding: 0 20rpx;
box-sizing: border-box;
position: absolute;
bottom: -60rpx;
left: 0;
}
.reason::before {
content: '!';
width: 28rpx;
height: 28rpx;
border: 1rpx solid #F13C3D;
color: #F13C3D;
box-sizing: border-box;
border-radius: 50%;
display: inline-block;
text-align: center;
line-height: 24rpx;
margin-right: 12rpx;
}
.circle-selected {
width: 40rpx;
height: 40rpx;
}
.noSelect {
width: 40rpx;
height: 40rpx;
background: #ffffff;
border: 2rpx solid rgba(177, 177, 179, 1);
border-radius: 50%;
}
.box{
height:55vh;
overflow-y: scroll;
padding-bottom: 50rpx;
-webkit-overflow-scrolling: touch;
}
.box_btn_color_been_gray{
font-size: 28rpx;
font-weight: 400;
color: #B1B1B3;
line-height: 40rpx;
white-space: nowrap;
position: absolute;
right: 20rpx;
top: 50%;
transform: translate(0, -50%);
}
\ No newline at end of file \ No newline at end of file
import {
couponsApi
} from "../../api/api"
const baseImgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/cgacar/'
import {componentsMixin } from '../../mixins/index'
Component({
behaviors:[componentsMixin],
properties: {
requestFlag: {
type: Boolean,
observer(n) {
if (n) {
this.getCoupons()
}
}
}
},
data: {
list: [],
IMGURLTemp:baseImgUrl
},
pageLifetimes: {
show: function () {},
hide: function () {}
},
methods: {
closeModal() {
this.setData({
show: false
})
},
submit() {
let {
list
} = this.data;
let ids = []
list.forEach(item => {
ids.push(item.id)
})
this.closeModal()
// this.triggerEvent('onConfirm', ids)
this.toReceive(ids)
},
toUse(e) {
this.closeModal()
let {
item
} = e.currentTarget.dataset
// this.triggerEvent('click', target)
this.toUserCard(item)
},
//一键领取优惠券
toReceive(ids) {
let para = {
couponIdList: ids,
}
couponsApi.toReciveCard(para).then(res => {
if (res) {
// wx.navigateTo({
// url: '/packageMine/pages/coupon/success/success'
// })
wx.$router.go('packageMine.success')
}
})
},
// 去使用
toUserCard(item) {
let para = {
couponIdList: [item.id],
}
couponsApi.toReciveCard(para).then(res => {
if (res) {
let {
discountType,
useChannel,
id
} = item
if (discountType == 2 || discountType == 4) {
wx.$router.go('packageMall.coupon', {
userCouponId: id,
useMemberType: 0
})
return
}
/**线上商品代金券 */
if (discountType == 3 && useChannel == 1) {
wx.$router.go('packageMine.coupon.recommend', {
couponInfo: item
})
return
}
let temp = JSON.stringify(item)
wx.navigateTo({
url: '/packageMine/pages/coupon/detail/detail?item=' + temp
})
// wx.$router.go('packageMine.detail', { item: temp })
}
})
},
/**获取礼券 */
getCoupons() {
let couponIds = wx.getStorageSync('lastCouponIds')
let para = {
discountTypes: [3],
lastCouponIds: couponIds,
directionalFlag:1
}
couponsApi.getHomeCardData(para).then(res => {
let flag = res.list.length ? true : false
let ids = couponIds || []
res.list.forEach(item => {
ids.push(item.id)
})
this.setData({
list: res.list,
show: flag,
})
if (ids.length > 0) {
wx.setStorageSync('lastCouponIds', ids)
}
})
},
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true
}
\ No newline at end of file \ No newline at end of file
<view wx:if="{{show}}" class="modal" catchtouchmove="noScroll">
<view class="center_box">
<view class="modal-close-icon">
<image webp bindtap="closeModal" class="close_icon" src="{{IMGURLTemp}}coupons/modal_close_icon.png?v={{img_version}}" />
</view>
<view class="modal_main_bg">
<view class="modal-bg-icon">
<image webp class="bg_icon" src="{{IMGURLTemp}}equity/coupons_bg_new.png?v={{img_version}}" />
</view>
<view style="height:30rpx"></view>
<block wx:if="{{list.length>3}}">
<scroll-view scroll-y="{{true}}" class="scroll_modal">
<view wx:for="{{list}}" wx:key="index" class="modal_element_box">
<view class="element_name text_hide_1 text_index">{{item.couponName}}</view>
<view class="element_price text_index">{{item.denomination}}</view>
<image webp class="box_bg_img" src="{{IMGURLTemp}}coupons/coupons_icon.png?v={{img_version}}" />
<view data-item="{{item}}" bind:tap="toUse" class="blank_box"></view>
</view>
</scroll-view>
</block>
<block wx:if="{{list.length<4}}">
<view wx:for="{{list}}" wx:key="index" class="modal_element_box">
<view class="element_name text_hide_1 text_index">{{item.couponName}}</view>
<view class="element_price text_index">{{item.denomination}}</view>
<image webp class="box_bg_img" src="{{IMGURLTemp}}coupons/coupons_icon.png?v={{img_version}}" />
<view data-item="{{item}}" bind:tap="toUse" class="blank_box"></view>
</view>
</block>
<view wx:if="{{list.length<4}}" style="height:42rpx"></view>
<image webp class="body_bg_icon" src="{{IMGURLTemp}}coupons/coupons_bg_icon.png?v={{img_version}}" />
</view>
<view class="modal_btn">
<view bind:tap="submit" class="btn_text">一键领取</view>
<image webp bind:tap="submit" class="btn_bg_cion" src="{{IMGURLTemp}}coupons/coupons_btn.png?v={{img_version}}" />
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
.modal {
position: fixed;
left: 0;
right: 0;
top: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
z-index: 999999;
display: flex;
align-items: center;
justify-content: center;
}
.center_box {
width: calc(100% - 180rpx);
/* min-height: 100px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center; */
}
.modal-body {
position: absolute;
top: 84rpx;
left: 50%;
transform: translate(-50%, 0);
width: calc(100% - 180rpx);
height: 100rpx;
}
.modal-close-icon {
display: flex;
align-items: center;
justify-content: flex-end;
}
.close_icon {
width: 48rpx;
height: 48rpx;
}
.modal_main_bg {
width: 100%;
position: relative;
}
.body_bg_icon {
width: 100%;
height: calc(100% - 64rpx);
position: absolute;
left: 0;
right: 0;
top: 64rpx;
bottom: 0;
z-index: -1;
}
.modal-bg-icon {
width: 100%;
height: 228rpx;
display: flex;
justify-content: flex-end;
}
.bg_icon {
width: 100%;
height: 228rpx;
}
.modal_element_box {
width: 100%;
height: 124rpx;
position: relative;
box-sizing: border-box;
padding: 0 38rpx;
margin-bottom: 16rpx;
}
.box_bg_img {
width: calc(100% - 76rpx);
height: 100%;
position: absolute;
left: 50%;
top: 0;
bottom: 0;
transform: translate(-50%, 0);
}
.scroll_modal {
height: 560rpx;
width: 100%;
}
.element_name {
color: #333435;
font-size: 28rpx;
position: absolute;
top: 50%;
left: 84rpx;
transform: translate(0, -50%);
font-weight: 600;
}
.element_min_name {
color: #929293;
font-size: 24rpx;
position: absolute;
bottom: 24rpx;
left: 84rpx;
font-weight: 400;
}
.element_price {
position: absolute;
right: 55rpx;
top: 10rpx;
width: 139rpx;
height: 59rpx;
text-align: center;
line-height: 59rpx;
color: #F13C3D;
font-weight: 600;
font-size: 36rpx;
}
.blank_box {
position: absolute;
right: 55rpx;
bottom: 0;
width: 139rpx;
height: 59rpx;
}
.modal_btn {
text-align: center;
margin-top: 4rpx;
position: relative;
}
.btn_text {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
color: #FFFFFF;
font-size: 36rpx;
top: 61rpx;
}
.btn_bg_cion {
width: 452rpx;
height: 132rpx;
}
.text_index {
z-index: 2;
}
.text_hide_1 {
width: 40%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
\ No newline at end of file \ No newline at end of file
import {
couponsApi
} from "../../api/api"
import {componentsMixin } from '../../mixins/index'
Component({
behaviors: [componentsMixin],
properties: {
coupons: {
type: Object,
value: {}
},
mode: {
type: String,
value: 'coupon' //coupon卡券 center领券中心
},
btnStatus: {
type: Number,
value: 0
},
useMemberType: Number,
hideBtn: Boolean,
couponStyle: String
},
data: {
// 2 折扣券,3 代金券,4 兑换券,7 服务券
},
methods: {
toRecive() {
let para = {
couponIdList: [this.data.coupons.id],
}
couponsApi.toReciveCard(para).then(res => {
if (res) {
wx.navigateTo({
url: '/packageMine/pages/coupon/success/success'
})
}
})
},
toDetail() {
let temp = JSON.stringify(this.data.coupons)
let {
discountType,
useChannel,
// id,
// receiveWay,
// scopeApplication
} = this.data.coupons
let detailInfo = 1
if (discountType == 2 || discountType == 4) {
// wx.$router.go('packageMall.coupon', {
// userCouponId: id,
// useMemberType: this.data.useMemberType,
// detailInfo,
// receiveWay,
// scopeApplication
// })
// 修改跳转方式
wx.navigateTo({
url: '/packageMall/pages/coupon/coupon?item=' + temp + '&detailInfo=' + detailInfo + '&useMemberType=' + this.data.useMemberType
})
return
}
/**线上商品代金券 */
if (discountType == 3 && useChannel == 1) {
if(this.data.useMemberType == 1) {
wx.$util.showToast('代金券已使用')
return
}
// wx.$router.go('packageMine.coupon.recommend', {
// couponInfo: this.data.coupons
// })
// 修改跳转方式
wx.navigateTo({
url: '/packageMine/pages/coupon/recommend/recommend?item=' + temp
})
return
}
wx.navigateTo({
url: '/packageMine/pages/coupon/detail/detail?item=' + temp
})
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true
}
\ No newline at end of file \ No newline at end of file
<!-- <view class="box_wrapper" background-image: url({{btnStatus == 0 ? couponBaseList[coupons.discountType]:unCouponBaseList[coupons.discountType]}});"> -->
<view class="box_wrapper" style="{{couponStyle}}">
<view class="bg">
<image webp src="{{IMGURL}}mine/coupon/{{btnStatus == 0 ? '' :'un-'}}coupon-{{coupons.discountType}}.png?v={{img_version}}"></image>
</view>
<view class="container">
<view class="{{coupons.discountType==4 || coupons.discountType==7 ? '':'left_icon_box'}}">
<!-- <image webp wx:if="{{btnStatus==0}}" class="left_bg" src="../../packageMine/images/coupons/coupons_active.png?v={{img_version}}" />
<image webp wx:else class="left_bg" src="../../packageMine/images/coupons/coupons.png?v={{img_version}}" /> -->
<!-- <view wx:if="{{coupons.discountType==7}}" class="left_text_one left_text_four">
<text class="anText">券</text>
<text wx:if="{{coupons.useType&&coupons.effectiveType!=3}}">{{ coupons.usedAmount }}/{{ coupons.useAllAmount }}</text>
<text wx:else>不限次数</text>
</view> -->
<view wx:if="{{coupons.discountType==3}}" class="left_text_one left_text_two {{btnStatus == 0 ? 'brightColor':'darkColor'}}">
<text class="price_icon">¥</text>
<text>{{coupons.denomination}}</text>
</view>
<view wx:if="{{coupons.discountType==2}}" class="left_text_one left_text_two {{btnStatus == 0 ? 'brightColor':'darkColor'}}">
<!-- <text class="anText">券</text> -->
<text class="anText" wx:if="{{coupons.discountIntensity}}">{{coupons.discountIntensity}}</text>
<text class="discount" wx:if="{{coupons.discountIntensity}}">折</text>
</view>
<!-- <view class="left_text_one">8.5折</view> -->
<!-- <view class="left_text_one left_text_two">
</view> -->
<!-- <view class="left_text_one left_text_three">满99可用</view> -->
</view>
<view class="main_box {{coupons.discountType==4 || coupons.discountType==7 ? 'leftMargin':''}}">
<view class="title_text {{btnStatus == 0 ? 'brightColor':'darkColor'}}">{{coupons.couponName}}</view>
<block wx:if="{{coupons.useDescription}}">
<view class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">{{coupons.useDescription}}</view>
</block>
<block wx:else>
<view wx:if="{{coupons.useType==0 && coupons.discountType==7}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">不限次数</view>
<view wx:if="{{coupons.useType==1 && coupons.discountType==7}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">可用{{coupons.useAmount}}次</view>
<view wx:if="{{coupons.useType==2 && coupons.discountType==7}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">{{coupons.useLimitDays}}天可用{{coupons.useAmount}}次</view>
<!-- <view wx:if="{{coupons.discountType==3}}" style="height:1px" class="drive"></view> -->
<view wx:if="{{coupons.useBarriers==1 && coupons.discountType!=4}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">无门槛</view>
<view wx:if="{{coupons.useBarriers==2 && coupons.discountType!=4}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">满{{coupons.full}}元可用</view>
</block>
<view wx:if="{{coupons.effectiveType==3}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">永久有效</view>
<view wx:if="{{coupons.effectiveType==2}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">{{coupons.receiveStartTime}}-{{coupons.receiveEndTime}}</view>
<view wx:if="{{coupons.effectiveType==1}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">有效期至{{coupons.receiveEndTime}}</view>
<!-- <view wx:else class="h4_text drive">{{coupons.receiveStartTime}}-{{coupons.receiveEndTime}}</view> -->
<!-- <view wx:if="{{coupons.effectiveType==1}}" class="h4_text drive">{{coupons.effectiveStartTime}}-{{coupons.effectiveEndTime}}</view> -->
</view>
<!-- <view wx:if="{{mode=='center'}}" class="box_btn box_btn_color" bind:tap="toRecive">领取</view> -->
<block wx:if="{{!hideBtn}}">
<view wx:if="{{mode=='coupon'&&btnStatus==0}}" class="box_btn box_btn_color" bind:tap="toDetail">去使用</view>
<view wx:if="{{mode=='coupon'&&btnStatus==1}}" class="box_btn box_btn_color box_btn_color_grey" bind:tap="toDetail">去查看</view>
<view wx:if="{{mode=='coupon'&&btnStatus==2}}" class="box_btn box_btn_color box_btn_color_grey" bind:tap="toDetail">去查看</view>
</block>
</view>
</view>
\ No newline at end of file \ No newline at end of file
.box_wrapper {
width: 100%;
height: 162rpx;
/* background: #FFFFFF; */
/* border-radius: 8rpx; */
margin-top: 19rpx;
position: relative;
box-sizing: border-box;
background-size: cover;
}
.bg{
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.container {
display: flex;
align-items: center;
position: relative;
z-index: 1;
width: 100%;
height: 100%;
}
.left_icon_box {
width: 156rpx;
height: 156rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
}
.left_bg {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 156rpx;
height: 156rpx;
z-index: 1;
}
.left_text_one {
font-size: 48rpx;
font-weight: 600;
z-index: 2;
}
.left_text_two {
display: flex;
align-items: flex-end;
}
.left_text_four {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.left_text_three {
font-size: 20rpx;
margin-top: 6rpx;
}
.anText {
font-size: 48rpx;
/* color: rgba(white, white, white, 0.45); */
font-weight: 600;
/* color: #FFF; */
/* opacity: 0.45; */
}
.price_icon {
font-size: 24rpx;
/* margin-right: 4rpx; */
margin-bottom: 7rpx;
font-weight: 500;
}
.main_box {
height: 156rpx;
box-sizing: border-box;
padding: 24rpx 24rpx 24rpx 0rpx;
justify-content: space-evenly;
display: flex;
flex-direction: column;
z-index: 1;
}
.box_btn {
position: absolute;
right: 47rpx;
top: 50%;
transform: translate(0, -50%);
width: 120rpx;
height: 44rpx;
/* background: #B1B1B3; */
text-align: center;
line-height: 44rpx;
font-size: 28rpx;
font-weight: 600;
}
.box_btn_color {
/* background: var(--btnColor); */
color: var(--btnColor);
}
.box_btn_color_grey {
color: #6D6D6D;
}
.title_text {
color: #282829;
font-weight: 600;
color: #282829;
font-size: 28rpx;
width: 309rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.h4_text {
font-weight: 400;
color: #B1B1B3;
font-size: 20rpx;
}
.leftMargin {
padding-left: 32rpx;
}
.brightColor {
color: #FC5B32;
}
.darkColor {
color: #6D6D6D;
}
.describeColor {
color: #D83C14;
}
.discount {
font-size: 20rpx;
font-weight: 500;
margin-bottom: 10rpx;
}
.box_wrapper .bg{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
\ No newline at end of file \ No newline at end of file
images/mall.png

928 Bytes

This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!