Commit 4e2b5245 by 杨北旺

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

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