Commit ced8a2ab by 杨北旺

对接部分接口

1 parent 2dcce7ac
......@@ -32,7 +32,7 @@ export const equity = {
},
/** 是否开通权益 */
getMerchantid(data) {
return request(data, 'scrm.api.equity.pakage.by.merchantid')
return request(data, 'scrm.api.equity.third.get')
},
/** 获取Edj地址 */
getEdjUrl(data) {
......@@ -59,8 +59,8 @@ export const equity = {
return request({}, 'scrm.api.equity.main.page.third.equity.get')
},
/**获取门店套餐 */
getStorePackage() {
return request({}, 'scrm.api.equity.main.page.merchant.package.get')
getStorePackage(data) {
return request(data, 'scrm.api.equity.main.page.merchant.package.get')
},
/**获取首页精选 */
getHotData(data) {
......@@ -230,6 +230,10 @@ export const commodity = {
getPackageDeail(data) {
return request(data, 'scrm.api.equity.main.page.package.detail.get')
},
/**获取门店套餐订单详情 */
getPackageOrderDetail(data) {
return request(data, 'scrm.api.equity.h5.package.order.detail.get')
},
/**获取门店订单编号 */
getStoreOrderCode(data) {
return request(data, 'scrm.api.equity.merchant.order.code.create')
......
......@@ -19,17 +19,17 @@ Vue.use(preview)
Vue.config.productionTip = false
Vue.prototype.isMiniprogram = window.__wxjs_environment === 'miniprogram'
axios({
baseURL: process.env.VUE_APP_REPO + '/scrm-equity-mobile-config',
method: 'get'
baseURL: process.env.VUE_APP_REPO + '/scrm-equity-mobile-config',
method: 'get'
}).then(({
data: config
data: config
}) => {
window.$baseConfig = config
window.vm = new Vue({
router,
store,
render: h => {
return h(App)
}
}).$mount('#app')
window.$baseConfig = config
window.vm = new Vue({
router,
store,
render: h => {
return h(App)
}
}).$mount('#app')
})
\ No newline at end of file
const pages = {
equity: [
{name: 'index'},
{name: 'road', title: '道路救援',showNavBar: true},
{name: 'tyre', title: '轮胎保障',showNavBar: true},
{name: 'collision', title: '碰撞维修',showNavBar: true},
{name: 'compensate', title: '盗抢补偿',showNavBar: true},
{name: 'loss', title: '整车全损',showNavBar: true},
{name: 'allEquity', title: '全部权益',showNavBar: true},
{ name: 'index' },
{ name: 'road', title: '道路救援', showNavBar: true },
{ name: 'tyre', title: '轮胎保障', showNavBar: true },
{ name: 'collision', title: '碰撞维修', showNavBar: true },
{ name: 'compensate', title: '盗抢补偿', showNavBar: true },
{ name: 'loss', title: '整车全损', showNavBar: true },
{ name: 'allEquity', title: '全部权益', showNavBar: true },
],
oilStation: [
{name: 'index'},
{name: 'record', title: '加油记录',showNavBar: true},
{name: 'detail', title: '加油站详情',showNavBar: true},
{name: 'location', title: '加油站详情',showNavBar: true},
{ name: 'index' },
{ name: 'record', title: '加油记录', showNavBar: true },
{ name: 'detail', title: '加油站详情', showNavBar: true },
{ name: 'location', title: '加油站详情', showNavBar: true },
],
common: [
{name: 'index'},
{name: 'activate', title: '激活权益',showNavBar: true},
{name: 'explain', title: '常见疑问',showNavBar: true},
{name: 'phoneLogin', title: '登录',wxAuth: true},
{name: 'nothing'},
{name: 'appTip'},
{name: 'expcard',title: '体验卡领取'},
{name: 'marketing', wxAuth: true},
{ name: 'index' },
{ name: 'activate', title: '激活权益', showNavBar: true },
{ name: 'explain', title: '常见疑问', showNavBar: true },
{ name: 'phoneLogin', title: '登录', wxAuth: true },
{ name: 'nothing' },
{ name: 'appTip' },
{ name: 'expcard', title: '体验卡领取' },
{ name: 'marketing', wxAuth: true },
],
car: [{
name: 'marketing',
......@@ -32,8 +32,7 @@ const pages = {
wxAuth: true,
title: '绑定挪车码'
}],
cardRoll: [
{
cardRoll: [{
name: 'index',
title: '我的卡券',
showNavBar: true
......@@ -74,19 +73,18 @@ const pages = {
},
{
name: 'cardPage',
title:'我的卡包',
title: '我的卡包',
showNavBar: true
},
{
name: 'couponsDetail',
title:'券详情',
title: '券详情',
showNavBar: true
}
],
commodity: [
{
commodity: [{
name: 'process',
title:'充值流程',
title: '充值流程',
showNavBar: true
},
{
......@@ -95,7 +93,7 @@ const pages = {
},
{
name: 'success',
title:'支付成功',
title: '支付成功',
showNavBar: true
},
{
......@@ -112,20 +110,21 @@ const pages = {
},
{
name: 'packageSuccess',
title:'支付成功',
title: '支付成功',
showNavBar: true
},
],
device: [{
name: 'index',
wxAuth: true,
authBase: true,
title: '设备关联'
},
{
name: 'list',
title: '设备关联'
}]
name: 'index',
wxAuth: true,
authBase: true,
title: '设备关联'
},
{
name: 'list',
title: '设备关联'
}
]
}
const getParams = str => {
let params = str.split('?')
......@@ -133,33 +132,35 @@ const getParams = str => {
let param = params[1].split('&')
let obj = {}
for (let i = 0; i < param.length; i++) {
let paramsA = param[i].split('=')
let key = paramsA[0]
let value = paramsA[1]
obj[key] = value
let paramsA = param[i].split('=')
let key = paramsA[0]
let value = paramsA[1]
obj[key] = value
}
return obj
}
}
let routes = []
const ua = navigator.userAgent.toLowerCase()
let isWeiXin = ua.match(/MicroMessenger/i) == 'micromessenger'
let defaultName = isWeiXin?'common.phoneLogin':'common.marketing'
let defaultName = isWeiXin ? 'common.phoneLogin' : 'common.marketing'
let urlParam = getParams(location.href)
let freecards = sessionStorage.getItem('freecards')
let flag = Object.keys(urlParam);
console.log(flag);
if(flag.length){
if((urlParam.freecards=='1') || (freecards=='1')){
defaultName = 'common.expcard'
sessionStorage.setItem('freecards','1')
}
if (window.__wxjs_environment == 'miniprogram') {
defaultName = 'equity.index'
}
if(freecards=='1'){
defaultName = 'common.expcard'
if (flag.length) {
if ((urlParam.freecards == '1') || (freecards == '1')) {
defaultName = 'common.expcard'
sessionStorage.setItem('freecards', '1')
}
}
if (freecards == '1') {
defaultName = 'common.expcard'
}
Object.keys(pages).map(parent => {
pages[parent].map((val, index) => {
let {name} = val
let { name } = val
let meta = val
delete meta.name
meta.rank = index
......@@ -174,4 +175,4 @@ Object.keys(pages).map(parent => {
routes.push(route)
})
})
export default routes
export default routes
\ No newline at end of file
......@@ -208,23 +208,6 @@ export default {
let { code, data, message } = res
if (code == 0) {
this.cardList = data?data:[];
this.cardList.push({
orderStatus:6,
openRefund:0,
appearance:null,
refundCode:null,
orderType:2,
goodsQuality:1,
warrantyDate:null,
productNameDesc:'炸鸡腿券1炸鸡腿券1炸鸡腿券1炸鸡腿券1炸鸡腿券1炸鸡腿券1',
supplier:'HW',
officePrice:150,
brandName:null,
orderPrices:130,
productName:'单人套餐1',
orderCode:'GL113213416465',
orderDate:'2021.9.18'
})
} else {
this.showToast(message)
}
......@@ -317,7 +300,7 @@ export default {
this.openWindows(url, 'cardRoll.detail')
}else{
let url = `${href}/#/commodity/packageDetail?sessionId=${sessionId}&orderCode=${val.orderCode}`;
this.openWindows(url, 'commodity.packageDetail')
this.openWindows(url)
}
},
jumpSales(val) {
......
......@@ -126,7 +126,7 @@ export default {
status: true,
supplier: '',
isHaveInventory:true,//是否有库存
addressInfo:null
addressInfo:null,
}
},
mounted() {
......@@ -140,11 +140,6 @@ export default {
if(options.selectedId){//首页选择的元素
this.selectedId = options.selectedId
}
// console.log(this.$route.query);
// let goods = JSON.parse(sessionStorage.getItem('GL_GOODS_INFO'));
// document.title = goods.brandName
// this.brandName = goods.brandName;
// this.supplier = goods.supplier;
}else {
let params = this.getParams(window.location.href)
this.brandName = decodeURI(params.brandName);
......@@ -155,21 +150,24 @@ export default {
}
}
this.showLoading();
let {latitude,longitude} = this.$store.state.address
let para = {
brandName: this.brandName,
supplier: this.supplier
supplier: this.supplier,
lat:latitude,
lng:longitude
}
commodity.getCouponDetail(para).then(res => {
let { code, data, message } = res
if (code == 0) {
// 新版外包了一层经纬度,所以这里得处理一下
// this.addressInfo = {
// gasAddressLatitude:data.latitude,
// gasAddressLongitude:data.longitude,
// gasAddress:data.localAddress,
// localAddressDistance:data.localAddressDistance
// }
this.businessList = data;
this.addressInfo = {
gasAddressLatitude:data.latitude,
gasAddressLongitude:data.longitude,
gasAddress:data.localAddress,
localAddressDistance:data.localAddressDistance
}
this.businessList = data.goodsDetailList;
this.selectData = this.businessList[0]
if(this.selectedId){//存在则是从精选处跳转进来的
this.businessList.forEach((el,index)=>{
......
......@@ -27,7 +27,7 @@
<span>下单时间</span>
<span class="cell_val">{{packageInfo.createDate}}</span>
</div>
<div class="location_wrap" @click="toOpenLocation">
<div v-if="packageInfo.latitude" class="location_wrap" @click="toOpenLocation">
<div class="icon_l"></div>
<div class="text_l">导航</div>
</div>
......@@ -38,6 +38,7 @@
<script type='text/ecmascript-6'>
import WxConfig from "@u/WxConfig";
const WX = new WxConfig(["openLocation", "getLocation"]);
import {commodity} from "@r/api";
export default {
name: "",
data() {
......@@ -49,31 +50,23 @@ export default {
document.querySelector("body").setAttribute("style", "background:#F5F5F5");
},
mounted() {
this.packageInfo = {
notes:'这是套餐的备注',
createDate:'2021-09-18',
latitude:22.536197,
longitude: 113.959296,
merchantAddress:'湾科技生态园',
packageName:'单人套餐1',
merchantName:'广汇门店',
orderPrice:130,
orderCode:'GL21321321321',
couponsDetails:[
{
couponName:'炸鸡腿1',
userCouponsId:1,
shortLink:'跳转小程序券详情短链'
},
{
couponName:'炸鸡腿2',
userCouponsId:2,
shortLink:'跳转小程序券详情短链'
},
]
}
let options = this.$route.query
this.getDetailInfo(options.orderCode)
},
methods: {
getDetailInfo(orderCode){
let { sessionId} = this.$store.state;
let para = {
orderCode,
sessionId
}
commodity.getPackageOrderDetail(para).then(res=>{
if(res.code==0){
this.packageInfo = res.data
this.packageInfo.createDate = new Date(this.packageInfo.createDate).format("yyyy-MM-dd hh:mm:ss")
}
})
},
toOpenLocation(){
let temp = this.packageInfo
let val = {
......
......@@ -39,7 +39,7 @@
</template>
<script type='text/ecmascript-6'>
import {cardRoll} from "@r/api";
import {cardRoll,commodity} from "@r/api";
export default {
name: "",
data() {
......@@ -54,7 +54,8 @@ export default {
},
mounted() {
document.title = '广汇门店'
this.getDetailInfo()
let options = this.$route.query
this.getDetailInfo(options.id)
this.getPaySource()
},
methods: {
......@@ -70,54 +71,18 @@ export default {
}
},
// 获取门店套餐详情
getDetailInfo(){
let data = {
id:1,
packageName:'单人套餐1',
totalPrice:150,
packagePrice:135,
notes:'这是套餐的备注',
count:10,
couponsDetailList:[
{
serviceQuantity:3,
useType:0,
effectiveType:3,
effectiveEndTime:'2022.9.10',
effectiveStarttime:'2021.9.18',
useLimitDays:6,
couponName:'炸鸡腿券1炸鸡腿券1炸鸡腿券1炸鸡腿券1炸鸡腿券1炸鸡腿券1',
shopTotalPrice:50,
effectiveDays:20,
useAmount:3
},
{
serviceQuantity:4,
useType:1,
effectiveType:2,
effectiveEndTime:'2022.9.10',
effectiveStarttime:'2021.9.18',
useLimitDays:6,
couponName:'炸鸡腿券2',
shopTotalPrice:50,
effectiveDays:20,
useAmount:3
},
{
serviceQuantity:3,
useType:2,
effectiveType:1,
effectiveEndTime:'2022.9.10',
effectiveStarttime:'2021.9.18',
useLimitDays:6,
couponName:'炸鸡腿券3',
shopTotalPrice:50,
effectiveDays:20,
useAmount:3
},
]
getDetailInfo(id){
let para = {
id
}
this.packageInfo = data
commodity.getPackageDeail(para).then(res=>{
const {code,data,message} = res
if(code==0){
this.packageInfo = data
}else{
this.showToast(message)
}
})
},
// 购买套餐
toBuyPackage(){
......@@ -144,7 +109,7 @@ export default {
this.hideLoading();
})
},
// 跳转到套餐详情
// 跳转购买成功
jumpToPackageDetail() {
let { sessionId } = this.$store.state;
let [href] = window.location.href.split("/#/");
......
......@@ -45,7 +45,7 @@
</template>
<script type='text/ecmascript-6'>
// import { equity } from "@r/api.js";
import { equity } from "@r/api.js";
import { indexMixin } from "@/mixins";
export default {
name: "",
......@@ -63,17 +63,17 @@ export default {
};
},
mounted() {
// this.getMerchants();
let wheight = window.innerHeight + "px";
this.deviceH = wheight;
this.showLoading();
let self = this;
setTimeout(() => {
self.$nextTick(() => {
self.getTwoHeightArr();
});
self.hideLoading();
}, 2000);
this.getMerchants();
// this.showLoading();
// let self = this;
// setTimeout(() => {
// self.$nextTick(() => {
// self.getTwoHeightArr();
// });
// self.hideLoading();
// }, 2000);
},
methods: {
// 点击跳转商品详情
......@@ -96,28 +96,28 @@ export default {
}
},
// 获取所有权益商品
// getMerchants() {
// this.equityList = [];
// let para = {
// merchantId: this.merchantId,
// };
// equity.getMerchantid(para).then((res) => {
// let { code, data, message } = res;
// if (code == 0) {
// this.equityList = data.goodsServiceList;
// this.equityList.unshift({
// goodsCategory: "汽车权益",
// equityGoodsGroupDescDtos: data.carServiceList,
// });
// //计算两个高度数组,延迟到下次 DOM 更新循环之后再计算
// this.$nextTick(() => {
// this.getTwoHeightArr();
// });
// } else {
// this.showToast(message);
// }
// });
// },
getMerchants() {
this.equityList = [];
let para = {
merchantId: this.merchantId,
};
equity.getMerchantid(para).then((res) => {
let { code, data, message } = res;
if (code == 0) {
this.equityList = data.goodsServiceList;
this.equityList.unshift({
goodsCategory: "汽车权益",
equityGoodsGroupDescDtos: data.carServiceList,
});
//计算两个高度数组,延迟到下次 DOM 更新循环之后再计算
this.$nextTick(() => {
this.getTwoHeightArr();
});
} else {
this.showToast(message);
}
});
},
//左侧选择元素--跳转到相对应的位置
selectLeftItem(i) {
this.whichIndex = i;
......@@ -246,8 +246,8 @@ export default {
width: 100%;
min-height: 100px;
display: grid;
grid-template-columns: repeat(4, 46px);
grid-gap: 10px 23px;
grid-template-columns: repeat(4, 57px);
grid-gap: 10px 11px;
grid-auto-rows: 100px;
// display: flex;
// flex-wrap: wrap;
......
......@@ -101,8 +101,9 @@
</div>
</div>
<div class="store_serve_widget">
<div class="serve_title">本店服务</div>
<div v-if="storePackageList.length" class="serve_title">本店服务</div>
<div
v-if="storePackageList.length"
class="serve_content"
:class="showStoreMore ? 'content_all' : 'content_four'"
>
......@@ -110,7 +111,7 @@
v-for="(item, index) in storePackageList"
:key="index"
class="serve_box"
@click="jumpToStorePackage"
@click="jumpToStorePackage(item.packageId)"
>
<div class="serve_item_title">{{item.packageName}}</div>
<div class="serve_item_desc">
......@@ -119,7 +120,7 @@
</div>
</div>
</div>
<div class="show_store_Btn" @click="changeStoreMore">
<div v-if="storePackageList.length>4" class="show_store_Btn" @click="changeStoreMore">
<div :class="showStoreMore ? 'icon_tip_up' : 'icon_tip_down'"></div>
<div class="text_tip">{{ showStoreMore ? "收起" : "展示更多" }}</div>
</div>
......@@ -142,7 +143,7 @@
</div>
<div v-if="curTabIndex == 0" class="swiper_serve_widget">
<template v-for="(item, index) in siftList">
<div :key="index" class="high_widget">
<div v-if="item.couponsGoodsList.length>0" :key="index" class="high_widget">
<div class="left_fixed_box">
<div class="label_icon">
<img :src="item.icon">
......@@ -170,7 +171,7 @@
</van-swipe-item>
</van-swipe>
</div>
<div class="adress_widget">
<div v-if="item.appearance==1" class="adress_widget">
<div class="address_info_text">
{{item.localAddress}}
</div>
......@@ -274,9 +275,6 @@ export default {
},
mounted() {
console.log("更新页面时间:", new Date().format("hh:mm:ss"));
this.getAllMenuData();
this.getStoreData();
this.getHighData();
const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
this.isWXEnvironment = true;
......@@ -300,6 +298,8 @@ export default {
this.isLogin = false;
}
this.initLocation();
this.getAllMenuData();
this.getStoreData();
this.getPackageCount()
},
methods: {
......@@ -619,7 +619,9 @@ export default {
cityCode: adcode,
address: formattedAddress,
};
console.log(this.addressInfo,'定位信息---');
this.getStationList();
this.getHighData();
this.$store.commit("setAddress", this.addressInfo);
}
});
......@@ -715,11 +717,11 @@ export default {
this.openWindows(url, "equity.allEquity");
},
// 跳转到门店套餐
jumpToStorePackage() {
jumpToStorePackage(id) {
let { sessionId } = this.$store.state;
let [href] = window.location.href.split("/#/");
let url = `${href}/#/commodity/storePackage?sessionId=${sessionId}`;
this.openWindows(url, "commodity.storePackage");
let url = `${href}/#/commodity/storePackage?sessionId=${sessionId}&id=${id}`;
this.openWindows(url);
},
// 精选去购买
toBuyGoods(goods,item){
......@@ -802,129 +804,78 @@ export default {
data: 3
}
this.packageNumber = res.data
// equity.getPackageNum().then((res)=>{
// console.log('获取卡包数据',res);
// })
equity.getPackageNum().then((res)=>{
console.log('获取卡包数据',res);
})
},
// 2.获取首页权益
getAllMenuData() {
let menuList = [];// 后台返回的数组
this.menuList = [];
for (let i = 0; i < 6; i++) {
let temp = {
supplier: "HW",
brandName: "星巴克",
equityName: "星巴克",
equityDesc: "测试时安徽的",
equityIcon:
"http://qcimg01.glsx.net:7060/group1/M00/00/21/wKgD3mD5RSyAAnfDAADXLGDvl9k971.jpg",
appearance: 1,
};
menuList.push(temp);
}
let dataLen = menuList.length;
if (dataLen < 10) {
this.menuList[0] = menuList;
} else if (dataLen >= 10) {
let temp1 = menuList.slice(0, 9);
let temp2 = menuList.slice(9);
let temp3 = this.splitArr(temp2, 10);
this.menuList[0] = temp1;
this.menuList = this.menuList.concat(temp3);
}
equity.getMenuData().then(res=>{
const {data,code} = res
if(code==0){
menuList = data
let dataLen = menuList.length;
if (dataLen < 10) {
this.menuList[0] = menuList;
} else if (dataLen >= 10) {
let temp1 = menuList.slice(0, 9);
let temp2 = menuList.slice(9);
let temp3 = this.splitArr(temp2, 10);
this.menuList[0] = temp1;
this.menuList = this.menuList.concat(temp3);
}
}
})
},
// 3.获取门店服务套餐
getStoreData() {
this.storePackageList = [];
for (let i = 1; i < 10; i++) {
let obj = {
packageId: i,
packageName: '单人套餐'+i,
packagePrice: i+20,
originalPrice:10,
num:3+i
};
this.storePackageList.push(obj);
let para = {
merchantId: sessionStorage.getItem("GL_WX_MERCHANTID")
}
equity.getStorePackage(para).then(res=>{
const {code,data} = res
if(code==0){
this.storePackageList = data
}
})
},
// 4.获取精选
getHighData() {
this.siftList = [];
let data = [
{
supplier:'HW',
icon:'http://qcimg01.glsx.net:7060/group1/M00/00/21/wKgD3mD5RSyAAnfDAADXLGDvl9k971.jpg',
appearance:1,
brandName:'星巴克',
equityName:'星巴克',
localAddress:'湾科技生态园',
localAddressDistance:0.2,
lat:'22.536197',
lng:'113.959296',
couponsGoodsList:[
{
id:160,
brandName:'星巴克',
productName:'中杯全国通兑券',
goodsImage:'http://qcimg01.glsx.net:7060/group1/M00/00/26/wKgD3mETfpCAUxWGAAqTcVMvFUE986.png',
salesPrice:'0.01',
lineationPrice:1,
noMemberPrice:null,
warrantyDate:1631847332512,
validityPeriod:null,
buysNotes:'%3Cp%3Egoumai%3C%2Fp%3E',
useNotes:'%3Cp%3Ekajuan%3C%2Fp%3E',
stock:10
}
]
},
{
supplier:'HW',
icon:'http://qcimg01.glsx.net:7060/group1/M00/00/21/wKgD3mD5RSyAAnfDAADXLGDvl9k971.jpg',
appearance:2,
brandName:'芒果TV',
equityName:'1',
localAddress:'湾科技生态园',
localAddressDistance:0.3,
lat:'22.536197',
lng:'113.959296',
chargeGoddsList:[
{
productName:'视频会员月卡',
denominationList:[
{
id:148,
denomination:'22',
salesPrice:0.02,
lineationPrice:11,
noMemberPrice:13,
buysNotes:'%3Cp%3E32%3C%2Fp%3E',
useNotes:'%3Cp%3E1%3C%2Fp%3E',
}
]
},
]
},
]
data.map((item) => {
if(item.appearance==2){
let tempArr = []
item.chargeGoddsList.forEach((ele)=>{
ele.denominationList.forEach((info)=>{
let tempobj = {
productName:ele.productName,
...info
let {latitude,longitude} = this.addressInfo
let para = {
lat:latitude,
lng:longitude
}
equity.getHotData(para).then(res=>{
let {code,data} = res
if(code==0){
data.map((item) => {
if(item.appearance==2){
let tempArr = []
if(item.chargeGoddsList){
item.chargeGoddsList.forEach((ele)=>{
ele.denominationList.forEach((info)=>{
let tempobj = {
productName:ele.productName,
...info
}
tempArr.push(tempobj)
})
})
}
tempArr.push(tempobj)
})
})
item.couponsGoodsList = tempArr
item.couponsGoodsList = tempArr
}
item.couponsGoodsList = this.splitArr(item.couponsGoodsList, 2);
return item;
});
this.siftList = data;
}
item.couponsGoodsList = this.splitArr(item.couponsGoodsList, 2);
return item;
});
this.siftList = data;
})
},
},
};
......@@ -1269,7 +1220,6 @@ body {
}
}
.content_four {
height: 170px;
overflow: hidden;
}
.content_all {
......@@ -1465,7 +1415,7 @@ body {
}
.line {
position: absolute;
right: 90px;
right: 110px;
top: 50%;
transform: translate(0, -50%);
height: 12px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!