diff --git a/README.md b/README.md index 718d037..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,43 +0,0 @@ -# uni-app 电商模板 - -自己研究开发的纯uni-app电商前端模板,会不定期更新模板内容,功能,UI界面的。 -#### 如果对您有用 好评哦 (^ω^) - -## 说明 -1. css部分使用了uni.scss部分变量, 其他语法已剔除特殊语法, 除变量外可直接替换其他css预处理器 -2. app.vue下定义了个别全局样式以及引用iconfont图标 -3. 该项目为前端页面效果展示, 数据和图片来自网络,均只用于案例展示,可以删除,文件在/static/img,请勿用于其他用途。 -## 版本更新说明 - -#### 1.0.2 -1. 增加登录/注册UI界面 -2. 购物车增加失效商品列表 -3. 购物车细节小调整 - -#### 1.0.1 -1. UI界面适配全面屏,异形屏。 -2. 增加商品详情限时秒杀活动价格展示。 -### 展示码 -![image text](http://static.996ico.cn/static/picture/996shop/qr_code/h5_code.png) - -**H5版本** - -![image text](http://static.996ico.cn/static/picture/996shop/qr_code/app_code.png) - -**APP版本(仅支持安卓请不要用微信扫码)** - -### 界面展示 -![image text](http://static.996ico.cn/static/picture/996shop/img/home.jpg) - -![image text](http://static.996ico.cn/static/picture/996shop/img/goods.jpg) - -![image text](http://static.996ico.cn/static/picture/996shop/img/show_01.png) - -![image text](http://static.996ico.cn/static/picture/996shop/img/show_02.jpg) - -![image text](http://static.996ico.cn/static/picture/996shop/img/show_03.jpg) -### 其他说明 -- 商城可以用作搭建项目,勿做其他非法用途,切记切记!! -- UI组件部分使用ColorUI-UniApp 感谢作者 文晓港 -- 如商城遇到部分问题,可以评论留言,我会都看到的 - diff --git a/common/api.js b/common/api.js index 50b50ad..6f6b11f 100644 --- a/common/api.js +++ b/common/api.js @@ -57,7 +57,7 @@ export const getWarehouseList = (params, config = {custom: { auth: true }}) => h //商品列表 export const getGoodsList = (params, config = {custom: { auth: true }}) => http.post('/api/order/getGoodsList', params, config); //商品详情 -export const getgoodsDetail = (params, config = {custom: { auth: true }}) => http.post('/api/order/goodsDetail', params, config); +export const getgoodsDetail = (params, config = {custom: { auth: true }}) => http.get('/api/order/goodsDetail', {params}, config); //买方订单 export const getBuyerOrderList = (params, config = {custom: { auth: true }}) => http.get('/api/order/getBuyerOrderList', {params}, config); //卖方订单 diff --git a/pages/MyCoupon/MyCoupon.vue b/pages/MyCoupon/MyCoupon.vue index 48e9fc2..7190cff 100644 --- a/pages/MyCoupon/MyCoupon.vue +++ b/pages/MyCoupon/MyCoupon.vue @@ -80,7 +80,7 @@ export default { userMyCoupon(item){ // if(item.status!="used"){ uni.navigateTo({ - url: '/pages/warehouse/weituo?coupon_id='+item.id+'&num='+item.amount+'&coupon=1&id='+this.id + url: '/pages/warehouse/weituo?coupon_id='+item.id+'&num='+item.amount+'&coupon=1&id='+this.id+"&enough="+item.enough }) // } diff --git a/pages/home/home.vue b/pages/home/home.vue index 689cb1a..807cf84 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -140,7 +140,7 @@ export default { // #endif }, onLoad() { - this.H5Login() + // this.H5Login() }, onPageScroll(e){ let scrollTop = e.scrollTop; @@ -208,32 +208,32 @@ export default { break; } }, - getQueryString(name) { - let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); - let r = window.location.search.substr(1).match(reg); - if (r !== null) return unescape(r[2]); - return null; - }, - H5Login(){ - let pageUrl = window.location.href; + // getQueryString(name) { + // let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); + // let r = window.location.search.substr(1).match(reg); + // if (r !== null) return unescape(r[2]); + // return null; + // }, + // H5Login(){ + // let pageUrl = window.location.href; - let code =this.getQueryString('code'); - console.log(code,"lldd"); - let appid="wx5a2c9f7e82918b85" + // let code =this.getQueryString('code'); + // console.log(code,"lldd"); + // let appid="wx5a2c9f7e82918b85" - let redirect_uri = encodeURIComponent(pageUrl); - // let redirect_uri = pageUrl; - console.log(redirect_uri) - let authUrl = - `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=STATE&connect_redirect=1#wechat_redirect`; - if (code) { - uni.setStorageSync("code",code) - } else { - window.location.href = authUrl; - console.log("没有code") - // return await Promise.reject("跳转授权"); - } - } + // let redirect_uri = encodeURIComponent(pageUrl); + // // let redirect_uri = pageUrl; + // console.log(redirect_uri) + // let authUrl = + // `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=STATE&connect_redirect=1#wechat_redirect`; + // if (code) { + // uni.setStorageSync("code",code) + // } else { + // // window.location.href = authUrl; + // console.log("没有code") + // // return await Promise.reject("跳转授权"); + // } + // } } }; diff --git a/pages/login/login.vue b/pages/login/login.vue index 0a23f86..9887931 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -109,8 +109,25 @@ export default { }) return; } + let pageUrl = window.location.href; + + let code =this.getQueryString('code'); + console.log(code,"lldd"); + let appid="wx5a2c9f7e82918b85" + + let redirect_uri = encodeURIComponent(pageUrl); + // let redirect_uri = pageUrl; + console.log(redirect_uri) + let authUrl = + `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=STATE&connect_redirect=1#wechat_redirect`; + if (code) { + uni.setStorageSync("code",code) + } else { + window.location.href = authUrl; + console.log("没有code") + // return await Promise.reject("跳转授权"); + } loginApi({account:this.form.phone,password:this.form.password,code:uni.getStorageSync("code")}).then(res=>{ - if(res.code==1){ setUserInfo(res.data.userinfo) setToken(res.data.userinfo.token); @@ -120,7 +137,13 @@ export default { } }) - } + }, + getQueryString(name) { + let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); + let r = window.location.search.substr(1).match(reg); + if (r !== null) return unescape(r[2]); + return null; + }, }, watch:{ form:{ diff --git a/pages/qianggou/productDetails.vue b/pages/qianggou/productDetails.vue index 2a90ab8..8adb2f7 100644 --- a/pages/qianggou/productDetails.vue +++ b/pages/qianggou/productDetails.vue @@ -80,7 +80,7 @@ export default { methods: { getDetailsHandle(id){ - getgoodsDetail({id:id}).then(res=>{ + getgoodsDetail({id:id,custom: { auth: true }}).then(res=>{ this.swiperList.push({ url: res.data.image }) diff --git a/pages/register/register.vue b/pages/register/register.vue index 677ab70..f4b35e2 100644 --- a/pages/register/register.vue +++ b/pages/register/register.vue @@ -114,7 +114,7 @@ export default { * 注册点击 */ onRegister(){ - userRegister({username:this.form.username,mobile:this.form.phone,code:this.form.code,password:this.form.password,invite_mobile:this.inviteMobile,code:uni.getStorageSync("code")}).then(res=>{ + userRegister({username:this.form.username,mobile:this.form.phone,code:this.form.code,password:this.form.password,invite_mobile:this.inviteMobile}).then(res=>{ console.log(res,"密码") if(res.code==1){ this.$refs.uToast.show({ diff --git a/pages/warehouse/weituo.vue b/pages/warehouse/weituo.vue index cf73b02..e663c38 100644 --- a/pages/warehouse/weituo.vue +++ b/pages/warehouse/weituo.vue @@ -113,6 +113,8 @@ sxf:null, switchValue:1, total:0, + enough:0, + couponNumOrgin:0, }; }, methods:{ @@ -123,6 +125,32 @@ use_commission:this.switchValue, } payUpGoods(params).then(res=>{ + + if (typeof WeixinJSBridge != "undefined") { + WeixinJSBridge.invoke( + 'getBrandWCPayRequest', { + "appId": rea.data.pay_data.appId, + "timeStamp": rea.data.pay_data.timeStamp, + "nonceStr": rea.data.pay_data.nonceStr, + "package": rea.data.pay_data.package, + "signType": rea.data.pay_data.signType, + "paySign": rea.data.pay_data.paySign + }, + function(res) { + if (res.err_msg == "get_brand_wcpay_request:ok") { + uni.showToast({ + title:"支付成功", + icon:'none' + }); + } else { + uni.showToast({ + title:"支付失败", + icon:'none' + }); + + } + }) + } this.getOrderDetails() }) @@ -149,7 +177,14 @@ console.log(this.max) let sxf = Number(res.data.order_amount)*(Number(this.sxfRadio)/100) this.sxf = sxf.toFixed(2) - this.total = (Number(this.orderDetails.order_amount)+ Number(this.sxf) - Number(this.couponNum)).toFixed(2); + if(this.sxf>this.enough){ + this.total = (Number(this.sxf) - Number(this.couponNum)).toFixed(2); + this.couponNum = this.couponNumOrgin + }else{ + this.total = (Number(this.sxf)).toFixed(2); + this.couponNum = 0 + } + }) }, sliderChange(val){ @@ -159,45 +194,13 @@ this.total = (Number(this.orderDetails.order_amount)+ Number(this.sxf) - Number(this.couponNum)).toFixed(2); }, - // 微信支付 - async pay(pay_list) { - let that = this; - // #ifdef H5 - if (typeof WeixinJSBridge != "undefined") { - return new Promise((resove, reject) => { - WeixinJSBridge.invoke( - 'getBrandWCPayRequest', { - "appId": "", //公众号ID,由商户传入 - "timeStamp": "", //时间戳,自1970年以来的秒数 - "nonceStr": "", //随机串 - "package": "", - "signType": "", //微信签名方式: - "paySign": "" //微信签名 - }, - function(res) { - if (res.err_msg == "get_brand_wcpay_request:ok") { - setTimeout(() => { - resove(true) - }, 1000) - } else { - that.showToast({ - title: `支付失败` - }) - setTimeout(() => { - reject("支付失败") - }, 1000) - } - }) - }); - } - // #endif - }, }, onLoad(option) { if(option.coupon){ this.coupon_id = option.coupon_id; - this.couponNum = Number(option.num); + this.couponNumOrgin = Number(option.num); + this.enough = Number(option.enough) } this.id = option.id; this.getOrderDetails() diff --git a/unpackage/dist/build/h5/index.html b/unpackage/dist/build/h5/index.html index e4be8b5..3893087 100644 --- a/unpackage/dist/build/h5/index.html +++ b/unpackage/dist/build/h5/index.html @@ -1,2 +1,2 @@