diff --git a/app.json b/app.json index bb6845f..fb2085c 100644 --- a/app.json +++ b/app.json @@ -46,9 +46,10 @@ "pages/distribution/list", "pages/distribution/user", "pages/distribution/detail", - "pages/mchList/mchList", "pages/chooseArea/chooseArea", - "pages/login/register" + "pages/login/register", + "pages/shop/shop", + "pages/store/store" ], "window": { "backgroundTextStyle": "light", diff --git a/app.wxss b/app.wxss index 08c3bc6..5036f66 100644 --- a/app.wxss +++ b/app.wxss @@ -11,7 +11,7 @@ page { display: flex; flex-direction: column; box-sizing: border-box; - font-family: '微软雅黑'; + font-family: serif; } .df{ display: -webkit-box; diff --git a/pages/group_buy/payfor.wxml b/pages/group_buy/payfor.wxml index c4fbf73..6417062 100644 --- a/pages/group_buy/payfor.wxml +++ b/pages/group_buy/payfor.wxml @@ -64,7 +64,7 @@ - + 钱包余额 @@ -76,7 +76,7 @@ 包邮 {{freight}}元 - + 选择支付方式 diff --git a/pages/group_buy/payfor.wxss b/pages/group_buy/payfor.wxss index 98579ce..659d756 100644 --- a/pages/group_buy/payfor.wxss +++ b/pages/group_buy/payfor.wxss @@ -70,11 +70,11 @@ margin-bottom:10px; } .x_right{ - width:16px; - height: 18px; - display:inline-block; - vertical-align: middle; - float: right; + width:16px; + height: 18px; + /* display: inline-block; */ + /* vertical-align: middle; */ + float: right; } .zhifu{ background: #fff; @@ -133,9 +133,9 @@ height:52px; text-align:center; line-height:52px; } -.left { +/* .left { -} +} */ .right { color: #333; diff --git a/pages/index/index.js b/pages/index/index.js index dccaa5c..192d2dc 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -234,9 +234,9 @@ Page({ // url:"/pages/detail/detail?id="+goodsId.id }) }, - navToMchList: function (e) { + navToShopList: function (e) { wx.navigateTo({ - url:"../mchList/mchList" + url:"/pages/shop/shop" }) }, onHide: function () { diff --git a/pages/index/index.wxml b/pages/index/index.wxml index e45e6f6..f106b49 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -154,13 +154,13 @@ 优选店铺 - + 更多 - + {{item.name}} {{item.distance}}km diff --git a/pages/mchList/mchList.json b/pages/mchList/mchList.json deleted file mode 100644 index 6549430..0000000 --- a/pages/mchList/mchList.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "usingComponents": {}, - "navigationBarTitleText": "优选店铺", - "navigationBarBackgroundColor": "#FA5151", - "navigationBarTextStyle": "white" -} \ No newline at end of file diff --git a/pages/mchList/mchList.wxml b/pages/mchList/mchList.wxml deleted file mode 100644 index 7bd6f2b..0000000 --- a/pages/mchList/mchList.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/mchList/mchList.wxml diff --git a/pages/mchList/mchList.wxss b/pages/mchList/mchList.wxss deleted file mode 100644 index 75c2d95..0000000 --- a/pages/mchList/mchList.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/mchList/mchList.wxss */ \ No newline at end of file diff --git a/pages/new/new.js b/pages/new/new.js index 5c51f85..9c95654 100644 --- a/pages/new/new.js +++ b/pages/new/new.js @@ -255,15 +255,6 @@ Page({ }); }, onShow: function () { - var cont = this.data.cont; - var that = this; - if (cont > 1) { - that.onLoad(); - } else { - that.setData({ - cont: cont + 1 - }) - } }, onLoad: function (options) { diff --git a/pages/order/pay.js b/pages/order/pay.js index 7c993d4..9e2b4f8 100644 --- a/pages/order/pay.js +++ b/pages/order/pay.js @@ -73,13 +73,13 @@ Page({ onLoad: function (options) { console.log(app.globalData) - console.log('options') + console.log(options) var that = this; that.get_plug(); - wx.setNavigationBarColor({ - frontColor: app.d.frontColor, // - backgroundColor: app.d.bgcolor //设置页面参数 - }) + // wx.setNavigationBarColor({ + // frontColor: app.d.frontColor, // + // backgroundColor: app.d.bgcolor //设置页面参数 + // }) var uid = app.globalData.userInfo.openid; // 微信id var plug_ins = app.globalData.userInfo.plug_ins; // 插件 @@ -95,7 +95,7 @@ Page({ coupon: coupon, // 优惠券状态 wallet: wallet, // 钱包状态 }); - this.Settlement(); + this.Settlement(options); }, @@ -145,103 +145,73 @@ Page({ onShow: function () { var that = this; - console.log(that.data.dz_stu) - if (that.data.dz_stu) { - that.setData({ - dz_stu: false, - }); - // util.getUesrBgplus(that, app, false) - wx.navigateTo({ - url: '../order/pay?cartId=' + that.data.cartId, - }) - } + // console.log(that.data.dz_stu) + // if (that.data.dz_stu) { + // that.setData({ + // dz_stu: false, + // }); + // // util.getUesrBgplus(that, app, false) + // wx.navigateTo({ + // url: '../order/pay?cartId=' + that.data.cartId, + // }) + // } - if (that.data.pages_sx) { - setTimeout(function () { - that.Settlement(); - }, 500); - } + // if (that.data.pages_sx) { + // setTimeout(function () { + // that.Settlement(); + // }, 500); + // } }, // 进入结算页面 - Settlement: function () { + Settlement: function (options) { var that = this; - wx.request({ - url: app.d.ceshiUrl + '&action=product&m=Settlement', - method: 'post', - data: { - cart_id: that.data.cartId, // 购物车id - uid: that.data.userId, // 微信id - num1: that.data.num1, //数量 - type: that.data.type, //(1.直接结算 0购物车结算) - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - var status = res.data.status; - if (status == 1) { - if (that.data.allow) { - res.data.arr.coupon_money = Number(res.data.arr.coupon_money) - Number(that.data.allow); - } - if (that.data.d_yuan) { - res.data.arr.coupon_money = Number(res.data.arr.coupon_money) - Number(that.data.user_money); - } - console.log(res.data.arr); - that.setData({ - addemt: res.data.arr.addemt, // 是否有收货地址 - address: res.data.arr.adds, // 收货地址 - addrId: res.data.arr.adds.id ? res.data.arr.adds.id : '', // 收货地址id - productData: res.data.arr.pro, // 商品信息 - total: res.data.arr.price, // 总价 - money: res.data.arr.money, // 优惠券金额 - coupon_money: Number(parseFloat(res.data.arr.coupon_money).toFixed(3).slice(0, -1)), // 优惠后金额 - user_money: res.data.arr.user_money, // 用户余额 - coupon_id: res.data.arr.coupon_id, // 优惠券id - discount: res.data.arr.discount, //控制优惠方式 - scorebuy: res.data.arr.scorebuy, //积分消费规则 - zhekou: res.data.arr.zhekou ? res.data.arr.zhekou : '', //会员折扣 - freight: res.data.arr.yunfei ? res.data.arr.yunfei : 0, //运费 - }); - - that.setData({ - remind: false - }); - } else { - that.setData({ - remind: true - }); - wx.showToast({ - title: res.data.err, - icon: 'none', - duration: 2000, - }); - if (status == 0) { - setTimeout(function () { - // util.getUesrBgplus(that, app, false) - wx.navigateBack({ - delta: 1 - }) - }, 2000); - - } else { - setTimeout(function () { - // util.getUesrBgplus(that, app, false) - wx.navigateBack({ - delta: 1 - }) - }, 2000); - } + WXAPI.settlement({ + accessId: app.globalData.accessId, + storeId: 239, + cart_id: '', + coupon_id: 0, + vipSource: 0, + canshu: true, + product: options.product, + }).then(res => { + if (res.code == 200) { + //设置购物车刷新 + app.d.purchase = 1; + var data = res.data; + if (that.data.allow) { + data.coupon_money = Number(data.coupon_money) - Number(that.data.allow); } - }, - error: function (e) { + if (that.data.d_yuan) { + data.coupon_money = Number(data.coupon_money) - Number(that.data.user_money); + } + that.setData({ + addemt: data.addemt, // 是否有收货地址 + address: data.address, // 收货地址 + addrId: data.address.id ? data.address.id : '', // 收货地址id + productData: data.products, // 商品信息 + total: data.total, // 总价 + money: data.reduce_money, // 优惠券金额 + coupon_money: Number(parseFloat(data.coupon_money).toFixed(3).slice(0, -1)), // 优惠后金额 + user_money: data.user_money, // 用户余额 + coupon_id: data.coupon_id, // 优惠券id + discount: data.discount, //控制优惠方式 + scorebuy: data.grade_rate_amount, //积分消费规则 + zhekou: data.preferential_amount ? data.preferential_amount : '', //会员折扣 + freight: data.freight ? data.freight : 0, //运费 + remind: false + }); + } else { + that.setData({ + remind: true + }); wx.showToast({ - title: '网络异常!', - duration: 2000 + title: res.message, + icon: 'none', + duration: 2000, }); } }); - }, // 点击优惠券 tapMainMenu: function (e) { // 获取当前显示的一级菜单标识 diff --git a/pages/order/pay.wxml b/pages/order/pay.wxml index e7a346b..64e74c0 100644 --- a/pages/order/pay.wxml +++ b/pages/order/pay.wxml @@ -25,8 +25,7 @@ -
- + @@ -48,41 +47,41 @@ - - - + + + + {{item.shop_name}} + + + + + - {{item.product_title}} [{{item.size}}] + ¥ {{item.price}} - ¥ {{item.price}} - x{{item.Goods_num}} + x{{item.num}} - + + + - - 钱包余额 - 余额抵扣{{d_yuan}} - {{user_money}}元 - - 运费 包邮 {{freight}}元 - - + 优惠券 使用优惠券:{{money}} @@ -90,12 +89,17 @@ - + 活动 {{name}} + + 钱包余额 + 余额抵扣{{d_yuan}} + {{user_money}}元 + - + 选择支付方式 @@ -118,15 +122,13 @@ 合计: - ¥ {{coupon_money}} + ¥ {{total}} - -
diff --git a/pages/order/pay.wxss b/pages/order/pay.wxss index edb2862..3d7d4e8 100644 --- a/pages/order/pay.wxss +++ b/pages/order/pay.wxss @@ -11,10 +11,15 @@ page{ background:#eee; } .item .cp_photo{ - width: 60px; - height: 60px; - overflow: hidden; - border-radius: 3px; + overflow: hidden; + border-radius: 3px; + display:flex; + align-items:center; + padding-right: 20rpx; +} +.cp_photo image{ + width: 70px; + height: 70px; } .wx_pay_submit{ margin-top: 10px; @@ -83,8 +88,8 @@ page{ .x_right{ width:16px; height: 18px; - display:inline-block; - vertical-align: middle; + /* display:inline-block; + vertical-align: middle; */ float: right; } .zhifu{ @@ -729,6 +734,25 @@ left:-13px; .p_all { border-bottom:1px solid #eee; } +.shop-view { + display:flex; + height: 60rpx; + align-items: center; +} +.shop-view image { + width: 40rpx; + height: 40rpx; + margin-left: 25rpx; +} +.shop-view text{ + margin-left: 12rpx; + font-size: 28rpx; +} +.shop-view .jiantou-img { + width: 25rpx; + height: 25rpx; + margin-left: 20rpx; +} .drawer_screen { width: 100%; height: 100%; @@ -755,28 +779,30 @@ left:-13px; } .sp_text{ display:flex; - line-height: 20px; + line-height: 23px; width: 100%; text-align: left; padding-left:8px; } .sp_tit{ - width: 100%; - overflow: hidden; - font-size: 13px; - -webkit-line-clamp:2; + flex-wrap: wrap; + width: 100%; + /* overflow: hidden; */ + font-size: 13px; + -webkit-line-clamp:2; } .sp_jg{ - width: 30%; - overflow: hidden; - font-size: 13px; - color: #fc0628; + width: 30%; + overflow: hidden; + font-size: 13px; + color: #fc0628; } .guige{ - font-size:13px; - color:#808080; - text-align:right; - padding-right:10px; + margin-top: 90rpx; + font-size:13px; + color:#808080; + text-align:right; + padding-right:10px; } diff --git a/pages/product/detail.js b/pages/product/detail.js index dbb41f7..d334d7c 100644 --- a/pages/product/detail.js +++ b/pages/product/detail.js @@ -13,6 +13,7 @@ Page({ winHeight: 0, currentTab: 0, //tab切换 productId: 0, + attributeId: 0, itemData: {}, wsc: 'bxs', sc: 'bxs', @@ -44,29 +45,29 @@ Page({ duration: 1500, }); - app.request.wxRequest({ - url: '&action=getcode&m=product_share', - data: { - product_img_path: that.data.itemData.photo_d, - product_title: that.data.title, - price: that.data.itemData.price_yh, - yprice: that.data.itemData.price, - scene: 'productId=' + that.data.productId + '&referee_openid=' + app.globalData.userInfo.user_id, - path: 'pages/product/detail', - id: app.globalData.userInfo.user_id, - pid: that.data.productId, - head: app.globalData.userInfo.avatarUrl, - name: app.globalData.userInfo.nickName, - type: 3 - }, - method: 'post', - success: function (res) { - that.setData({ - maskHidden: true, - imagePath: res.url, - }); - } - }) + // app.request.wxRequest({ + // url: '&action=getcode&m=product_share', + // data: { + // product_img_path: that.data.itemData.photo_d, + // product_title: that.data.title, + // price: that.data.itemData.price_yh, + // yprice: that.data.itemData.price, + // scene: 'productId=' + that.data.productId + '&referee_openid=' + app.globalData.userInfo.user_id, + // path: 'pages/product/detail', + // id: app.globalData.userInfo.user_id, + // pid: that.data.productId, + // head: app.globalData.userInfo.avatarUrl, + // name: app.globalData.userInfo.nickName, + // type: 3 + // }, + // method: 'post', + // success: function (res) { + // that.setData({ + // maskHidden: true, + // imagePath: res.url, + // }); + // } + // }) var animation = wx.createAnimation({ duration: 200, @@ -127,23 +128,22 @@ Page({ // 属性选择 onShow: function () { var that = this; - + that.getUserId(); }, - //接受formid - getUserformid: function (e) { - var formid = e.detail.formId; - this.sendFormid(formid, 'kt1'); - this.setModalStatus(e); - }, - //接受formid - sendFormid: function (fromid, page) { - var that = this - app.request.wxRequest({ - url: '&action=draw&m=getFormid', - data: { from_id: fromid, userid: app.globalData.userInfo.openid, page: page }, - method: 'post', - success: function () { - + getUserId() { + WXAPI.userIndex({ + accessId: app.globalData.accessId, + storeId: 239, + storeType: 1, + mobile:'', + }).then(res => { + if (res.code == 200) { + var data = res.data; + if (!data.data) { + wx.removeStorageSync('accessId') + wx.removeStorageSync('isLogin'); + wx.removeStorageSync('userInfo'); + } } }) }, @@ -152,7 +152,7 @@ Page({ var that = this; var choujiangid = that.data.choujiangid; var openid = app.globalData.userInfo.openid; - console.log(app.globalData.userInfo, 'openid') + // console.log(app.globalData.userInfo, 'openid') // if (openid) { var bgcolor = app.d.bgcolor; // wx.setNavigationBarColor({ @@ -521,62 +521,45 @@ Page({ /* 点击确定 */ submit: function (e) { var that = this; - var sizeid = that.data.sizeid; - - if (sizeid == '' || sizeid.length < 1) { - wx.showToast({ - title: '请完善属性', - icon: 'loading', - duration: 1000 - }) + var type = e.currentTarget.dataset.type; + if (type == 'buynow') { + that.buyNow(e) } else { - var type = e.target.dataset.type; - var sizeid = sizeid; - that.addShopCart(e, sizeid) + that.addShopCart(e) } }, //购物车直接结算 - Settlement: function () { + settlement: function () { console.log('-Settlement-') wx.switchTab({ url: '../cart/cart' }) return; }, - addShopCart: function (e, sizeid) { + //加入购物车 + addShopCart: function (e) { //添加到购物车 var that = this; - var pro_type = e.target.dataset.type; - var ptype = e.currentTarget.dataset.type; - // console.log(ptype, '--jnkmjkl') WXAPI.productAddCart({ - uid: app.globalData.userInfo.openid, - pid: that.data.productId, + accessId: app.globalData.accessId, + storeId: 239, + storeType: 1, + pro_id: that.data.productId, + attribute_id: that.data.sizeid, num: that.data.buynum, - sizeid: sizeid, - pro_type: pro_type, + type: 'addcart', }).then(res => { if (res.code == 200) { //设置购物车刷新 app.d.purchase = 1; - var data = res.data; - var ptype = e.currentTarget.dataset.type; - if (ptype == 'buynow') { - wx.redirectTo({ - url: '../order/pay?cartId=' + data.cart_id + '&pid=' + that.data.productId + '&num=' + that.data.buynum + '&type=1', - }); - return; - } else { - wx.showToast({ - title: '加入购物车成功', - icon: 'success', - duration: 2000 - }); - // util.getUesrBgplus(that, app, true) - that.setData({ - showModalStatus: false - }); - } + wx.showToast({ + title: '加入购物车成功', + icon: 'success', + duration: 2000 + }); + that.setData({ + showModalStatus: false + }); } else { wx.showToast({ icon: 'loading', @@ -586,6 +569,26 @@ Page({ } }); }, + //立即购买 + buyNow: function (e) { + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) + } + //添加到购物车 + var that = this; + var productArr = [] + productArr.push({pid: that.data.productId}) + productArr.push({cid: that.data.sizeid}) + productArr.push({num: that.data.buynum}) + // productArr.push({}) + let jsonstr = JSON.stringify(productArr) + wx.navigateTo({ + url: '../order/pay?product=' + jsonstr + '&cart_id=' + that.data.cart_id, + }); + }, bindChange: function (e) {//滑动切换tab var that = this; that.setData({ currentTab: e.detail.current }); @@ -617,7 +620,6 @@ Page({ } }, - onShareAppMessage: function (res) { var that = this; var id = that.data.productId; @@ -739,23 +741,17 @@ Page({ preventTouchMove: function (e) { }, - add_fromid: function (e) { - var isLogin = wx.getStorageSync('isLogin') - if (!isLogin) { - wx.navigateTo({ - url: '/pages/login/login' - }) - } - + showAttribute: function (e) { + // console.log(e) var that = this; - var formId = e.detail.formId; var animation = wx.createAnimation({ duration: 200, timingFunction: "linear", delay: 0 }); //定义点击的类型 - var type = e.detail.target.dataset.type ? e.detail.target.dataset.type : false; + + var type = e.currentTarget.dataset.type ? e.currentTarget.dataset.type : false; //控制两种不同显示方式 if (type) { this.setData({ @@ -773,7 +769,7 @@ Page({ paytype: type, animationData: animation.export() }) - if (e.detail.target.dataset.status == 1) { + if (e.currentTarget.dataset.status == 1) { this.setData({ showModalStatus: true }); @@ -783,24 +779,12 @@ Page({ this.setData({ animationData: animation }) - if (e.detail.target.dataset.status == 0) { + if (e.currentTarget.dataset.status == 0) { this.setData({ showModalStatus: false }); } }.bind(this), 200); - if (formId != 'the formId is a mock one') { - var page = 'pages/product/detail' - app.request.wxRequest({ - url: '&action=product&m=save_formid', - data: { from_id: formId, userid: app.globalData.userInfo.openid }, - method: 'post', - success: function (res) { - - } - }) - } - }, // 弹窗 set_share: function (e) { diff --git a/pages/product/detail.wxml b/pages/product/detail.wxml index 633d965..bddc45d 100644 --- a/pages/product/detail.wxml +++ b/pages/product/detail.wxml @@ -26,7 +26,7 @@ - + {{index+1}}/{{bannerItem.length}} @@ -90,18 +90,16 @@ -
- -
+ @@ -159,16 +157,16 @@
- 确定 + 确定 - - 加入购物车 - 立即购买 - + + 加入购物车 + 立即购买 +
@@ -190,7 +188,7 @@