Browse Source

新增店铺列表

master
杜叶春 2 years ago
parent
commit
a5a34fa9f5
  1. 5
      app.json
  2. 2
      app.wxss
  3. 4
      pages/group_buy/payfor.wxml
  4. 14
      pages/group_buy/payfor.wxss
  5. 4
      pages/index/index.js
  6. 4
      pages/index/index.wxml
  7. 6
      pages/mchList/mchList.json
  8. 2
      pages/mchList/mchList.wxml
  9. 1
      pages/mchList/mchList.wxss
  10. 9
      pages/new/new.js
  11. 156
      pages/order/pay.js
  12. 46
      pages/order/pay.wxml
  13. 64
      pages/order/pay.wxss
  14. 190
      pages/product/detail.js
  15. 51
      pages/product/detail.wxml
  16. 26
      pages/product/detail.wxss
  17. 139
      pages/shop/shop.js
  18. 6
      pages/shop/shop.json
  19. 50
      pages/shop/shop.wxml
  20. 118
      pages/shop/shop.wxss
  21. 2
      pages/store/store.js
  22. 3
      pages/store/store.json
  23. 2
      pages/store/store.wxml
  24. 1
      pages/store/store.wxss
  25. 9
      pages/user/user.js
  26. 24
      utils/server.js
  27. 2
      wxParse/wxParse.wxml

5
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",

2
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;

4
pages/group_buy/payfor.wxml

@ -64,7 +64,7 @@
</block>
</view>
</view>
<view style='height:10px;widht:100%;background:#eee;'></view>
<view style='height:10px;width:100%;background:#eee;'></view>
<view style='background:#fff;'>
<view wx:if="{{plug_wallet}}" class="pay_qb pd" style='border-bottom:1px solid #eee;'>
<text class="left">钱包余额</text>
@ -76,7 +76,7 @@
<text wx:if="{{freight == 0}}" class="right">包邮</text>
<text wx:else class="right">{{freight}}元</text>
</view>
<view style='height:10px;widht:100%;background:#eee;'></view>
<view style='height:10px;width:100%;background:#eee;'></view>
<view class="pay_zf pd">
<text class="left">选择支付方式</text>
</view>

14
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;

4
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 () {

4
pages/index/index.wxml

@ -154,13 +154,13 @@
<view class="home_title">
<view class="mch_name">优选店铺</view>
<image class="home_title_bg" src="/images/home_title_bg.png"></image>
<view class="more" bindtap="navToMchList">
<view class="more" bindtap="navToShopList">
<text>更多</text>
<image src="/images/x_right.png" lazy-load="true"></image>
</view>
</view>
<view class="mch_content">
<view class="mch_content_item" wx:for="{{r_mch}}" wx:for-item="item" wx:key="id" bindtap="navToMchList">
<view class="mch_content_item" wx:for="{{r_mch}}" wx:for-item="item" wx:key="id" bindtap="navToShopList">
<image src="{{item.logo}}" lazy-load="true" mode="aspectFill"></image>
<view>{{item.name}}</view>
<text>{{item.distance}}km</text>

6
pages/mchList/mchList.json

@ -1,6 +0,0 @@
{
"usingComponents": {},
"navigationBarTitleText": "优选店铺",
"navigationBarBackgroundColor": "#FA5151",
"navigationBarTextStyle": "white"
}

2
pages/mchList/mchList.wxml

@ -1,2 +0,0 @@
<!--pages/mchList/mchList.wxml-->
<text>pages/mchList/mchList.wxml</text>

1
pages/mchList/mchList.wxss

@ -1 +0,0 @@
/* pages/mchList/mchList.wxss */

9
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) {

156
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) { // 获取当前显示的一级菜单标识

46
pages/order/pay.wxml

@ -25,8 +25,7 @@
<!-- 加载页面结束 -->
<block wx:else>
<!--普通结算开始 -->
<form bindsubmit="createProductOrderByWX" report-submit="true">
<view class="w100" style='padding-bottom:100px;'>
<view class="w100" style='padding-bottom:100px;' bindtap="createProductOrderByWX">
<!-- 收货地址 -->
<view class="p_all bg_white mt10 font_14 top_xt" wx:if="{{addrId != ''}}">
<view bindtap='go' data-url="../address/index?cartId={{cartId}}" hover-class="none">
@ -48,41 +47,41 @@
</view>
</view>
<!-- 产品信息 -->
<view class="p_all bg_white df item" style='height:70px;' wx:key="key" wx:for="{{productData}}">
<view class="cp_photo" style='height:70px;display:flex;align-items:center;'>
<image style='line-height:70px;' src="{{item.photo_x}}"></image>
<view class="shop-list" wx:key="key" wx:for="{{productData}}" >
<view class="shop-view">
<image src="{{item.shop_logo}}" mode="aspectFill"></image>
<text class="left">{{item.shop_name}}</text>
<image class="jiantou-img" src="/images/x_right.png" mode="aspectFill"></image>
</view>
<view class="p_all bg_white df item" style='height:70px;' wx:key="key" wx:for="{{item.list}}">
<view class="cp_photo">
<image src="{{item.img}}" mode="aspectFill"></image>
</view>
<view class="df_1">
<view class="sp_text">
<view style='width:70%;'>
<view class="sp_tit ovh1" style="color: #000;">{{item.product_title}}</view>
<view class="sp_tit ovh1" style='color:#808080'>[{{item.size}}]</view>
<view class='sp_tit ovh1'>¥ {{item.price}} </view>
</view>
<view class="sp_jg">
<view class='guige'>¥ {{item.price}} </view>
<view class='guige'>x{{item.Goods_num}}</view>
<view class='guige'>x{{item.num}}</view>
</view>
</view>
</view>
</view>
<view style='height:10px;widht:100%;background:#eee;'></view>
</view>
<view style='height:10px;width:100%;background:#eee;'></view>
<!-- 信息 -->
<view style='background:#fff;'>
<view class="pay_qb pd" style='border-bottom:1px solid #eee;'>
<text class="left">钱包余额</text>
<text wx:if="{{d_yuan}}" class="right">余额抵扣{{d_yuan}}</text>
<text wx:else class="right">{{user_money}}元</text>
</view>
<view class="pay_qb pd" style='border-bottom:1px solid #eee;'>
<text class="left">运费</text>
<text wx:if="{{freight == 0}}" class="right">包邮</text>
<text wx:else class="right">{{freight}}元</text>
</view>
<view wx:if="{{plug_coupon && discount}}" bindtap="setModalStatus" data-type="" data-status="1" style='border-bottom:1px solid #eee;padding:10px;'>
<view wx:if="{{discount}}" bindtap="setModalStatus" data-type="" data-status="1" style='border-bottom:1px solid #eee;padding:10px;'>
<view style='float:left;font-size:16px;'>优惠券</view>
<view style='float:right'>
<text wx:if="{{money}}" class="right" style="font-size: 16px;">使用优惠券:{{money}}</text>
@ -90,12 +89,17 @@
</view>
<view style='clear:both;'></view>
</view>
<view class="pay_zf pd" wx:if="{{name && plug_coupon}}">
<view class="pay_zf pd" wx:if="{{name}}">
<text class="left">活动</text>
<text class="right" style='color:{{bgcolor}};'>{{name}}</text>
</view>
<view class="pay_qb pd" style='border-bottom:1px solid #eee;'>
<text class="left">钱包余额</text>
<text wx:if="{{d_yuan}}" class="right">余额抵扣{{d_yuan}}</text>
<text wx:else class="right">{{user_money}}元</text>
</view>
<view wx:if="{{pay_xs}}">
<view style='height:10px;widht:100%;background:#eee;'></view>
<view style='height:10px;width:100%;background:#eee;'></view>
<view class="pay_zf pd">
<text class="left">选择支付方式</text>
</view>
@ -118,15 +122,13 @@
<view class='pay_foot'>
<view class="pay_fk">
<view class="zhifu mt10 ">合计:
<span class="font_20 red" total="{{total}}">¥ {{coupon_money}}</span>
<span class="font_20 red" total="{{total}}">¥ {{total}}</span>
</view>
<button wx:if="{{pay_xs}}" class="right btn_zf" type="primary" id="{{paytype}}" style='background:{{bgcolor}};border-radius:0;' disabled="{{btnDisabled}}" formType="submit">立即支付</button>
<button wx:else class="right btn_zf" type="primary" id="{{paytype}}" style='background:{{bgcolor}};border-radius:0;' disabled="{{btnDisabled}}" formType="submit">提交订单</button>
</view>
</view>
</view>
</form>
<!--普通结算结束 -->
</block>

64
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;
}

190
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) {

51
pages/product/detail.wxml

@ -26,7 +26,7 @@
<block wx:else>
<view class="cont">
<swiper style="height:375px" indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{bannerItem}}" wx:key="{{item.id}}">
<block wx:for="{{bannerItem}}" wx:key="index">
<swiper-item>
<image src="{{item}}" class="slide-image" />
<text style='position:absolute;z-index:999;width:20px;bottom:0;right:19px;color:#ddd;'>{{index+1}}/{{bannerItem.length}}</text>
@ -90,18 +90,16 @@
<view style='clear:both;'></view>
<view class='qgx'></view>
<form bindsubmit="add_fromid" report-submit='true'>
<button class='gg_fl' style="font-size: 15px;height: 35px;padding: 0;width: 90%;margin: auto;background: #fff;line-height: 35px;" form-type="submit" type="default" data-type="" data-status="1">
<view style='float: left;font-size: 15px;line-height: 35px;color: #666;'>规格
<text wx:if="{{value}}" style='color:#666;padding-left:15px;'>{{value}}</text>
<text wx:else style='color:#666;padding-left:15px;'>选择 颜色分类</text>
</view>
<view style='float:right'>
<image src='../../images/x_right.png' style='float: right;line-height: 35px;'></image>
</view>
<view style='clear:both;'></view>
</button>
</form>
<button class='gg_fl' style="font-size: 15px;height: 35px;padding: 0;width: 90%;margin: auto;background: #fff;line-height: 35px;" form-type="submit" type="default" data-type="" data-status="1">
<view style='float: left;font-size: 15px;line-height: 35px;color: #666;'>规格
<text wx:if="{{value}}" style='color:#666;padding-left:15px;'>{{value}}</text>
<text wx:else style='color:#666;padding-left:15px;'>选择 颜色分类</text>
</view>
<view style='float:right'>
<image src='../../images/x_right.png' style='float: right;line-height: 35px;'></image>
</view>
<view style='clear:both;'></view>
</button>
<view class='qgx'></view>
<!-- 悬浮客服窗口 -->
@ -159,16 +157,16 @@
</view>
</scroll-view>
</view>
<view wx:if="{{!xefl}}" class="footc" data-type="{{paytype}}" id="{{paytype}}" type="primary" bindtap="submit" style='background:#FF6347'> 确定 </view>
<view wx:if="{{!xefl}}" class="footc" data-type="{{paytype}}" id="{{paytype}}" type="primary" bindtap="submit"> 确定 </view>
<!-- <block wx:else>
<view wx:if="{{type1 == 1}}">
<view class="xgfootc1" data-type="buynow" id="buynow" type="primary" bindtap="submit" style='background:#f7c747;'> 单独购买 </view>
<view class="xgfootc2" data-type="canjiapintuan" id="canjiapintuan" type="primary" bindtap="submit" style='background:#ec612a;'> 参加拼团¥{{itemData.price11}} </view>
</view> -->
<block wx:else>
<view class="xgfootc1" data-type="addcart" id="addcart" type="primary" bindtap="submit" style='background:#f7c747;'> 加入购物车 </view>
<view class="xgfootc2" data-type="buynow" id="buynow" type="primary" bindtap="submit" style='background:#ec612a;'> 立即购买 </view>
</block>
<block wx:else>
<view class="xgfootc1" data-type="addcart" id="addcart" type="primary" bindtap="submit" style='background:#f7c747;'>加入购物车</view>
<view class="xgfootc2" data-type="buynow" id="buynow" type="primary" bindtap="submit" style='background:#ec612a;'>立即购买</view>
</block>
<!-- </block> -->
</view>
</view>
@ -190,7 +188,7 @@
<!-- 图文详情 -->
<view hidden="{{!(currentTab==0)}}" style="margin-bottom:100rpx;min-height:500rpx;">
<import src="../../wxParse/wxParse.wxml" />
<import src="/wxParse/wxParse.wxml" />
<view class="wxParse" style='padding:1% 5% 3% 5%;height:100%;'>
<template is="wxParse" data="{{wxParseData:content.nodes}}" />
</view>
@ -292,13 +290,13 @@
<!--获取formid -->
<view class=" w40 fl_l" style='background:#f7c747;' bindtap="setModalStatus" data-status="1" data-type="buynow">单独买 ¥ {{itemData.price_yh}}</view>
<form bindsubmit="getUserformid" report-submit="true" data-status="1" data-type="canjiapintuan" style='width:40%;'>
<!-- <form bindsubmit="getUserformid" report-submit="true" data-status="1" data-type="canjiapintuan" style='width:40%;'>
<button type="primary" formType="submit" style='width:40.6%;height:50px;background: #ec612a;color:#fff !important;display:flex;flex-direction:column;justify-content:center;border-radius:0;margin:0;float:left;'>
<view class=" fl_l" bindtap="setModalStatus" data-status="1" data-type="canjiapintuan" style='font-size:14px;'>
参加拼团 ¥{{itemData.price11}}
</view>
</button>
</form>
</form> -->
</view>
</view>
@ -330,15 +328,8 @@
</view>
<view class="fl_l w60">
<form bindsubmit="add_fromid" report-submit='true'>
<button class="w50 fl_l white" style="background: #f7c747;font-size: 15px;line-height: 50px;color: #fff;padding:0;" form-type="submit" type="default" data-type="addcart" data-status="1">加入购物车</button>
<!-- wx:if="{{cart==0}}" -->
<button class="w50 fl_l white" style="background: #ec612a;padding:0;font-size: 15px;line-height: 50px;color: #fff;" form-type="submit" type="default" data-type="buynow" data-status="1">立刻购买</button>
<!-- <button wx:if="{{cart>0}}" class="w50 fl_l white" style="background: #ec612a;padding:0;font-size: 15px;line-height: 50px;color: #fff;" bindtap="Settlement" >购物车结算</button> -->
</form>
<button class="w50 fl_l white" style="background: #f7c747;font-size: 15px;line-height: 50px;color: #fff;padding:0;" bindtap="showAttribute" type="default" data-type="addcart" data-status="1">加入购物车</button>
<button class="w50 fl_l white" style="background: #ec612a;padding:0;font-size: 15px;line-height: 50px;color: #fff;" bindtap="showAttribute" type="default" data-type="buynow" data-status="1">立刻购买</button>
</view>
</block>
</view>

26
pages/product/detail.wxss

@ -221,18 +221,18 @@ margin-left: 0;
}
.footfixed {
display:block;
position:fixed;
bottom:0;
left:0;
background:#fff;
z-index:100;
width:100%;
font-size:14px;
line-height:50px;
/*background: #dd2727;*/
color: snow
display:block;
position:fixed;
bottom:0;
left:0;
background:#fff;
z-index:100;
width:100%;
font-size:14px;
line-height:50px;
/*background: #dd2727;*/
color: snow;
padding-bottom: env(safe-area-inset-bottom);
}
.footc{
display:block;
@ -248,6 +248,8 @@ color: snow
font-weight:700;
color:snow;
text-align: center;
background:#FF6347;
padding-bottom: env(safe-area-inset-bottom);
}
.xgfootc1{
display:block;

139
pages/shop/shop.js

@ -0,0 +1,139 @@
// pages/shop/shop.js
var app = getApp();
var WXAPI = require('../../utils/server.js');
Page({
/**
* 页面的初始数据
*/
data: {
page: 1,
list: [],
mch_arr:[], //店铺分类列表
mch_data:[], //店铺分类总数据
i_showFl:0,//选择的分类
latitude: 28.227965,
longitude: 112.951227,
index: 0,
cid: ''
},
fl_cid(e) {
console.log(e)
// 显示当前点击的分类店铺
var index = e.currentTarget.dataset.index
if(index > 0){
var cid = this.data.mch_data[index-1].id
this.setData({
i_showFl: index,
cid: cid
})
} else {
this.setData({
i_showFl: index,
cid: ''
})
}
this.getShopList();
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getMchClass();
this.getShopList();
},
getMchClass() {
var that = this
WXAPI.mchClass({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
}).then(res => {
if (res.code == 200) {
var data = res.data
//分类的名称存入数组
var mch_arr = []
data.list.forEach((item,index)=>{
mch_arr.push(item.name)
})
//返回的分类列表
that.setData({
mch_data: data.list,
mch_arr: mch_arr
})
}
});
},
getShopList() {
var that = this
WXAPI.shopList({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
latitude: that.data.latitude,
longitude: that.data.longitude,
cid: that.data.cid,
}).then(res => {
if (res.code == 200) {
var data = res.data
that.setData({
list: data.list,
})
}
});
},
navToStore: function (e) {
var info = e.currentTarget.dataset.info
wx.navigateTo({
url: '/pagesA/store/store?shop_id=' + info.shop_id,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

6
pages/shop/shop.json

@ -0,0 +1,6 @@
{
"usingComponents": {},
"navigationBarBackgroundColor": "#FA5151",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "优选店铺"
}

50
pages/shop/shop.wxml

@ -0,0 +1,50 @@
<!--pages/shop/shop.wxml-->
<view class="container">
<!-- 分类 -->
<view class="fenlei">
<scroll-view scroll-x="true" class="fl_scroll">
<view class="fl_view">
<view bindtap="fl_cid" data-index="{{index}}">
<view>全部</view>
<view wx:if="{{i_showFl == 0}}" class="xian"></view>
</view>
<view bindtap="fl_cid" wx:for="{{mch_arr}}" data-index="{{index+1}}" wx:key="index">
<view>{{item}}</view>
<view wx:if="{{i_showFl == index+1}}" class="xian"></view>
</view>
</view>
</scroll-view>
</view>
<!-- 占位 -->
<view style="height: 120rpx;"></view>
<!-- 内容 -->
<view class="content">
<view class="list" wx:for="{{list}}" wx:key="index">
<view class="list_left">
<image src="{{item.logo}}" mode=""></image>
<view wx:if="{{item.is_open == 2}}">已关闭</view>
</view>
<view class="list_right">
<view class="list_right_top">
<view class="list_right_top_title">{{item.name}}</view>
<view class="list_right_top_btn" data-info='{{item}}' bindtap="navToStore">进店</view>
</view>
<view class="list_right_bottom">
<view class="bottom_item">
<view>{{item.quantity_on_sale}}</view>
<text>在售商品</text>
</view>
<view class="bottom_item">
<view>{{item.quantity_sold}}</view>
<text>已售</text>
</view>
<view class="bottom_item">
<view>{{item.collection_num}}</view>
<text>收藏人数</text>
</view>
</view>
</view>
</view>
</view>
</view>

118
pages/shop/shop.wxss

@ -0,0 +1,118 @@
/* pages/shop/shop.wxss */
.container{
background-color: #F4F5F6;
}
.fenlei{
position: fixed;
z-index: 999;
color: white;
background-color: #FA5151;
border-radius: 0 0 24rpx 24rpx;
padding: 20rpx 0;
width: 100%;
overflow-x: auto;
}
.fenlei .fl_scroll{
border-right: 1px solid #A1CECE;
}
.fl_scroll .fl_view{
display: flex;
}
.fl_view view{
min-width: 80rpx;
height: 60rpx;
padding: 0 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: column;
}
.fl_view .xian{
width: 80rpx;
height: 4rpx;
background: #fff;
border-radius: 4rpx;
margin-top: 8rpx;
}
.content{
padding: 10rpx 30rpx 30rpx 30rpx;
}
.content .list{
display: flex;
height: 168rpx;
background: #FFFFFF;
box-shadow: 0rpx 4rpx 15rpx 0rpx #E6E6E6;
border-radius: 6rpx;
padding: 24rpx;
box-sizing: border-box;
margin-bottom: 30rpx;
}
.list_left{
position: relative;
width: 120rpx;
height: 120rpx;
margin-right: 25rpx;
}
.list_left image{
width: 100%;
height: 100%;
}
.list_left view{
font-size: 24rpx;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
border-radius: 50%;
background-color: rgba(0,0,0,0.5);
color: #FFFFFF;
}
.list_right{
flex: 1;
display: flex;
flex-direction: column;
}
.list_right_top{
display: flex;
align-items: center;
justify-content: space-between;
}
.list_right_top_title{
font-size: 30rpx;
color: #000000;
}
.list_right_top_btn{
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
line-height: 40rpx;
width: 90rpx;
height: 40rpx;
border: 1px solid #fa5151;
border-radius: 30rpx;
color:#fa5151;
box-sizing: border-box;
}
.list_right_bottom{
display: flex;
justify-content: space-between;
padding-right: 30rpx;
}
.bottom_item{
display: flex;
flex-direction: column;
align-items: center;
margin-top: 24rpx;
}
.bottom_item view{
font-size: 26rpx;
line-height: 22rpx;
color: #fa5151;
}
.bottom_item text{
font-size: 24rpx;
color: #888888;
margin-top: 14rpx;
}

2
pages/mchList/mchList.js → pages/store/store.js

@ -1,4 +1,4 @@
// pages/mchList/mchList.js
// pages/store/store.js
Page({
/**

3
pages/store/store.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

2
pages/store/store.wxml

@ -0,0 +1,2 @@
<!--pages/store/store.wxml-->
<text>pages/store/store.wxml</text>

1
pages/store/store.wxss

@ -0,0 +1 @@
/* pages/store/store.wxss */

9
pages/user/user.js

@ -99,9 +99,9 @@ Page({
requestMyData: function () {
var that = this;
WXAPI.appIndex({
// WXAPI.appIndex({
})
// })
WXAPI.userIndex({
accessId: app.globalData.accessId,
@ -126,6 +126,11 @@ Page({
// tjr: data.data.tjr,
// support: data.data.support
});
}
else {
wx.removeStorageSync('accessId')
wx.removeStorageSync('isLogin');
wx.removeStorageSync('userInfo');
}
} else {
wx.showToast({

24
utils/server.js

@ -56,7 +56,7 @@ Promise.prototype.finally = function(callback) {
module.exports = {
requestServer,
appIndex: (data) => { //获取用户会话密钥
return requestServer('&action=app&m=index', 'post', data)
return requestServer('&action=app&app=index', 'post', data)
},
/* 首页 */
homeIndex: (data) => { //首页
@ -77,7 +77,7 @@ module.exports = {
},
/* 购物车 */
appCart: (data) => { //
return requestServer('&action=app&m=cart', 'post', data)
return requestServer('&action=app&app=cart', 'post', data)
},
cartIndex: (data) => { //购物车
return requestServer('&action=cart&app=index', 'post', data)
@ -90,11 +90,25 @@ module.exports = {
login: (data) => { //登录
return requestServer('&action=login&app=login', 'post', data)
},
mchClass: (data) => { //店铺分类
return requestServer('&action=index&app=mchClass', 'post', data)
},
shopList: (data) => { //店铺分类
return requestServer('&action=index&app=recommend_stores', 'post', data)
},
settlement: (data) => { //确认订单信息
return requestServer('&action=order&app=Settlement', 'post', data)
},
productAddCart: (data) => { //加入购物车
return requestServer('&action=product&app=add_cart', 'post', data)
},
productSaveFormid: (data) => {
return requestServer('&action=product&m=save_formid', 'post', data)
},
userMaterial: (data) => { //
return requestServer('&action=user&m=material', 'post', data)
return requestServer('&action=user&app=material', 'post', data)
},
indexGetMore: (data) => { //更多
return requestServer('&action=index&app=get_more', 'post', data)
@ -175,10 +189,6 @@ module.exports = {
userPerfect: (data) => { //
return requestServer('&action=user&m=perfect', 'post', data)
},
productAddCart: (data) => { //
return requestServer('&action=product&m=add_cart', 'post', data)
},
addFavoritesIndex: (data) => { //
return requestServer('&action=addFavorites&m=index', 'post', data)
},

2
wxParse/wxParse.wxml

@ -37,7 +37,7 @@
<!--入口模版-->
<template name="wxParse">
<block wx:for="{{wxParseData}}" wx:key="">
<block wx:for="{{wxParseData}}" wx:key="index">
<template is="wxParse0" data="{{item}}"/>
</block>
</template>

Loading…
Cancel
Save