Commit 4e2b5245 by 杨北旺

联调完大部分接口,除了登录和购买。修改部分逻辑处理

1 parent 2978bd4f
...@@ -158,7 +158,6 @@ export const cardRoll = { ...@@ -158,7 +158,6 @@ export const cardRoll = {
getCardConfirm(data) { getCardConfirm(data) {
return request(data, 'scrm.api.equity.h5.order.finish.confirm') return request(data, 'scrm.api.equity.h5.order.finish.confirm')
}, },
} }
export const oilStation = { export const oilStation = {
/**获取油号 */ /**获取油号 */
......
...@@ -236,18 +236,39 @@ const myDialog = (message, confirmText, cancelText, comfirmFn, cancelFn) => { ...@@ -236,18 +236,39 @@ const myDialog = (message, confirmText, cancelText, comfirmFn, cancelFn) => {
} }
// 导航 (微信环境需要传WX过来,如果在这里直接导入会报错) // 导航 (微信环境需要传WX过来,如果在这里直接导入会报错)
const openNavigation = (val, WX) => { const openNavigation = (val, WX) => {
const ua = navigator.userAgent.toLowerCase() const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') { if (ua.match(/MicroMessenger/i) == 'micromessenger') {
WX.openLocation(Number(val.gasAddressLatitude), Number(val.gasAddressLongitude), val.gasName, val.gasAddress, 18).then(() => { WX.openLocation(Number(val.gasAddressLatitude), Number(val.gasAddressLongitude), val.gasName, val.gasAddress, 18).then(() => {
// console.log(res) // console.log(res)
}) })
} else {
if (checkPhoneType() == 'ios') {
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({ type: 8, address: val.gasAddress, latitude: Number(val.gasAddressLatitude), longitude: Number(val.gasAddressLongitude) }))
} else { } else {
window.myjs.jumpNativeApp(JSON.stringify({ type: 8, address: val.gasAddress, latitude: Number(val.gasAddressLatitude), longitude: Number(val.gasAddressLongitude) })) if (checkPhoneType() == 'ios') {
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({ type: 8, address: val.gasAddress, latitude: Number(val.gasAddressLatitude), longitude: Number(val.gasAddressLongitude) }))
} else {
window.myjs.jumpNativeApp(JSON.stringify({ type: 8, address: val.gasAddress, latitude: Number(val.gasAddressLatitude), longitude: Number(val.gasAddressLongitude) }))
}
} }
} }
// 新版 判断当前环境-并且获取对应的source值 后H5:1 APP:2 小程序:3
const getEnvironmentAndSource = () => {
let source = 1
let type = 'H5'
let flag = getChannel() // 1--小程序 2--app 3--H5
if (flag == 1) {
source = 3
type = 'mini'
} else if (flag == 2) {
source = 2
type = 'app'
} else {
source = 1
type = 'H5'
}
let result = {
source,
platform: type
}
return result
} }
const utils = { const utils = {
removeLocalStorage, removeLocalStorage,
...@@ -270,7 +291,8 @@ const utils = { ...@@ -270,7 +291,8 @@ const utils = {
cloneText, cloneText,
getParams, getParams,
myDialog, myDialog,
openNavigation openNavigation,
getEnvironmentAndSource
} }
Object.keys(utils).map(key => { Object.keys(utils).map(key => {
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</div> </div>
</div> </div>
<div class="opening-operation"> <div class="opening-operation">
<div class="opening-operation-price" v-if="price && !isOpen" @click="buyCard"><span>¥{{ price }}</span>立即开通</div> <div class="opening-operation-price" v-if="price && !isOpen" @click="toOpenEquity"><span>¥{{ price }}</span>立即开通</div>
<div class="opening-operation-price disabled" v-else>{{isOpen?'已开通':'暂不支持付费购买'}}</div> <div class="opening-operation-price disabled" v-else>{{isOpen?'已开通':'暂不支持付费购买'}}</div>
<div class="opening-operation-desc">开通权益代表接受 <a @click="jumpAgree">《权益服务协议》</a></div> <div class="opening-operation-desc">开通权益代表接受 <a @click="jumpAgree">《权益服务协议》</a></div>
</div> </div>
...@@ -72,7 +72,6 @@ export default { ...@@ -72,7 +72,6 @@ export default {
}, },
mounted(){ mounted(){
this.payStatus = this.$route.query; this.payStatus = this.$route.query;
console.log(this.getLocalStorage('whereInOpen'),'本地缓存的页面入口')
const merchantId2 = sessionStorage.getItem("GL_WX_MERCHANTID"); const merchantId2 = sessionStorage.getItem("GL_WX_MERCHANTID");
let { sessionId,merchantId} = this.$store.state; let { sessionId,merchantId} = this.$store.state;
this.merchantId = merchantId || merchantId2; this.merchantId = merchantId || merchantId2;
...@@ -88,6 +87,7 @@ export default { ...@@ -88,6 +87,7 @@ export default {
this.price = data.goodPrice; this.price = data.goodPrice;
this.orderCode = data.orderCode; this.orderCode = data.orderCode;
this.equityName = data.equityName; this.equityName = data.equityName;
this.equityCardId = data.equityClassId
} else { } else {
this.showToast(message) this.showToast(message)
} }
...@@ -97,6 +97,35 @@ export default { ...@@ -97,6 +97,35 @@ export default {
jumpOpen() { jumpOpen() {
window.vm.$router.push({ name: 'common.activate' }); window.vm.$router.push({ name: 'common.activate' });
}, },
async toOpenEquity(){
this.showLoading();
let orderSource = 1// h5 1 mini 3 app 2
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
orderSource = 1
}else if (window.__wxjs_environment === 'miniprogram') {
orderSource = 3
}else {
orderSource = 2
}
let para = {
equityClassId:this.equityCardId,
orderCode:this.orderCode,
orderSource:orderSource,
sessionId: this.sessionId,
}
let payData = await cardRoll.getCardBuy(para).then(res=>{
this.hideLoading()
let { code, data, message } = res
if (code == 0) {
return data
} else {
this.showToast(message)
}
})
console.log(payData,'----------');
},
async buyCard() { async buyCard() {
this.showLoading(); this.showLoading();
let payMannerId; let payMannerId;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="line_icon"></div> <div class="line_icon"></div>
<div class="line_text">{{ index+1 }}、{{item.couponName}}</div> <div class="line_text">{{ index+1 }}、{{item.couponName}}</div>
</div> </div>
<div class="line_right">去使用</div> <div class="line_right" @click="todetailPage">去使用</div>
</div> </div>
<div v-if="packageInfo.notes" class="title_tip">附:{{packageInfo.notes}}</div> <div v-if="packageInfo.notes" class="title_tip">附:{{packageInfo.notes}}</div>
</div> </div>
...@@ -55,6 +55,7 @@ export default { ...@@ -55,6 +55,7 @@ export default {
}, },
methods: { methods: {
getDetailInfo(orderCode){ getDetailInfo(orderCode){
this.showLoading();
let { sessionId} = this.$store.state; let { sessionId} = this.$store.state;
let para = { let para = {
orderCode, orderCode,
...@@ -65,6 +66,7 @@ export default { ...@@ -65,6 +66,7 @@ export default {
this.packageInfo = res.data this.packageInfo = res.data
this.packageInfo.createDate = new Date(this.packageInfo.createDate).format("yyyy-MM-dd hh:mm:ss") this.packageInfo.createDate = new Date(this.packageInfo.createDate).format("yyyy-MM-dd hh:mm:ss")
} }
this.hideLoading();
}) })
}, },
toOpenLocation(){ toOpenLocation(){
...@@ -75,7 +77,13 @@ export default { ...@@ -75,7 +77,13 @@ export default {
gasAddress:temp.merchantAddress gasAddress:temp.merchantAddress
} }
this.openNavigation(val,WX) this.openNavigation(val,WX)
} },
todetailPage() {
let { sessionId } = this.$store.state;
let [href] = window.location.href.split("/#/");
let url = `${href}/#/cardRoll/couponsDetail?sessionId=${sessionId}`;
this.openWindows(url, "cardRoll.couponsDetail");
},
}, },
}; };
</script> </script>
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
<div v-for="(item,index) in packageInfo.couponsDetailList" :key="index" class="package_element"> <div v-for="(item,index) in packageInfo.couponsDetailList" :key="index" class="package_element">
<div class="ele_top">{{index+1}}、{{ item.couponName }}</div> <div class="ele_top">{{index+1}}、{{ item.couponName }}</div>
<div class="ele_right">数量:x{{item.serviceQuantity}}</div> <div class="ele_right">数量:x{{item.serviceQuantity}}</div>
<div v-if="item.useType!=0&&item.effectiveType==1" class="ele_left">有效期:{{item.effectiveDays}}天</div> <div v-if="item.useType==2&&item.effectiveType==1" class="ele_left">有效期:{{item.effectiveDays}}天</div>
<div v-if="item.useType!=0&&item.effectiveType==2" class="ele_left">有效期:{{item.effectiveStarttime}}-{{item.effectiveEndTime}}</div> <div v-if="item.useType==1&&item.effectiveType==2" class="ele_left">有效期:{{new Date(item.effectiveEndTime).format('yyyy-MM-dd hh:mm:ss')}}</div>
<div v-if="item.useType==0" class="ele_left">有效期:无有效期</div> <div v-if="item.useType==0" class="ele_left">有效期:无有效期</div>
<div v-if="item.useType==1" class="ele_bottom">有效期内可用{{item.useAmount}}次</div> <div v-if="item.useType==1&&item.effectiveType==2" class="ele_bottom">有效期内可用{{item.useAmount}}次</div>
<div v-if="item.useType==2" class="ele_bottom">有效期内每{{item.useLimitDays}}天可用{{item.useAmount}}次</div> <div v-if="item.useType==2&&item.effectiveType==1" class="ele_bottom">有效期内每{{item.useLimitDays}}天可用{{item.useAmount}}次</div>
<div v-if="item.useType==0" class="ele_bottom"></div> <div v-if="item.useType==0" class="ele_bottom"></div>
</div> </div>
<div v-if="packageInfo.notes" class="content_tip">附:{{packageInfo.notes}}</div> <div v-if="packageInfo.notes" class="content_tip">附:{{packageInfo.notes}}</div>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</div> </div>
</div> </div>
<div class="title_min_tip">注意:套餐一经购买,不支持退款</div> <div class="title_min_tip">注意:套餐一经购买,不支持退款</div>
<div class="buy_btn" @click="jumpToPackageDetail"> <div class="buy_btn" @click="toBuyPackage">
限时特价仅需¥{{packageInfo.packagePrice}},点击购买 限时特价仅需¥{{packageInfo.packagePrice}},点击购买
</div> </div>
<div style="height: 28px"></div> <div style="height: 28px"></div>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import {cardRoll,commodity} from "@r/api"; import {commodity} from "@r/api";
export default { export default {
name: "", name: "",
data() { data() {
...@@ -57,6 +57,7 @@ export default { ...@@ -57,6 +57,7 @@ export default {
let options = this.$route.query let options = this.$route.query
this.getDetailInfo(options.id) this.getDetailInfo(options.id)
this.getPaySource() this.getPaySource()
this.getOrderCode()
}, },
methods: { methods: {
// 判断当前环境获取支付环境 // 判断当前环境获取支付环境
...@@ -87,6 +88,7 @@ export default { ...@@ -87,6 +88,7 @@ export default {
// 购买套餐 // 购买套餐
toBuyPackage(){ toBuyPackage(){
//先获取门店订单编号---在发起请求 //先获取门店订单编号---在发起请求
this.showLoading();
let { sessionId} = this.$store.state; let { sessionId} = this.$store.state;
let para = { let para = {
orderCode:this.orderCode, orderCode:this.orderCode,
...@@ -95,14 +97,18 @@ export default { ...@@ -95,14 +97,18 @@ export default {
sessionId:sessionId sessionId:sessionId
} }
console.log(para); console.log(para);
commodity.createStoreOrder(para).then(res=>{
console.log(res,'.............');
this.hideLoading();
})
}, },
// 获取门店单号 // 获取门店单号
getOrderCode(){ getOrderCode(){
this.showLoading(); this.showLoading();
cardRoll.getStoreOrderCode().then(res=>{ commodity.getStoreOrderCode().then(res=>{
const {code,data,message} = res const {code,data,message} = res
if(code==0){ if(code==0){
this.orderCode = data.data this.orderCode = data
}else{ }else{
this.showToast(message); this.showToast(message);
} }
......
...@@ -319,11 +319,12 @@ export default { ...@@ -319,11 +319,12 @@ export default {
if (!phone) { if (!phone) {
// this.equityLogin(); // this.equityLogin();
return; return;
}else{
sessionStorage.setItem("CODE_PAST_DUE",false);
this.$router.replace({ name: "equity.index" });
} }
} }
} }
sessionStorage.setItem("CODE_PAST_DUE",false);
this.$router.replace({ name: "equity.index" });
} }
}, },
clearTel(){ clearTel(){
......
...@@ -66,20 +66,11 @@ export default { ...@@ -66,20 +66,11 @@ export default {
let wheight = window.innerHeight + "px"; let wheight = window.innerHeight + "px";
this.deviceH = wheight; this.deviceH = wheight;
this.getMerchants(); this.getMerchants();
// this.showLoading();
// let self = this;
// setTimeout(() => {
// self.$nextTick(() => {
// self.getTwoHeightArr();
// });
// self.hideLoading();
// }, 2000);
}, },
methods: { methods: {
// 点击跳转商品详情 // 点击跳转商品详情
toNextPage(e, cate) { toNextPage(e, cate) {
let temp = cate.goodsCategory; let temp = cate.goodsCategory;
console.log(temp);
if (temp == "汽车权益") { if (temp == "汽车权益") {
this.CarLink(e); this.CarLink(e);
} else { } else {
...@@ -97,11 +88,13 @@ export default { ...@@ -97,11 +88,13 @@ export default {
}, },
// 获取所有权益商品 // 获取所有权益商品
getMerchants() { getMerchants() {
this.showLoading();
this.equityList = []; this.equityList = [];
let para = { let para = {
merchantId: this.merchantId, merchantId: this.merchantId,
}; };
equity.getMerchantid(para).then((res) => { equity.getMerchantid(para).then((res) => {
this.hideLoading();
let { code, data, message } = res; let { code, data, message } = res;
if (code == 0) { if (code == 0) {
this.equityList = data.goodsServiceList; this.equityList = data.goodsServiceList;
......
...@@ -94,40 +94,45 @@ export default { ...@@ -94,40 +94,45 @@ export default {
} }
}, },
mounted() { mounted() {
// this.listeningBack(); this.addressInfo = this.$store.state.address
this.getOilNoList(); this.getOilNoList();
let longitude,latitude; this.getStationList()
if(this.$store.state.address.longitude) { //首页已经获取过定位了,此处考虑是否还需要重新定位
longitude = this.$store.state.address.longitude; // this.listeningBack();
latitude = this.$store.state.address.latitude; // this.getOilNoList();
} // let longitude,latitude;
if(longitude) { // if(this.$store.state.address.longitude) {
this.mapChange({ longitude, latitude }) // longitude = this.$store.state.address.longitude;
}else { // latitude = this.$store.state.address.latitude;
const ua = navigator.userAgent.toLowerCase() // }
if (ua.match(/MicroMessenger/i) == 'micromessenger') { // if(longitude) {
this.getLocation(); // this.mapChange({ longitude, latitude })
}else { // }else {
this.getMapLocation() // const ua = navigator.userAgent.toLowerCase()
} // if (ua.match(/MicroMessenger/i) == 'micromessenger') {
} // this.getLocation();
// }else {
// this.getMapLocation()
// }
// }
}, },
methods:{ methods:{
listeningBack() { listeningBack() {
const path = window.vm.$store.state.prevPath // const path = window.vm.$store.state.prevPath
window.onpopstate = null; window.onpopstate = null;
window.onpopstate = function() { window.onpopstate = function() {
window.onpopstate = null; window.onpopstate = null;
history.pushState({}, null, window.location.href); history.pushState({}, null, window.location.href);
if(path == 'oilStation.location' || path == 'oilStation.detail' || path == 'oilStation.record') { window.vm.$router.replace({ name: "oilStation.index" });
window.vm.$router.replace({name:window.vm.$store.state.prevPath}) // if(path == 'oilStation.location' || path == 'oilStation.detail' || path == 'oilStation.record') {
window.vm.$router.replace({name:'equity.index'}) // window.vm.$router.replace({name:window.vm.$store.state.prevPath})
// if(sessionStorage.getItem('common') == 1) { // window.vm.$router.replace({name:'equity.index'})
// window.vm.$router.replace({name:'equity.index'}) // if(sessionStorage.getItem('common') == 1) {
// }else { // window.vm.$router.replace({name:'equity.index'})
// window.vm.$router.replace({name:'common.index'}) // }else {
// } // window.vm.$router.replace({name:'common.index'})
} // }
// }
} }
}, },
mapChange(e) { mapChange(e) {
...@@ -239,28 +244,29 @@ export default { ...@@ -239,28 +244,29 @@ export default {
}, },
//导航 //导航
openLocation(val) { openLocation(val) {
const ua = navigator.userAgent.toLowerCase() this.openNavigation(val, WX);
if (ua.match(/MicroMessenger/i) == 'micromessenger') { // const ua = navigator.userAgent.toLowerCase()
WX.openLocation(Number(val.gasAddressLatitude),Number(val.gasAddressLongitude),val.gasName,val.gasAddress,18).then(res => { // if (ua.match(/MicroMessenger/i) == 'micromessenger') {
console.log(res) // WX.openLocation(Number(val.gasAddressLatitude),Number(val.gasAddressLongitude),val.gasName,val.gasAddress,18).then(res => {
}) // console.log(res)
}else{ // })
// let url = `http://uri.amap.com/marker?position=${Number(val.gasAddressLongitude)},${Number(val.gasAddressLatitude)}&name=${val.gasAddress}&coordinate=gaode&callnative=1`; // }else{
// this.openWindows(url); // // let url = `http://uri.amap.com/marker?position=${Number(val.gasAddressLongitude)},${Number(val.gasAddressLatitude)}&name=${val.gasAddress}&coordinate=gaode&callnative=1`;
if (this.checkPhoneType() == 'ios') { // // this.openWindows(url);
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({ type: 8,address:val.gasAddress,latitude:Number(val.gasAddressLatitude),longitude:Number(val.gasAddressLongitude)})) // if (this.checkPhoneType() == 'ios') {
} else { // window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({ type: 8,address:val.gasAddress,latitude:Number(val.gasAddressLatitude),longitude:Number(val.gasAddressLongitude)}))
window.myjs.jumpNativeApp(JSON.stringify({ type: 8,address:val.gasAddress,latitude:Number(val.gasAddressLatitude),longitude:Number(val.gasAddressLongitude)})) // } else {
} // window.myjs.jumpNativeApp(JSON.stringify({ type: 8,address:val.gasAddress,latitude:Number(val.gasAddressLatitude),longitude:Number(val.gasAddressLongitude)}))
} // }
// }
}, },
//更新定位 //更新定位
jumpLocation() { jumpLocation() {
window.vm.$router.replace({ name: 'oilStation.location'}) window.vm.$router.push({ name: 'oilStation.location'})
}, },
//加油记录 //加油记录
jumpRecord() { jumpRecord() {
window.vm.$router.replace({ name: 'oilStation.record' }) window.vm.$router.push({ name: 'oilStation.record' })
}, },
//详情 //详情
jumpDetail(val) { jumpDetail(val) {
......
...@@ -153,13 +153,14 @@ export default { ...@@ -153,13 +153,14 @@ export default {
let { longitude, latitude } = e; let { longitude, latitude } = e;
let lnglat = [longitude, latitude]; let lnglat = [longitude, latitude];
geocoder.getAddress(lnglat, (status, result) => { geocoder.getAddress(lnglat, (status, result) => {
let { info, regeocode: { formattedAddress } } = result let { info, regeocode: { formattedAddress,addressComponent:{adcode} } } = result
if (status === 'complete' && info === 'OK') { if (status === 'complete' && info === 'OK') {
// result为对应的地理位置详细信息 // result为对应的地理位置详细信息
this.addressInfo = { this.addressInfo = {
longitude, longitude,
latitude, latitude,
address: formattedAddress address: formattedAddress,
cityCode: adcode,
} }
this.$store.commit('setAddress',this.addressInfo) this.$store.commit('setAddress',this.addressInfo)
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!