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. 16
      pages/goods/externalCoupon/externalCoupon.vue
  5. 94
      pages/goods/goods.vue
  6. 28
      pages/goods/store-list/store-details.vue
  7. 167
      pages/login/register.vue
  8. 44
      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 => { export const getH5UserInfo = params => {
return POST('GET', `${base}/wechat/getH5UserInfo`, params).then(res => res.data); 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 => { export const userLogin = params => {

@ -50,7 +50,6 @@
methods: { methods: {
iscode() { iscode() {
let that = this; let that = this;
if (!app.globalData.userInfo) { if (!app.globalData.userInfo) {
this.isShowAuth = true; this.isShowAuth = true;
} else {} } else {}
@ -106,29 +105,17 @@
}); });
}, },
fail: res => { fail: res => {
console.log('========' + JSON.stringify(res));
uni.showToast({ uni.showToast({
title: "微信登录授权失败", title: "微信登录授权失败",
icon: "none" icon: "none"
}); });
} }
}) })
// } else {
// fail: res => {
// uni.showToast({
// title: "",
// icon: "none"
// });
// }
// }
// }
// })
that.isShowAuth = false that.isShowAuth = false
}, },
getH5userinfo(){ getH5userinfo(){
uni.navigateTo({ 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'; // 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" : "嗨森逛", "title" : "嗨森逛",
"router" : { "router" : {
"mode" : "", "mode" : "hash",
"base" : "" "base" : "/H5"
}, },
"devServer" : { "devServer" : {
"port" : "", "port" : "",
"https" : false "https" : true
}, },
"domain" : "https://hsgcs.dctpay.com", "domain" : "https://hsgcs.dctpay.com",
"template" : "" "template" : ""

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

@ -1,14 +1,16 @@
<template> <template>
<view> <view>
<!-- #ifdef H5 -->
<view class="header"> <view class="header">
<!-- 头部-默认显示 --> <!-- 头部-默认显示 -->
<view class="before" :style="{ opacity: 1 - afterHeaderOpacity, zIndex: beforeHeaderzIndex }"> <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 class="middle"></view>
</view> </view>
</view> </view>
<!-- #endif -->
<!-- 底部菜单 --> <!-- 底部菜单 -->
<view class="footer"> <view class="footer">
<button v-if="user == '' " class="width100 fotct btnfot" @click="getuserinfo"> <button v-if="user == '' " class="width100 fotct btnfot" @click="getuserinfo">
@ -95,11 +97,14 @@
<view class="description"> <view class="description">
<view class="title"> 商品详情 </view> <view class="title"> 商品详情 </view>
<view class="content marb65"> <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> </image>
</view> </view>
</view> </view>
<!-- <authorize></authorize> --> <!-- #ifdef H5 -->
<authorize></authorize>
<!-- #endif -->
</view> </view>
</template> </template>
@ -109,12 +114,12 @@
GetPhoneNumber, GetPhoneNumber,
getUserInfo getUserInfo
} from "../../Utils/Api.js"; } from "../../Utils/Api.js";
// import authorize from '../../components/Authorize.vue' import authorize from '../../components/Authorize.vue'
let app = getApp() let app = getApp()
export default { export default {
// components: { components: {
// authorize authorize
// }, },
data() { data() {
return { return {
// //
@ -205,17 +210,7 @@
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' url: '../msg/msg'
}) })
}, },
//
toChat() {
// uni.navigateTo({
// url:"../msg/chat/chat?name=008"
// })
},
// //
share() { share() {
this.shareClass = 'show'; this.shareClass = 'show';
@ -267,46 +257,6 @@
title: "已加入购物车" 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() { getuserinfo() {
// uni.showLoading({ // uni.showLoading({
@ -317,7 +267,7 @@
// success(res) { // success(res) {
// if (res.code) { // if (res.code) {
// //
// var code = res.code // var code = res.code;
// //
uni.getUserProfile({ uni.getUserProfile({
desc: '登录中...', desc: '登录中...',
@ -330,6 +280,7 @@
getUserInfo(params).then(res => { getUserInfo(params).then(res => {
if (res.return_code == '000000') { if (res.return_code == '000000') {
uni.hideLoading(); uni.hideLoading();
that.user = res.return_data.object.highUser;
app.globalData.userInfo = res app.globalData.userInfo = res
.return_data .return_data
.object .object
@ -366,19 +317,13 @@
}); });
} }
}) })
// } else { // } else {
// fail: res => {
// uni.showToast({ // uni.showToast({
// title: "", // title: "",
// icon: "none" // icon: "none"
// }); // });
// } // }
// } // }
// },
// fail(res) {
// uni.hideLoading();
// }
// }) // })
}, },
@ -785,9 +730,11 @@
position: relative; position: relative;
width: 100%; width: 100%;
height: 100vw; height: 100vw;
swiper { swiper {
width: 100%; width: 100%;
height: 100vw; height: 100vw;
swiper-item { swiper-item {
image { image {
width: 100%; width: 100%;
@ -795,6 +742,7 @@
} }
} }
} }
.indicator { .indicator {
display: flex; display: flex;
justify-content: center; justify-content: center;

@ -38,12 +38,13 @@
</view> </view>
<view class="width90"> <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> </view>
<view class="loading-text" v-if="productList != '' ">{{ loadingText }}</view> <view class="loading-text" v-if="productList != '' ">{{ loadingText }}</view>
<!-- <authorize></authorize> --> <authorize></authorize>
</view> </view>
</template> </template>
@ -53,12 +54,12 @@
getCouponListByStoreId, getCouponListByStoreId,
getUserInfo getUserInfo
} from '../../../Utils/Api.js'; } from '../../../Utils/Api.js';
// import authorize from '../../../components/Authorize'; import authorize from '../../../components/Authorize';
let app = getApp(); let app = getApp();
export default { export default {
// components: { components: {
// authorize authorize
// }, },
data() { data() {
return { return {
imageUrl: app.globalData.imgUrl, imageUrl: app.globalData.imgUrl,
@ -96,8 +97,7 @@
this.merchanId = option.id; this.merchanId = option.id;
this.distance = option.juli; this.distance = option.juli;
this.getMerchantStoreById(); this.getMerchantStoreById();
if (!this.user) { if (!this.user) {} else {
} else {
this.getCouponListByStoreId(); this.getCouponListByStoreId();
} }
@ -115,8 +115,8 @@
// wx.login({ // wx.login({
// success(res) { // success(res) {
// if (res.code) { // if (res.code) {
// // //
// var code = res.code // var code = res.code;
// //
uni.getUserProfile({ uni.getUserProfile({
desc: '登录中...', desc: '登录中...',
@ -166,20 +166,22 @@
}); });
} }
}) })
// } else { // } else {
// fail: res => {
// uni.showToast({ // uni.showToast({
// title: "", // title: "",
// icon: "none" // icon: "none"
// }); // });
// } // }
// }
// }, // },
// fail(res) { // fail(res) {
// uni.hideLoading(); // uni.hideLoading();
// } // }
// }) // })
// }
// })
}, },
// //

File diff suppressed because one or more lines are too long

@ -142,9 +142,16 @@
</image>{{paytheprice*100}} </image>{{paytheprice*100}}
</view> </view>
</view> </view>
<!-- #ifdef MP -->
<button class="btn" open-type="getPhoneNumber" v-if="user.phone == null" <button class="btn" open-type="getPhoneNumber" v-if="user.phone == null"
@getphonenumber="getPhoneNumber">实际支付</button> @getphonenumber="getPhoneNumber">实际支付</button>
<button class="btn" v-else @tap="toPay">实际支付</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> </view>
</view> </view>
@ -155,7 +162,8 @@
addOrder, addOrder,
getCouponById, getCouponById,
GetPhoneNumber, GetPhoneNumber,
getUserNormalDiscountList getUserNormalDiscountList,
bindUserPhone
} from '../../Utils/Api.js'; } from '../../Utils/Api.js';
let app = getApp(); let app = getApp();
export default { export default {
@ -202,30 +210,6 @@
this.getUserNormalDiscountList(); this.getUserNormalDiscountList();
}, },
onShow() { 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() { onHide() {
@ -303,7 +287,8 @@
if (this.couponList.salesPrice > this.UserNormalDiscountList[i].highDiscount.discountPrice) { if (this.couponList.salesPrice > this.UserNormalDiscountList[i].highDiscount.discountPrice) {
// //
this.deductionPrice = 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 { } else {
uni.showToast({ uni.showToast({
title: '未满足满减条件', title: '未满足满减条件',
@ -325,6 +310,13 @@
} }
} }
}, },
// H5
jumpH5Bding() {
uni.navigateTo({
url:'/pages/login/register?id=2'
})
},
//
getPhoneNumber(PhoneNumber) { getPhoneNumber(PhoneNumber) {
let params = { let params = {
openId: app.globalData.openId, openId: app.globalData.openId,

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

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

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

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Loading…
Cancel
Save