1.对接H5接口

2.优化H5打包
yj-dev
杨杰 4 years ago
parent 939d6656c8
commit 9b8964f50b
  1. 13
      Utils/Api.js
  2. 15
      components/Authorize.vue
  3. 6
      manifest.json
  4. 18
      pages/goods/externalCoupon/externalCoupon.vue
  5. 98
      pages/goods/goods.vue
  6. 34
      pages/goods/store-list/store-details.vue
  7. 209
      pages/login/register.vue
  8. 46
      pages/order/confirmation.vue
  9. 8
      pages/tabBar/category/category.vue
  10. 8
      pages/tabBar/home/home.vue
  11. 2
      pages/tabBar/user/user.vue
  12. 3
      pages/user/order_list/order_list.vue
  13. BIN
      static/img/share/wxd.png

@ -139,7 +139,18 @@ export const getStoreList = params => {
export const getH5UserInfo = params => {
return POST('GET', `${base}/wechat/getH5UserInfo`, params).then(res => res.data);
}
//获取验证码
export const sendSmsCode = params => {
return POST('GET', `${base}/sms/sendSmsCode`, params).then(res => res.data);
}
//绑定手机号
export const bindUserPhone = params => {
return POST('GET', `${base}/highUser/bindUserPhone`, params).then(res => res.data);
}
//注册
export const H5login = params => {
return POST('GET', `${base}/user/login`, params).then(res => res.data);
}
//**门店//
export const userLogin = params => {

@ -50,7 +50,6 @@
methods: {
iscode() {
let that = this;
if (!app.globalData.userInfo) {
this.isShowAuth = true;
} else {}
@ -106,29 +105,17 @@
});
},
fail: res => {
console.log('========' + JSON.stringify(res));
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
}
})
// } else {
// fail: res => {
// uni.showToast({
// title: "",
// icon: "none"
// });
// }
// }
// }
// })
that.isShowAuth = false
},
getH5userinfo(){
uni.navigateTo({
url:'/pages/login/register'
url:'/pages/login/register?id=1'
})
// location.href='https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsgcs.dctpay.com%2FH5%2Findex.html%23%2F&response_type=code&scope=snsapi_userinfo#wechat_redirect';
},

@ -82,12 +82,12 @@
},
"title" : "嗨森逛",
"router" : {
"mode" : "",
"base" : ""
"mode" : "hash",
"base" : "/H5"
},
"devServer" : {
"port" : "",
"https" : false
"https" : true
},
"domain" : "https://hsgcs.dctpay.com",
"template" : ""

@ -14,8 +14,8 @@
</view>
</view>
<view class="line1 mart15"></view>
<button class="coupne-btn width60w mart20 marb20" v-if="userInfo == 1" lang="zh_CN"
@click="getuserinfo" withCredentials="true">点击领取</button>
<button class="coupne-btn width60w mart20 marb20" v-if="userInfo == 1" lang="zh_CN" @click="getuserinfo"
withCredentials="true">点击领取</button>
<button class="coupne-btn width60w mart20 marb20" v-else @click="receiveDiscount">点击领取</button>
<view class="width90 mart10 fcor666">去使用</view>
<view v-if="minecoupones == '' " class="mart60 fotct font14 fcor666">
@ -190,8 +190,8 @@
// wx.login({
// success(res) {
// if (res.code) {
//
// var code = res.code
//
// var code = res.code;
//
uni.getUserProfile({
desc: '登录中...',
@ -240,6 +240,15 @@
});
}
})
// } else {
// uni.showToast({
// title: "",
// icon: "none"
// });
// }
// }
// })
},
//
toGoods(e) {
@ -261,7 +270,6 @@
</script>
<style lang="scss">
.coupon-mes {
// margin-right: 90px;
}

@ -1,14 +1,16 @@
<template>
<view>
<!-- #ifdef H5 -->
<view class="header">
<!-- 头部-默认显示 -->
<view class="before" :style="{ opacity: 1 - afterHeaderOpacity, zIndex: beforeHeaderzIndex }">
<view class="back"><view class="icon xiangqian" @tap="back" v-if="showBack"></view></view>
<view class="back">
<view class="icon xiangqian" @tap="back" v-if="showBack"></view>
</view>
<view class="middle"></view>
</view>
</view>
<!-- #endif -->
<!-- 底部菜单 -->
<view class="footer">
<button v-if="user == '' " class="width100 fotct btnfot" @click="getuserinfo">
@ -95,11 +97,14 @@
<view class="description">
<view class="title"> 商品详情 </view>
<view class="content marb65">
<image mode="widthFix" class="width100" v-for="codes in couponDesc" :key="codes" :src="imageUrl+codes" @click="perImage(codes)">
<image mode="widthFix" class="width100" v-for="codes in couponDesc" :key="codes" :src="imageUrl+codes"
@click="perImage(codes)">
</image>
</view>
</view>
<!-- <authorize></authorize> -->
<!-- #ifdef H5 -->
<authorize></authorize>
<!-- #endif -->
</view>
</template>
@ -109,12 +114,12 @@
GetPhoneNumber,
getUserInfo
} from "../../Utils/Api.js";
// import authorize from '../../components/Authorize.vue'
import authorize from '../../components/Authorize.vue'
let app = getApp()
export default {
// components: {
// authorize
// },
components: {
authorize
},
data() {
return {
//
@ -202,20 +207,10 @@
perImage(item) {
uni.previewImage({
current: 0, //
urls: [this.imageUrl+item] //
urls: [this.imageUrl + item] //
})
},
//
// toGoods(e) {
// console.log('=========='+e);
// // uni.showToast({
// // title: '' + e.goods_id,
// // icon: 'none'
// // });
// uni.navigateTo({
// url: 'goods'
// });
// },
/**
* 跳转门店详情
*/
@ -234,12 +229,7 @@
url: '../msg/msg'
})
},
//
toChat() {
// uni.navigateTo({
// url:"../msg/chat/chat?name=008"
// })
},
//
share() {
this.shareClass = 'show';
@ -267,46 +257,6 @@
title: "已加入购物车"
});
},
//
// getPhoneNumber(PhoneNumber) {
// let params = {
// openId: app.globalData.openId,
// iv: PhoneNumber.detail.iv,
// encryptedData: PhoneNumber.detail.encryptedData
// }
// GetPhoneNumber(params).then(res => {
// if (res.return_code == '000000') {
// app.globalData.userInfo = res.return_data
// .object
// .highUser;
// uni.setStorage({
// key: "user",
// data: res.return_data
// .object
// .highUser
// })
// let that = this;
// if (that.goodsData[0].stockCount) {
// uni.showToast({
// title: '...',
// icon: 'none',
// duration: 2000,
// success() {
// uni.navigateTo({
// url: '../order/confirmation?id=' + that.goodsData[0].id
// })
// }
// })
// } else {
// uni.showToast({
// title: '',
// icon: 'none',
// duration: 2000
// })
// }
// }
// });
// },
//
getuserinfo() {
// uni.showLoading({
@ -317,7 +267,7 @@
// success(res) {
// if (res.code) {
//
// var code = res.code
// var code = res.code;
//
uni.getUserProfile({
desc: '登录中...',
@ -330,6 +280,7 @@
getUserInfo(params).then(res => {
if (res.return_code == '000000') {
uni.hideLoading();
that.user = res.return_data.object.highUser;
app.globalData.userInfo = res
.return_data
.object
@ -366,19 +317,13 @@
});
}
})
// } else {
// fail: res => {
// uni.showToast({
// title: "",
// icon: "none"
// });
// }
// }
// },
// fail(res) {
// uni.hideLoading();
// }
// })
},
@ -785,9 +730,11 @@
position: relative;
width: 100%;
height: 100vw;
swiper {
width: 100%;
height: 100vw;
swiper-item {
image {
width: 100%;
@ -795,7 +742,8 @@
}
}
}
.indicator{
.indicator {
display: flex;
justify-content: center;
align-items: center;

@ -38,12 +38,13 @@
</view>
<view class="width90">
<button class="store-jdes flleft mart5" @click="jumpCoupondes(mers.id,mers.highCouponModel.id)">查看详情</button>
<button class="store-jdes flleft mart5"
@click="jumpCoupondes(mers.id,mers.highCouponModel.id)">查看详情</button>
</view>
</view>
<view class="loading-text" v-if="productList != '' ">{{ loadingText }}</view>
<!-- <authorize></authorize> -->
<authorize></authorize>
</view>
</template>
@ -53,12 +54,12 @@
getCouponListByStoreId,
getUserInfo
} from '../../../Utils/Api.js';
// import authorize from '../../../components/Authorize';
import authorize from '../../../components/Authorize';
let app = getApp();
export default {
// components: {
// authorize
// },
components: {
authorize
},
data() {
return {
imageUrl: app.globalData.imgUrl,
@ -96,8 +97,7 @@
this.merchanId = option.id;
this.distance = option.juli;
this.getMerchantStoreById();
if (!this.user) {
} else {
if (!this.user) {} else {
this.getCouponListByStoreId();
}
@ -115,8 +115,8 @@
// wx.login({
// success(res) {
// if (res.code) {
//
// var code = res.code
// //
// var code = res.code;
//
uni.getUserProfile({
desc: '登录中...',
@ -166,20 +166,22 @@
});
}
})
// } else {
// fail: res => {
// uni.showToast({
// title: "",
// icon: "none"
// });
// }
// }
// },
// fail(res) {
// uni.hideLoading();
// }
// })
// }
// })
},
//
@ -200,9 +202,9 @@
})
},
//
jumpCoupondes(e,item) {
jumpCoupondes(e, item) {
uni.navigateTo({
url: '../coupon-details/coupon-details?id='+e +'&mendId='+item
url: '../coupon-details/coupon-details?id=' + e + '&mendId=' + item
})
},
//
@ -236,7 +238,7 @@
uni.hideLoading();
this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true;
this.menCoupnList = this.menCoupnList.concat(res.return_data.list);
if(res.return_data.total == (this.pageNum * this.pageSize)){
if (res.return_data.total == (this.pageNum * this.pageSize)) {
this.isNoMoreData = true;
}
this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum;

File diff suppressed because one or more lines are too long

@ -142,9 +142,16 @@
</image>{{paytheprice*100}}
</view>
</view>
<!-- #ifdef MP -->
<button class="btn" open-type="getPhoneNumber" v-if="user.phone == null"
@getphonenumber="getPhoneNumber">实际支付</button>
<button class="btn" v-else @tap="toPay">实际支付</button>
<!-- #endif -->
<!-- #ifdef H5 -->
<button class="btn" v-if="user.phone == null" @getphonenumber="bindUserPhone">实际支付</button>
<button class="btn" v-else @tap="toPay">实际支付</button>
<!-- #endif -->
</view>
</view>
</view>
@ -155,7 +162,8 @@
addOrder,
getCouponById,
GetPhoneNumber,
getUserNormalDiscountList
getUserNormalDiscountList,
bindUserPhone
} from '../../Utils/Api.js';
let app = getApp();
export default {
@ -202,30 +210,6 @@
this.getUserNormalDiscountList();
},
onShow() {
//
// uni.getStorage({
// key: 'buylist',
// success: (ret) => {
// this.buylist = ret.data;
// this.goodsPrice = 0;
// //
// let len = this.buylist.length;
// for (let i = 0; i < len; i++) {
// this.goodsPrice = this.goodsPrice + (this.buylist[i].number * this.buylist[i].price);
// }
// this.deduction = this.int / 100;
// this.sumPrice = this.goodsPrice - this.deduction + this.freight;
// }
// });
// uni.getStorage({
// key: 'selectAddress',
// success: (e) => {
// this.recinfo = e.data;
// uni.removeStorage({
// key: 'selectAddress'
// })
// }
// })
},
onHide() {
@ -303,7 +287,8 @@
if (this.couponList.salesPrice > this.UserNormalDiscountList[i].highDiscount.discountPrice) {
//
this.deductionPrice = this.UserNormalDiscountList[i].highDiscount.discountPrice;
this.paytheprice = (((this.couponList.salesPrice*100) - (this.deductionPrice*100))/100);
this.paytheprice = (((this.couponList.salesPrice * 100) - (this.deductionPrice * 100)) /
100);
} else {
uni.showToast({
title: '未满足满减条件',
@ -314,7 +299,7 @@
} else if (this.UserNormalDiscountList[i].highDiscount.discountType == 2) {
//
this.deductionPrice = this.UserNormalDiscountList[i].highDiscount.discountPrice;
this.paytheprice = (((this.couponList.salesPrice*100) - (this.deductionPrice*100))/100);
this.paytheprice = (((this.couponList.salesPrice * 100) - (this.deductionPrice * 100)) / 100);
} else if (this.UserNormalDiscountList[i].highDiscount.discountType == 3) {
//
this.deductionPrice = this.couponList.salesPrice - this.couponList.salesPrice * (this
@ -325,6 +310,13 @@
}
}
},
// H5
jumpH5Bding() {
uni.navigateTo({
url:'/pages/login/register?id=2'
})
},
//
getPhoneNumber(PhoneNumber) {
let params = {
openId: app.globalData.openId,

@ -56,9 +56,7 @@
<!-- <view class="loading-text" @click="getCouponList">{{ loadingText }}</view> -->
</scroll-view>
</view>
<!-- #ifdef H5 -->
<authorize></authorize>
<!-- #endif -->
</view>
</template>
<script>
@ -67,12 +65,8 @@
getStoreListByMerchant,
getMerchantList
} from "../../../Utils/Api.js";
import authorize from '../../../components/Authorize';
let app = getApp();
export default {
components: {
authorize
},
data() {
return {
showCategoryIndex: 0,

@ -105,9 +105,7 @@
</view>
<!-- <view class="loading-text">{{ loadingText }}</view> -->
</view>
<!-- #ifdef H5 -->
<authorize></authorize>
<!-- #endif -->
</view>
</template>
@ -118,12 +116,8 @@
getCouponList,
getH5UserInfo
} from "../../../Utils/Api.js"; //api
import authorize from '../../../components/Authorize';
let app = getApp();
export default {
components: {
authorize
},
data() {
return {
showHeader: true,

@ -95,7 +95,7 @@
</view>
<!-- 占位 -->
<view class="place-bottom"></view>
<!-- <authorize></authorize> -->
<authorize></authorize>
</view>
</template>
<script>

@ -115,6 +115,9 @@
},
onLoad(option) {
// #ifdef H5
this.headerTop = '44px';
// #endif
let tbIndex = parseInt(option.tbIndex) + 1;
this.list = this.orderList[tbIndex];
this.tabbarIndex = tbIndex;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Loading…
Cancel
Save