diff --git a/App.vue b/App.vue index 4e988ba..7221fc6 100644 --- a/App.vue +++ b/App.vue @@ -37,7 +37,6 @@ }, onShow: function() { // 获取导航栏信息 - wx.getSystemInfo({ success: res => { this.globalData.systemInfo = res; @@ -150,7 +149,7 @@ } page { - background-color: #F9F9F9; + background-color: #F6F6F6!important; } text { diff --git a/common/js/api.js b/common/js/api.js index 8f69837..ade21d5 100644 --- a/common/js/api.js +++ b/common/js/api.js @@ -71,7 +71,7 @@ export default { paymemeberIn(data) { //充值 return uni.api.post("/pay/memeberIn", data); }, - + orderorderList(data) { //订单列表 return uni.api.get("/order/orderList", data); @@ -285,5 +285,76 @@ export default { cancelTakeNumber(data) { return uni.api.post("/callTable/cancel", data, false); }, - + + + + /** + * 积分-基本设置-获取店铺设置 + * @param {Object} param + */ + shopSettingInfo(shopId) { + return uni.api.get(`/api/points/basic-setting/${shopId}`); + }, + + /** + * 积分-兑换商品列表 + * @param {Object} param + */ + pointsGoodsList(param) { + return uni.api.get("/api/points/goods-setting/page", param); + }, + + /** + * 积分-生成订单 + * @param {Object} data + */ + pointsCreateOrder(data) { + return uni.api.post("/api/points/exchange-record/create", data); + }, + /** + * 积分-支付订单 + * @param {Object} data + */ + pointsPayOrder(data) { + return uni.api.post("/api/points/exchange-record/pay", data); + }, + /** + * 积分-取消订单 + * @param {Object} data + */ + pointsCancelOrder(data) { + return uni.api.post("/api/points/exchange-record/cancel", data); + }, + /** + * 积分-001-会员积分账户信息 + * @param {Object} param + */ + memberPointsInfo(memberId) { + return uni.api.get(`/api/points/member-points/${memberId}`, ); + }, + + /** + * 积分-明细列表 + * @param {Object} param + */ + memberPointsLogList(param) { + return uni.api.get("/api/points/member-points-log/page", param); + }, + + /** + * 积分-兑换记录-列表 + * @param {Object} param + */ + exchangeRecordList(param) { + return uni.api.get("/api/points/exchange-record/page", param); + }, + + /** + * 积分-获取订单可用积分及抵扣金额 + * @param {Object} param + */ + calcUsablePoints(param) { + return uni.api.get("/api/points/member-points/calc-usable-points", param); + }, + } \ No newline at end of file diff --git a/components/popupad.vue b/components/popupad.vue index 742e3be..8960d29 100644 --- a/components/popupad.vue +++ b/components/popupad.vue @@ -12,14 +12,15 @@ radius='10' @change="e => current = e.current" @click="swiperClick" - bgColor="transparent" height='720' + bgColor="transparent" height="920" > - + - + + @@ -207,7 +208,8 @@ justify-content: center; align-items: center; .swiperBox{ - width: 80%; + width: 85%; + margin-top: 50rpx; margin-bottom: 50rpx; } .swiper__wrapper__item__wrapper__image{ diff --git a/framework/0-conf.js b/framework/0-conf.js index 44b09ed..3b14b89 100644 --- a/framework/0-conf.js +++ b/framework/0-conf.js @@ -6,10 +6,10 @@ const proxyApi = "/api" // const proxyApi = 'http://192.168.1.15:9888/cashierService' // 王伟 // const proxyApi = 'http://192.168.1.27:9888/cashierService' // 帆哥 // const proxyApiwws = 'ws://192.168.1.15:9888/netty' // 测试 -// const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试 -// const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试 -const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上 -const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 线上 +const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试 +const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试 +// const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上 +// const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 线上 // #endif // #ifdef H5 diff --git a/framework/1-utils.js b/framework/1-utils.js index fc02306..fd608a7 100644 --- a/framework/1-utils.js +++ b/framework/1-utils.js @@ -260,6 +260,7 @@ const getUserInfo = function (successCallback, failCallback) { }, fail: (err) => {} }); + } }); @@ -269,23 +270,23 @@ const getUserInfo = function (successCallback, failCallback) { // #ifdef MP-ALIPAY return new Promise((resolve, reject) => { my.getAuthCode({ - scopes: 'auth_user', - success: (data) => { + scopes: 'auth_base', + success: async (data) => { console.log(data) // 支付宝小程序环境 - my.getAuthUserInfo({ - success: async (infoRes) => { + // my.getAuthUserInfo({ + // success: async (infoRes) => { let res = await Api.userwxlogin({ code: data.authCode, //临时登录凭证 - rawData: JSON.stringify(infoRes), + // rawData: JSON.stringify(infoRes), source: 'alipay' }) if (res.code == 0) { resolve(res) } - }, - fail: (err) => {} - }); + // }, + // fail: (err) => {} + // }); } }); }) diff --git a/framework/11-api.js b/framework/11-api.js index 4c4c7d8..aa063c4 100644 --- a/framework/11-api.js +++ b/framework/11-api.js @@ -125,7 +125,6 @@ async function request(options) { uni.cache.set('storage:offset-time', offset, -1) return await request(options) } else { - console.log(options) uni.showToast({ title: res.message || res.msg || res.error, icon: "none", diff --git a/pages.json b/pages.json index 3c7140b..8413075 100644 --- a/pages.json +++ b/pages.json @@ -373,6 +373,63 @@ } } ] + }, + { + "root": "pagesPoints", + "pages": [ + { + "path": "index/index", + "style": { + "navigationBarTitleText": "积分商城", + "navigationBarBackgroundColor": "#E9B183" + } + }, + { + "path": "goodsDetail/index", + "style": { + "navigationBarTitleText": "商品详情" + } + }, + { + "path": "exchangeRecord/index", + "style": { + "navigationBarTitleText": "兑换记录" + } + }, + { + "path": "exchangeRecordDetail/index", + "style": { + "navigationBarTitleText": "订单详情" + } + }, + { + "path": "IntegralDetail/index", + "style": { + "navigationBarTitleText": "积分明细" + } + }, + { + "path": "confirm_order/index", + "style": { + "navigationBarTitleText": "确认订单", + "navigationBarBackgroundColor": "#E9B183" + } + } + + + ] + }, + { + "root": "pagesInviteFriends", + "pages": [ + { + "path": "index/index", + "style": { + "navigationBarTitleText": "邀请好友", + "navigationStyle": "custom" + } + } + ] } ], "globalStyle": { diff --git a/pages/index/indexs.vue b/pages/index/indexs.vue index 7087ae0..b6d64ef 100644 --- a/pages/index/indexs.vue +++ b/pages/index/indexs.vue @@ -91,6 +91,10 @@ }) }, memberindex(url) { + // uni.pro.navigateTo("/pagesInviteFriends/index/index", { + // shopId: uni.cache.get('shopId'), + // type: 'index', + // }) uni.pro.navigateTo(url, { shopId: uni.cache.get('shopId'), type: 'index', diff --git a/pages/member/index - 副本.vue b/pages/member/index - 副本.vue deleted file mode 100644 index 695940e..0000000 --- a/pages/member/index - 副本.vue +++ /dev/null @@ -1,723 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/member/index.vue b/pages/member/index.vue index bbed540..a7ca791 100644 --- a/pages/member/index.vue +++ b/pages/member/index.vue @@ -23,30 +23,32 @@ - + controlled="true" + @input="amountChange" + > 自定义金额 - + 充值 - {{item.minNum}} - + {{item.amount}} + - - ¥{{ item.handselNum }} + 赠{{inputshow}} + ¥{{ item.giftAmount }} - 赠送{{item.handselNum}}元 + 赠送{{item.giftAmount}}元 @@ -108,8 +110,7 @@ isProtocol: false, listdata: [], amount: 0, - minNum: 0, - handselNum: 0, + giftAmount: 0, userInfo: {}, shopUserInfo: null, shopId: '', @@ -118,33 +119,38 @@ {name: "明细", url: "member/billDetails",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/detail.png"}, {name: "管理", url: "member/storedManage",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/manage.png"} ], - + type: "", } }, - async onLoad(e) { + async onLoad(options) { // if ( e.type == 'list' || e.type == 'index') { // this.shopId = e.shopId; // this.init(); // } - console.log(e) uni.cache.set('forceUpdate',1) - if (e.q) { - this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId') + // #ifdef MP-WEIXIN + if (options.q) { + this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId') uni.cache.set('shopId',this.shopId) this.tokenShow = false; - // 等待登录结果返回 - // if (!uni.cache.get('token')) { - // await this.$onLaunched; - // } - this.shopInfo(); - this.paygetActive() - } else{ - this.shopId = e.shopId; - uni.cache.set('shopId',this.shopId) - this.shopInfo(); - this.paygetActive() } + // #endif + // #ifdef MP-ALIPAY + if (getApp().globalData.shopId) { this.shopId = getApp().globalData.shopId } + uni.cache.set('shopId',this.shopId) + // #endif + + if (options.shopId) { + this.shopId = options.shopId + uni.cache.set('shopId',this.shopId) + } + if (options.type) { + this.type = options.type + } + if ( options.amount ) { this.amount = options.amount; } + this.shopInfo(); + this.paygetActive() }, methods: { /** @@ -193,20 +199,43 @@ let res = await this.api.paygetActive({ shopId: this.shopId, page: 1, - pageSize: 10 + pageSize: 99 }) try { this.listdata = res.data.list; this.giftList = this.listdata[0].gives; - this.amount = this.listdata[0].minNum; - this.minNum = this.listdata[0].minNum; - this.handselNum = this.listdata[0].handselNum + this.giftAmount = this.listdata[0].giftAmount + if ( this.type == 'topUpActivity') { + this.amountChange() + } else { + this.amount = this.listdata[0].amount; + } } catch (e) { //TODO handle the exception } }, + /** + * 监听金额修改 + */ + amountChange () { + let item = this.listdata.filter(item=>this.amount==item.amount) + if ( item.length > 0 ) { + this.listdata.forEach((v,e)=>{ + if ( this.amount == v.amount) { + this.inputshow = e; + this.clickinput(v,e) + } + }) + } else { + this.inputshow = ''; + this.giftList = []; + this.giftAmount = ''; + } + + }, + /** * 进入明细\管理 * @param {Object} e @@ -295,12 +324,10 @@ * @param {Object} b */ clickinput(a, b) { - console.log(a, b) this.inputshow = b; this.giftList = a.gives; - this.amount = a.minNum; - this.minNum = a.minNum; - this.handselNum = a.handselNum; + this.amount = a.amount; + this.giftAmount = a.giftAmount; }, /** @@ -315,6 +342,7 @@ }); return false; } + console.log(this.amount) if (this.amount == null || this.amount == '') { uni.showToast({ title: '金额不能为空', @@ -331,7 +359,13 @@ } let res = await this.api.paymemeberIn({ shopId: this.shopId, // 判断显示哪家的作品, - amount: this.amount // 判断显示哪家的作品, + amount: this.amount ,// 判断显示哪家的作品, + // #ifdef MP-WEIXIN + payType: 'wechatPay', + // #endif + // #ifdef MP-ALIPAY + payType: 'aliPay', + // #endif }) if (res.code == 0) { uni.showLoading({ @@ -356,15 +390,20 @@ uni.requestSubscribeMessage({ tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"], complete() { - if ( pages.length > 1) { - _this.shopInfo() + if ( _this.type && _this.type == "topUpActivity") { + uni.pro.navigateBack() } else { - setTimeout(res => { - uni.switchTab({ - url: '/pages/index/index' - }) - }, 500) + if ( pages.length > 1) { + _this.shopInfo() + } else { + setTimeout(res => { + uni.switchTab({ + url: '/pages/index/index' + }) + }, 500) + } } + }, }) @@ -453,7 +492,7 @@ justify-content: space-between; align-items: center; margin-bottom: 32rpx; - padding: 14rpx 16rpx; + padding: 22rpx 16rpx 22rpx 32rpx; background-color: #fff; border-radius: 8rpx; .customAmount_left{ diff --git a/pages/member/list.vue b/pages/member/list.vue index 004b591..af886c7 100644 --- a/pages/member/list.vue +++ b/pages/member/list.vue @@ -108,12 +108,18 @@ shopId: item.shopId, type: 'index', }) + } else if ( this.type && this.type == 'user_points') { + uni.pro.navigateTo('/pagesPoints/index/index', { + shopId: item.shopId, + type: 'member_list', + }) } else { uni.pro.navigateTo('member/memberdetails', { shopId: item.shopId }) } + } }, diff --git a/pages/order_food/components/shoppingCart.vue b/pages/order_food/components/shoppingCart.vue index 6e0db47..082e2c9 100644 --- a/pages/order_food/components/shoppingCart.vue +++ b/pages/order_food/components/shoppingCart.vue @@ -24,8 +24,13 @@ - {{ item.salePrice }} + {{ item.memberPrice }} + + {{ item.salePrice }} + + + @@ -82,7 +87,7 @@ }, data() { return { - + shopUserInfo: uni.cache.get('shopUserInfo') } }, @@ -297,6 +302,12 @@ } .num {} + .lineThrough{ + font-weight: normal; + text-decoration:line-through; + color: #999!important; + font-size: 24rpx!important; + } } .sku-wrap { diff --git a/pages/order_food/components/shoppingCartBilling.vue b/pages/order_food/components/shoppingCartBilling.vue index b262b82..a4e10bb 100644 --- a/pages/order_food/components/shoppingCartBilling.vue +++ b/pages/order_food/components/shoppingCartBilling.vue @@ -11,7 +11,8 @@ - {{cartLists.amount||'0.00'}} + {{cartLists.memberAmount||'0.00'}} + {{cartLists.amount||'0.00'}} 去结算 @@ -26,7 +27,7 @@ data() { return { - + shopUserInfo: uni.cache.get('shopUserInfo') } }, props:{ diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index ecfef4b..ba04a30 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -61,7 +61,14 @@ - ¥{{item.lowPrice}}/{{item.unitSnap}} + + + ¥ + {{item.lowMemberPrice}} + ¥ + {{item.lowPrice}} + /{{item.unitSnap}} + @@ -73,8 +80,17 @@ - ¥{{item.lowPrice}}/{{item.unitSnap}} + + + ¥ + {{item.lowMemberPrice}} + ¥ + {{item.lowPrice}} + /{{item.unitSnap}} + + + @@ -152,7 +168,13 @@ - {{ item1.lowPrice }}/{{item1.unitSnap}} + + + {{ item1.lowMemberPrice }} + + {{ item1.lowPrice }} + /{{item1.unitSnap}} + 非可售时间 @@ -161,7 +183,15 @@ - {{ item1.lowPrice }}/{{item1.unitSnap}} + + + {{ item1.lowMemberPrice }} + + {{ item1.lowPrice }} + /{{item1.unitSnap}} + + + \ No newline at end of file diff --git a/pages/order_food/order_food_search.vue b/pages/order_food/order_food_search.vue index 8e68d57..7a204b1 100644 --- a/pages/order_food/order_food_search.vue +++ b/pages/order_food/order_food_search.vue @@ -37,7 +37,13 @@ - {{ item1.lowPrice }}/{{item1.unitSnap}} + + + {{ item1.lowMemberPrice }} + + {{ item1.lowPrice }} + /{{item1.unitSnap}} + 非可售时间 @@ -46,7 +52,13 @@ - {{ item1.lowPrice }}/{{item1.unitSnap}} + + + {{ item1.lowMemberPrice }} + + {{ item1.lowPrice }} + /{{item1.unitSnap}} + + :class="tabIndex == item.type?'towcontentlistxitemboxopacity':''" + v-for="(item,index) in tabList" :key="index" @click="towcontentclick(item)"> {{item.name}} - @@ -74,10 +74,8 @@ export default { data() { return { - tabList: [{ - name: '全部', - type: '' - }, + tabList: [ + { name: '未使用', type: '1' @@ -87,13 +85,17 @@ type: '2' } ], - tabIndex: 0, + tabIndex: 1, list: [], - status: "", + status: 1, + type: "", }; }, - onLoad() { + onLoad(options) { + if (options.type) { + this.type = options.type; + } this.getCouponList() }, @@ -101,11 +103,10 @@ /** * 切换类型 - * @param {Object} index * @param {Object} item */ - towcontentclick(index, item) { - this.tabIndex = index; + towcontentclick(item) { + this.tabIndex = item.type; this.status = item.type; this.getCouponList() }, @@ -115,7 +116,7 @@ */ async getCouponList() { try { - let res = await this.api.getUserConpons({ + let res = await this.api.conponList({ userId: uni.cache.get('userInfo').id, shopId: uni.cache.get('shopId'), status: this.status @@ -156,7 +157,7 @@ margin-top: 32rpx; .towcontentlistxitembox { - width: 33%; + width: 50%; font-family: PingFang SC, PingFang SC; font-weight: 500; font-size: 28rpx; @@ -170,8 +171,6 @@ } .towcontentlistxitemboxopacity { - width: 33%; - font-family: PingFang SC, PingFang SC; font-weight: bold; text{ color: #E3AD7F; diff --git a/pages/user/user.vue b/pages/user/user.vue index c42f75a..53f0e2a 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -57,7 +57,7 @@ teblist: [], myAssetsList: [ { name: "储值", type: "recharge", num: 0, icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/storedValue.png"}, - // { name: "积分", type: "", num: 0, icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png"}, + { name: "积分", type: "points", num: 0, icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png"}, { name: "优惠券", type: "my_coupon", num: 0, icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/coupon.png"}, // { name: "权益卡", type: "", num: 0, icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/equityCard.png"} ], @@ -121,6 +121,9 @@ if (res.code == 0) { uni.cache.set('userInfo', res.data); this.userInfo = res.data; + this.myAssetsList[0].num = res.data.balanceAll || ""; + this.myAssetsList[1].num = res.data.pointsAll || ""; + this.myAssetsList[2].num = res.data.couponAll || ""; } }, @@ -180,9 +183,7 @@ } switch (item.type) { case 'my_order': - uni.switchTab({ - url: '/pages/order/order' - }); + uni.pro.switchTab('order/order') break case 'my_member': uni.pro.navigateTo('member/list') @@ -200,7 +201,19 @@ } break - case 'my_coupon': //内部页面 + case 'points': //积分 + if (uni.cache.get('shopId') && uni.cache.get('token')) { + uni.pro.navigateTo('/pagesPoints/index/index', { + shopId: uni.cache.get('shopId'), + type: 'user', + }) + } else{ + uni.pro.navigateTo('member/list', { + type: 'user_points' + }) + } + break; + case 'my_coupon': //优惠券 uni.pro.navigateTo('user/coupon') break; case 'my_info': //内部页面 diff --git a/pagesInviteFriends/index/index.vue b/pagesInviteFriends/index/index.vue new file mode 100644 index 0000000..f6ec0bc --- /dev/null +++ b/pagesInviteFriends/index/index.vue @@ -0,0 +1,295 @@ + + + + + \ No newline at end of file diff --git a/pagesOrder/components/paymentMethod.vue b/pagesOrder/components/paymentMethod.vue index d69cd2d..b53d9c7 100644 --- a/pagesOrder/components/paymentMethod.vue +++ b/pagesOrder/components/paymentMethod.vue @@ -18,7 +18,7 @@ - + @@ -58,10 +58,29 @@ amountVIP:{ type: Object }, + freeCheck: { + type: Boolean + } + }, + watch: { + + freeCheck(newVal,oldVal) { + if ( newVal ) { + // #ifdef MP-WEIXIN + this.radiovalue = 2 + // #endif + // #ifdef MP-ALIPAY + this.radiovalue = 3 + // #endif + let name = this.paymentMethodName[this.radiovalue-1].name; + this.$emit("groupChange",{type:this.radiovalue ,name: name }) + } + } }, mounted() { - console.log(this.amountVIP) + console.log(this.amountVIP) // this.getAount(); + }, methods: { /** @@ -70,6 +89,9 @@ */ groupChange(type) { console.log(type) + if ( this.freeCheck && type == 1 ) { + return; + } this.radiovalue = type; let name = this.paymentMethodName[type-1].name; this.$emit("groupChange",{type:type ,name: name }) @@ -92,7 +114,6 @@ .paymentMethod{ box-sizing: border-box; margin-top: 30rpx; - padding: 0 20rpx 220rpx 20rpx; border-radius: 18rpx; .paymentMethod_content{ background-color: #fff; diff --git a/pagesOrder/components/rechargeFree.vue b/pagesOrder/components/rechargeFree.vue index 2671dfc..960302a 100644 --- a/pagesOrder/components/rechargeFree.vue +++ b/pagesOrder/components/rechargeFree.vue @@ -4,10 +4,10 @@ 优惠 - 充值消费2倍(¥50),本单立享免单! + 充值消费{{freeDingConfig.rechargeTimes}}倍(¥{{freeDingConfig.rechargeThreshold}}),本单立享免单! - + @@ -19,14 +19,34 @@ data() { return { rechargeFreeChecked: false, + disabled: false, } }, props:{ shopUserInfo:{ type: Object }, + freeDingConfig:{ + type: Object + }, + payAmount: { + type: Number + }, + freeDisabled: { + type: Boolean + } + }, + watch: { + freeDisabled (newVal) { + if ( this.payAmount < this.freeDingConfig.rechargeThreshold ) { + this.freeDisabled = true + } + } }, mounted() { + if ( this.payAmount < this.freeDingConfig.rechargeThreshold ) { + this.freeDisabled = true + } }, methods: { @@ -34,7 +54,12 @@ * 监听是否免单 */ changeFree ( e ) { + if ( this.freeDisabled ) { + return; + } + this.rechargeFreeChecked = !this.rechargeFreeChecked; + this.$emit("changeFree",this.rechargeFreeChecked) } } diff --git a/pagesOrder/components/topUpActivity.vue b/pagesOrder/components/topUpActivity.vue index dc7a6b1..8c70d68 100644 --- a/pagesOrder/components/topUpActivity.vue +++ b/pagesOrder/components/topUpActivity.vue @@ -1,6 +1,6 @@