Browse Source

购物车新增规格选择

master
杜叶春 2 years ago
parent
commit
e742f65a63
  1. 3
      app.json
  2. 166
      pages/aftersales/asdetail.wxml
  3. 10
      pages/aftersales/index.wxml
  4. 306
      pages/cart/cart.js
  5. 43
      pages/cart/cart.wxml
  6. 182
      pages/cart/cart.wxss
  7. 15
      pages/collection/collection.wxss
  8. 3
      pages/index/index.js
  9. 2
      pages/index/index.wxml
  10. 16
      pages/member/member.wxml
  11. 2
      pages/notice/index.json
  12. 10
      pages/notice/index.wxml
  13. 10
      pages/notice/index.wxss
  14. 2
      pages/notice/notice.json
  15. 13
      pages/notice/notice.wxml
  16. 55
      pages/notice/notice.wxss
  17. 1
      pages/product/detail.js
  18. 2
      pages/set/set.wxml
  19. 11
      pages/set/set.wxss
  20. 85
      pages/similar/similar.js
  21. 4
      pages/similar/similar.json
  22. 53
      pages/similar/similar.wxml
  23. 55
      pages/similar/similar.wxss
  24. 112
      pages/store/store.js
  25. 10
      utils/server.js

3
app.json

@ -53,7 +53,8 @@
"pages/aftersales/aftersales",
"pages/aftersales/index",
"pages/aftersales/apply",
"pages/aftersales/asdetail"
"pages/aftersales/asdetail",
"pages/similar/similar"
],
"window": {
"backgroundTextStyle": "light",

166
pages/aftersales/asdetail.wxml

@ -1,88 +1,88 @@
<!--pages/aftersales/asdetail.wxml-->
<view class="container">
<view class="status-view">
<block wx:if="{{info.type == 0}}">
<view class="statusLabel">待审核</view>
<view class='statusDesc'>您的售后申请正在审核中,请耐心等待2-3个工作日</view>
</block>
<block wx:elif="{{info.type == 1}}">
<view class="statusLabel">待回寄</view>
<view class='statusDesc'>商家已同意,请用户寄回商品</view>
</block>
<block wx:elif="{{info.type == 2}}">
<view class="statusLabel">已拒绝</view>
<view class='statusDesc'>商家拒绝退货退款</view>
</block>
<block wx:elif="{{info.type == 3}}">
<view class="statusLabel">待卖家收货</view>
<view class='statusDesc'>用户已寄出,等待商家收货</view>
</block>
<block wx:elif="{{info.type == 4}}">
<view class="statusLabel">已退款</view>
<view class='statusDesc'>收到寄回商品,同意并退款</view>
</block>
<block wx:elif="{{info.type == 5}}">
<view class="statusLabel">已拒绝</view>
<view class='statusDesc'>商家拒绝并退回商品</view>
</block>
<block wx:elif="{{info.type == 8}}">
<view class="statusLabel">已拒绝</view>
<view class='statusDesc'>商家拒绝退款</view>
</block>
<block wx:elif="{{info.type == 9}}">
<view class="statusLabel">已退款</view>
<view class='statusDesc'>商家同意并退款</view>
</block>
<block wx:elif="{{info.type == 10}}">
<view class="statusLabel">已拒绝</view>
<view class='statusDesc'>商家拒绝售后</view>
</block>
<block wx:elif="{{info.type == 11}}">
<view class="statusLabel">待收货</view>
<view class='statusDesc'>商家同意并且寄回商品</view>
</block>
<block wx:elif="{{info.type == 12}}">
<view class="statusLabel">已结束</view>
<view class='statusDesc'>售后结束</view>
</block>
</view>
<block wx:if="{{info.type == 0}}">
<view class="statusLabel">待审核</view>
<view class='statusDesc'>您的售后申请正在审核中,请耐心等待2-3个工作日</view>
</block>
<block wx:elif="{{info.type == 1}}">
<view class="statusLabel">待回寄</view>
<view class='statusDesc'>商家已同意,请用户寄回商品</view>
</block>
<block wx:elif="{{info.type == 2}}">
<view class="statusLabel">已拒绝</view>
<view class='statusDesc'>商家拒绝退货退款</view>
</block>
<block wx:elif="{{info.type == 3}}">
<view class="statusLabel">待卖家收货</view>
<view class='statusDesc'>用户已寄出,等待商家收货</view>
</block>
<block wx:elif="{{info.type == 4}}">
<view class="statusLabel">已退款</view>
<view class='statusDesc'>收到寄回商品,同意并退款</view>
</block>
<block wx:elif="{{info.type == 5}}">
<view class="statusLabel">已拒绝</view>
<view class='statusDesc'>商家拒绝并退回商品</view>
</block>
<block wx:elif="{{info.type == 8}}">
<view class="statusLabel">已拒绝</view>
<view class='statusDesc'>商家拒绝退款</view>
</block>
<block wx:elif="{{info.type == 9}}">
<view class="statusLabel">已退款</view>
<view class='statusDesc'>商家同意并退款</view>
</block>
<block wx:elif="{{info.type == 10}}">
<view class="statusLabel">已拒绝</view>
<view class='statusDesc'>商家拒绝售后</view>
</block>
<block wx:elif="{{info.type == 11}}">
<view class="statusLabel">待收货</view>
<view class='statusDesc'>商家同意并且寄回商品</view>
</block>
<block wx:elif="{{info.type == 12}}">
<view class="statusLabel">已结束</view>
<view class='statusDesc'>售后结束</view>
</block>
</view>
<view class="yh-line"></view>
<view class="rt-product-box">
<view class="yh-block-title">
<view>售后信息</view>
</view>
<view style="height:2rpx;background-color:#F4F4F4;margin-top:30rpx;"></view>
<view class="address-row">
<view>商品名称:</view>
<view class="yh-p_name">{{info.p_name}}</view>
</view>
<view class="address-row">
<view>订单号:</view>
<view>{{info.r_sNo}}</view>
</view>
<view class="address-row">
<view>申请时间:</view>
<view>{{info.re_time}}</view>
</view>
<view class="address-row">
<view>售后类型:</view>
<view>{{info.re_type==1?'退货退款':info.re_type==3?'换货':'仅退款'}}</view>
</view>
<view class="address-row h_auto">
<view>申请原因:</view>
<view class='yx_right'>{{info.content}}</view>
</view>
<view class="address-row h_auto" wx:if="{{info.re_photo&&info.re_photo.length > 0}}">
<view>上传凭证:</view>
<view class="flex">
<view class="re_photo" wx:for="{{info.re_photo}}" wx:key='index'>
<image src="{{item}}" mode=""/>
</view>
</view>
</view>
<view class="address-row" wx:if="{{info.re_type != 3}}">
<view>退款金额:</view>
<view>¥{{info.p_price}}</view>
</view>
<view class="rt-product-box">
<view class="yh-block-title">
<view>售后信息</view>
</view>
<view style="height:2rpx;background-color:#F4F4F4;margin-top:30rpx;"></view>
<view class="address-row">
<view>商品名称:</view>
<view class="yh-p_name">{{info.p_name}}</view>
</view>
<view class="address-row">
<view>订单号:</view>
<view>{{info.r_sNo}}</view>
</view>
<view class="address-row">
<view>申请时间:</view>
<view>{{info.re_time}}</view>
</view>
<view class="address-row">
<view>售后类型:</view>
<view>{{info.re_type==1?'退货退款':info.re_type==3?'换货':'仅退款'}}</view>
</view>
<view class="address-row h_auto">
<view>申请原因:</view>
<view class='yx_right'>{{info.content}}</view>
</view>
<view class="address-row h_auto" wx:if="{{info.re_photo&&info.re_photo.length > 0}}">
<view>上传凭证:</view>
<view class="flex">
<view class="re_photo" wx:for="{{info.re_photo}}" wx:key='index'>
<image src="{{item}}" mode="" />
</view>
</view>
</view>
</view>
<view class="address-row" wx:if="{{info.re_type != 3}}">
<view>退款金额:</view>
<view>¥{{info.p_price}}</view>
</view>
</view>
</view>

10
pages/aftersales/index.wxml

@ -56,13 +56,13 @@
</view>
</view>
<view class="bottom">
<image wx:if="{{item.re_type==2}}" src="/images/tuikuan.png" mode=""/>
<image wx:elif="{{item.re_type==1}}" src="/images/tuihuo.png" mode=""/>
<image wx:elif="{{item.re_type==3}}" src="/images/huanhuo.png" mode=""/>
<image wx:if="{{item.re_type==2}}" src="/images/tuikuan.png" mode="" />
<image wx:elif="{{item.re_type==1}}" src="/images/tuihuo.png" mode="" />
<image wx:elif="{{item.re_type==3}}" src="/images/huanhuo.png" mode="" />
<text>{{item.re_type==2?'仅退款':item.re_type==1?'退货退款':'换货'}}</text>
<view class="right">
<view class="right">
<view class="normalBtn" bindtap="navToAsdetail" data-info="{{item}}">查看详情</view>
<view class="confirmBtn" bindtap="cancelAct" data-info="{{item}}">撤销审核</view>
<view class="confirmBtn" bindtap="cancelAct" data-info="{{item}}">撤销审核</view>
</view>
</view>
</view>

306
pages/cart/cart.js

@ -7,12 +7,21 @@ Page({
minusStatuses: ['disabled', 'disabled', 'normal', 'normal', 'disabled'],
total: 0.0,
carts: [],
data: {},
skuBeanList: [],
cont: 1,
upstatus: false,
remind: '加载中',
productData: '',
shop: '',
shop_logo: '',
showModalStatus: false,
animationData: '',
buynum: 1,
attrList: [],
sizeid: '',
currentIndex: 0,
itemData: {}
},
//页面加载完成函数 remind: '加载中',
onReady: function () {
@ -462,7 +471,6 @@ Page({
});
that.sum();
}
} else {
wx.showToast({
title: '数量不能小于1,请重新输入!',
@ -477,4 +485,300 @@ Page({
};
},
showAttribute: function(e) {
var productId = e.currentTarget.dataset.id;
var index = e.currentTarget.dataset.index;
var that = this;
that.loadProductDetail(productId);
var animation = wx.createAnimation({
duration: 200,
timingFunction: "linear",
delay: 0
});
this.animation = animation
animation.translateY(300).step();
this.setData({
// paytype: type,
animationData: animation.export(),
currentIndex: index
})
if (e.currentTarget.dataset.status == 1) {
this.setData({
showModalStatus: true
});
}
setTimeout(function () {
animation.translateY(0).step()
this.setData({
animationData: animation
})
if (e.currentTarget.dataset.status == 0) {
this.setData({
showModalStatus: false
});
}
}.bind(this), 200);
},
// 商品详情数据获取
loadProductDetail: function (productId) {
var that = this;
WXAPI.productIndex({ // productAttribute
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
pro_id: productId,
// cart_id: productId
}).then(res => {
if (res.code == 200) {
var data = res.data;
var pro = data.pro;
that.setData({
skuBeanList: data.skuBeanList,
// itemData: pro,
attrList: data.attrList,
sizeid: data.attrList[0].attr[0].attrId,
});
//默认选中
that.one();
}
});
},
//首次进去选中
one: function () {
var attrListIn = this.data.attrList;
var skuBeanListIn = this.data.skuBeanList;
var select_list = skuBeanListIn[0];
for (var i = 0; i < attrListIn.length; i++) {
for (var j = 0; j < attrListIn[i].attr.length; j++) {
for (var b = 0; b < select_list.attributes.length; b++) {
if (select_list.attributes[b].attributeId == attrListIn[i].attr[j].attributeId && select_list.attributes[b].attributeValId == attrListIn[i].attr[j].id) {
attrListIn[i].attr[j].select = true;
}
}
}
}
var itemData = this.data.itemData;
itemData.photo_x = select_list.imgurl;
itemData.price_yh = select_list.price;
itemData.num = select_list.count;
var sizeid = select_list.cid;
// 重新赋值
this.setData({
attrList: attrListIn,
skuBeanList: skuBeanListIn,
itemData: itemData,
sizeid: sizeid,
value: select_list.name
})
this.onData();
},
// 弹窗
setModalStatus: function (e) {
var animation = wx.createAnimation({
duration: 200,
timingFunction: "linear",
delay: 0
});
//定义点击的类型
var type = e.target.dataset.type ? e.target.dataset.type : false;
//控制两种不同显示方式
if (type) {
this.setData({
xefl: false,
})
} else {
this.setData({
xefl: true,
})
type = this.data.paytype;
}
this.animation = animation
animation.translateY(300).step();
this.setData({
paytype: type,
animationData: animation.export()
})
if (e.currentTarget.dataset.status == 1) {
this.setData({
showModalStatus: true
});
}
setTimeout(function () {
animation.translateY(0).step()
this.setData({
animationData: animation
})
if (e.currentTarget.dataset.status == 0) {
this.setData({
showModalStatus: false
});
}
}.bind(this), 200)
},
/**
* 规格属性点击事件
*/
onChangeShowState: function (event) {
var that = this;
var listItem = this.data.attrList;
var items = listItem[event.currentTarget.dataset.idx];
var item = items.attr[event.currentTarget.dataset.index];
if (!item.enable) {
return;
}
var select = !item.select;
for (var i = 0; i < items.attr.length; i++) {
items.attr[i].select = false;
}
item.select = select;
// 获取点击属性列表
var canGetInfo = [];
for (var skuIndex = 0; skuIndex < listItem.length; skuIndex++) {
for (var skuIndexIn = 0; skuIndexIn < listItem[skuIndex].attr.length; skuIndexIn++) {
if (listItem[skuIndex].attr[skuIndexIn].enable && listItem[skuIndex].attr[skuIndexIn].select) {
canGetInfo.push(listItem[skuIndex].attr[skuIndexIn]);
}
}
}
var canGetInfoLog = "";
var skuBeanList = this.data.skuBeanList;
var haveSkuBean = [];
// 对应库存清单扫描
for (var skuBeanIndex = 0; skuBeanIndex < skuBeanList.length; skuBeanIndex++) {
var iListCount = 0;
for (var skuBeanIndexIn = 0; skuBeanIndexIn < skuBeanList[skuBeanIndex].attributes.length; skuBeanIndexIn++) {
if (canGetInfo.length == skuBeanList[skuBeanIndex].attributes.length) {
if (skuBeanList[skuBeanIndex].attributes[skuBeanIndexIn].attributeValId == canGetInfo[skuBeanIndexIn].id) {
iListCount++;
}
} else {
canGetInfoLog = "库存清单不存在此属性" + " ";
}
}
if (iListCount == skuBeanList[skuBeanIndex].attributes.length) {
haveSkuBean.push(skuBeanList[skuBeanIndex]);
}
}
for (var iox = 0; iox < canGetInfo.length; iox++) {
canGetInfoLog += canGetInfo[iox].attributeValue + " ";
}
if (haveSkuBean.length != 0) {
//选中设置
var itemData = that.data.itemData;
itemData.photo_x = haveSkuBean[0].imgurl;
itemData.price_yh = haveSkuBean[0].price;
itemData.num = haveSkuBean[0].count;
var choujiangid = that.data.choujiangid;
var sizeid = haveSkuBean[0].cid;
that.setData({
itemData: itemData,
sizeid: sizeid,
choujiangid: choujiangid,
value: canGetInfoLog
});
} else {
that.setData({
sizeid: '',
value: ''
});
}
// 重新赋值
this.setData({
attrList: listItem,
infoText: canGetInfoLog,
})
// 重新sku运算
this.onData();
},
/**
* Sku核心算法
* 根据所有出当前类别之外的选择 判断按钮的enable false or true
*/
onData: function () {
var attrListIn = this.data.attrList;
for (var i = 0; i < attrListIn.length; i++) {
var attrListBig = attrListIn[i];
//当前类别之外的选择列表
var attrsOtherSelect = [];
for (var j = 0; j < attrListIn.length; j++) {
var attrListSmall = attrListIn[j];
if (attrListSmall.id != attrListBig.id) {
for (var k = 0; k < attrListSmall.attr.length; k++) {
var attrListSmallAttr = attrListSmall.attr[k];
if (attrListSmallAttr.enable && attrListSmallAttr.select) {
attrsOtherSelect.push(attrListSmallAttr);
}
}
}
}
var enableIds = [];
var skuBeanListIn = this.data.skuBeanList;
for (var z = 0; z < skuBeanListIn.length; z++) {
var ism = true;
var skuBean = skuBeanListIn[z];
for (var j = 0; j < attrsOtherSelect.length; j++) {
var enable = false;
for (var k = 0; k < skuBean.attributes.length; k++) {
var goodAttrBean = skuBean.attributes[k];
if (attrsOtherSelect[j].attributeId == goodAttrBean.attributeId
&& attrsOtherSelect[j].id == goodAttrBean.attributeValId) {
enable = true;
break;
}
}
ism = enable && ism;
}
if (ism) {
for (var o = 0; o < skuBean.attributes.length; o++) {
var goodAttrBean = skuBean.attributes[o];
if (attrListBig.id == goodAttrBean.attributeId) {
enableIds.push(goodAttrBean.attributeValId);
}
}
}
}
var integers = enableIds;
for (var s = 0; s < attrListBig.attr.length; s++) {
var attrItem = attrListBig.attr[s];
attrItem.enable = integers.indexOf(attrItem.id) != -1;
}
}
// 重新赋值
this.setData({
attrList: attrListIn,
skuBeanList: skuBeanListIn
})
},
confirmAct: function (e) {
var that = this;
var carts = that.data.carts;
var index = that.data.currentIndex;
var cartId = carts[index].id;
WXAPI.modifyAttribute({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
cart_id: cartId,
attribute_id: that.data.sizeid
}).then(res => {
if (res.code == 200) {
that.setData({
showModalStatus: false
});
that.loadProductData();
}
});
},
})

43
pages/cart/cart.wxml

@ -71,11 +71,10 @@
</view>
</navigator>
<view class="carts-text">
<navigator style='width:100%;height:120rpx;overflow: hidden;' url="../product/detail?productId={{item.pid}}&size={{item.Size_id}}">
<text class="carts-title">{{item.pro_name}}</text>
<text class="carts-title" style='font-size:28rpx;color:#CCCCCC;margin-top:25rpx;' wx:if="{{item.attrList}}">[{{item.skuBeanList[0].name}}]</text>
</navigator>
<!-- <navigator style='width:100%;height:120rpx;overflow: hidden;' url="../product/detail?productId={{item.pid}}&size={{item.Size_id}}"> -->
<text class="carts-title">{{item.pro_name}}</text>
<text class="carts-title" style='font-size:28rpx;color:#CCCCCC;margin-top:25rpx;' data-index="{{index}}" data-id="{{item.pid}}" data-status="1" wx:if="{{item.attrList}}" bindtap="showAttribute">[{{item.skuBeanList[0].name}}]</text>
<!-- </navigator> -->
<view class="title">
<text class="carts-price">¥ {{item.price}}</text>
<view class="stepper">
@ -104,7 +103,39 @@
<view class="button_1_2" style='background:#FB5657;border:1px solid #f60;' bindtap='delarr'>删除</view>
</view>
<view wx:else class="button" style='background:#FB5657;' bindtap='bindCheckout'>立即结算</view>
</view>
<!--弹窗-->
<view class="drawer_screen" catchtouchmove="preventTouchMove" bindtap="setModalStatus" data-status="0" wx:if="{{showModalStatus}}"></view>
<view animation="{{animationData}}" class="drawer_attr_box" catchtouchmove="preventTouchMove" wx:if="{{showModalStatus}}">
<view class="close_icon" bindtap="setModalStatus" data-status="0">×</view>
<view class="drawer_attr_content">
<view class="text_center">
<image class="drawer_image" src="{{itemData.photo_x}}"></image>
</view>
<view class="mingcheng">
<view style="font-size:38rpx;color:#FB5657">¥ {{itemData.price_yh}}</view>
<view style="font-size:26rpx;color:#999">库存:{{itemData.num}}</view>
</view>
<view style='clear:both;'></view>
<view class="commodity_attr_list" catchtouchmove="preventTouchMove">
<!--每组属性-->
<scroll-view scroll-y="true" style="height:100%;">
<!-- 属性选择 -->
<view wx:for="{{attrList}}" wx:for-index="idx" wx:key="userInfoListId" class="outStyle">
<view class='outStyleText textStyle buttonPaddingStyle' style="padding-left:0">{{item.attrName}}</view>
<view class='typeStyle textStyle' style="margin-left:0;flex-wrap: wrap;">
<view wx:for="{{item.attr}}" data-item='{{item.attr[index]}}' data-index='{{index}}' data-idx='{{idx}}' wx:key="userInfoListId" bindtap="onChangeShowState" wx:for-item="items">
<view class="{{items.enable == true ?(items.select==true?'select':'normal') : 'bai'}} textStyle buttonPaddingStyle">
{{items.attributeValue}}
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="footc" data-sku="{{skuList}}" type="primary" bindtap="confirmAct"> 确定 </view>
</view>
</view>
<!--弹框结尾 -->
</view>
</block>

182
pages/cart/cart.wxss

@ -397,4 +397,186 @@ padding-right:16px;
width: 25rpx;
height: 25rpx;
margin-left: 20rpx;
}
/*弹窗*/
.drawer_screen {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #000;
opacity: 0.2;
overflow: hidden;
z-index: 1;
color: #fff;
}
.drawer_attr_box {
width: 100%;
height: 50%;
border-radius:10px 10px 0 0;
position: fixed;
bottom: 0;
left: 0;
z-index: 2000;
background: #fff;
}
.close_icon {
width: 60rpx;
height: 60rpx;
line-height: 60rpx;
font-size: 60rpx;
position: absolute;
right: 5rpx;
top:5rpx;
padding: 10rpx;
color: #ccc;
/*border: 1rpx solid #ccc;*/
border-radius: 50%;
text-align: center;
background: #fff;
z-index: 999;
}
.drawer_attr_content {
padding: 20rpx;
height:85%;
/* overflow-y: scroll; */
}
.text_center{
width: 97%;
position: absolute;
top: -40px;
}
.mingcheng{
width: 65%;
font-size:35rpx;
line-height: 50rpx;
float: right;
margin-bottom:20px;
}
.drawer_image {
width: 28%;
height: 200rpx;
border:1px solid #ddd;
border-radius:10rpx;
}
.drawer_desc{
font-size:28rpx;
margin:20rpx;
height: 150rpx;
width: 100%;
}
/*每组属性的主盒子*/
.attr_box {
width: 100%;
overflow: hidden;
border-bottom: 1rpx solid #ececec;
}
/*属性名*/
.attr_name {
width: 20%;
float: left;
padding: 15rpx 0;
font-size: 30rpx;
margin-top:20rpx;
}
.outStyle {
display: flex;
flex-direction: column;
}
.outStyleText {
display: flex;
flex-direction: column;
color: #999;
}
.typeStyle {
display: flex;
flex-direction: row;
margin: 10px;
}
.textStyle {
font-size:14px;
}
.buttonPaddingStyle {
padding-left:10px;
padding-right:10px;
padding-top:5px;
padding-bottom:5px;
margin-bottom:5px;
}
/*数量*/
.dian{
position: absolute;
right: 30rpx;
}
.shu{
display: flex;
flex-direction: row;
width: 100%;
margin-top: 30rpx;
height: 100rpx;
}
.stepper {
text-align: right;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 200rpx;
overflow: hidden;
margin-left: 250rpx;
background-color: #F8F8F8;
border-top: 1px solid #DDD;
border-bottom: 1px solid #DDD;
border-radius: 8rpx;
}
.stepper text {
border-left: 1px solid #DDD;
border-right: 1px solid #DDD;
width: 25px;
height: 25px;
line-height: 25px;
text-align: center;
font-weight: 900;
}
.stepper input {
width: 30px;
height: 25px;
text-align: center;
}
.normal {
/* background-color: #f5f5f5; */
color: #000;
}
.cun{
/* margin: 5px; */
font-size:30rpx;
/* padding-left: 20rpx; */
width: 20%
}
.select {
border-radius: 10px;
background-color: #FB5657;
margin-right: 10px;
color: #fff;
}
.footc{
display:block;
position:fixed;
bottom:0;
left:0;
background:#FB5657;
z-index:100;
width:100%;
font-size:14px;
border-top:1px solid #eee;
line-height:40px;
font-weight:700;
color:snow;
text-align: center;
background:#FB5657;
}

15
pages/collection/collection.wxss

@ -19,15 +19,16 @@
float: left;
}
.sp_text{
float: left;
line-height: 20px;
width: 100%;
height:100%;
margin-left: 10rpx;
line-height: 20px;
width: 100%;
height:100%;
}
.sp_tit{
width: 100%;
overflow: hidden;
font-size: 14px;
margin-top: 15rpx;
width: 100%;
overflow: hidden;
font-size: 14px;
}
.sp_neb{
width: 100%;

3
pages/index/index.js

@ -227,8 +227,9 @@ Page({
//找相似
discoverSimilarProducts: function (e) {
var goodsId = e.currentTarget.dataset;
console.log(goodsId)
wx.navigateTo({
// url:"/pages/detail/detail?id="+goodsId.id
url:"/pages/similar/similar?id="+goodsId.id
})
},
navToShopList: function (e) {

2
pages/index/index.wxml

@ -227,7 +227,7 @@
<image class="goods_shop" src="{{list.logo}}"></image>
<text>{{list.mch_name}}</text>
</view>
<!-- <view class="discover" data-id="{{list.id}}" bindtap="discoverSimilarProducts">找相似</view> -->
<view class="discover" data-id="{{list.id}}" bindtap="discoverSimilarProducts">找相似</view>
</view>
</navigator>
</block>

16
pages/member/member.wxml

@ -1,7 +1,13 @@
<!--pages/member/member.wxml-->
<view class="container">
<view class="card">
<view class="detail" style="color:#356386;">当前积分0,充值会员即可拥有积分特权</view>
<image class="card_bg" src="/images/member/component_lv_1.jpg" mode="aspectFit"></image>
</view>
</view>
<view class="card">
<view class="detail" style="color:#356386;">当前积分0,充值会员即可拥有积分特权</view>
<image class="card_bg" src="/images/member/component_lv_1.jpg" mode="aspectFit"></image>
<!-- <image class="card_bg" wx:if="{{user.level==1}}" src="/images/member/component_lv_1.jpg" mode="aspectFill"></image>
<image class="card_bg" wx:elif="{{user.level==2}}" src="/images/member/component_lv_2.jpg" mode="aspectFill"></image>
<image class="card_bg" wx:elif="{{user.level==3}}" src="/images/member/component_lv_3.jpg" mode="aspectFill"></image>
<image class="card_bg" wx:elif="{{user.level==4}}" src="/images/member/component_lv_4.jpg" mode="aspectFill"></image>
<image class="card_bg" wx:elif="{{user.level==5}}" src="/images/member/component_lv_5.jpg" mode="aspectFill"></image>
<image class="card_bg" wx:elif="{{user.level==6}}" src="/images/member/component_lv_6.jpg" mode="aspectFill"></image> -->
</view>
</view>

2
pages/notice/index.json

@ -1,5 +1,5 @@
{
"component": true,
"usingComponents": {},
"navigationBarTitleText": "公告详情"
"navigationBarTitleText": "消息详情"
}

10
pages/notice/index.wxml

@ -1,16 +1,14 @@
<!--pages/notice/index.wxml-->
<view class="function" style='background:#fff'>
<view>
<view style='font-size:27px;text-align:left;margin:10px;'>
{{notice.title}}
</view>
<view style='font-size:10px;width:30%;float:right;margin:10px 10px 20px;'>{{notice.time}} </view>
<view class="title">{{notice.title}}</view>
<view class="time">{{notice.time}} </view>
</view>
<view style='clear:both;'>
</view>
<view style="height:50%;margin-bottom:10rpx;max-height:100rpx;">
<view style="height:50%;margin-bottom:10rpx;max-height:100rpx;color:#666;">
<import src="../../wxParse/wxParse.wxml" />
<view class="wxParse" style='padding:1% 5% 3% 5%;'>
<view class="wxParse" style='padding:4% 4% 3% 4%;'>
<template is="wxParse" data="{{wxParseData:detail.nodes}}" />
</view>
</view>

10
pages/notice/index.wxss

@ -1,4 +1,14 @@
/* pages/notice/index.wxss */
.function .title{
font-size:36rpx;
text-align:left;
margin:30rpx 30rpx 10rpx 30rpx;
}
.function .time{
margin-left: 30rpx;
font-size:28rpx;
color:#999;
}
.wxParse-img{
margin:0 auto;
display:block;

2
pages/notice/notice.json

@ -1,5 +1,5 @@
{
"component": true,
"usingComponents": {},
"navigationBarTitleText": "公告"
"navigationBarTitleText": "消息"
}

13
pages/notice/notice.wxml

@ -1,12 +1,17 @@
<!--pages/notice.wxml-->
<view class="container">
<view class='tab_tab' wx:for="{{notice}}" wx:key="key" data-index="{{index}}" data-item="{{item}}" bindtap="navToIndex">
<view class='function_time'>{{item.time}}</view>
<view class="function_list">
<view class='function_left'>
<view class='function_time'>{{item.time}} </view>
<view class='function_text'>{{item.content}} </view>
<view class='function_content'>
<view class='function_title'>{{item.title}}</view>
<view class='function_text'>{{item.content}}</view>
<view class='line'></view>
</view>
<view class='function_right'>
<view class='function_bottom'>
<view class='function_title'>查看详情</view>
<image class="jiantou" src="../../images/x_right.png"></image>
</view>
</view>

55
pages/notice/notice.wxss

@ -2,44 +2,65 @@
page{
width: 100%;
height: 100%;
background:#eee !important;
background:#F4F5F6 !important;
}
.mor{
color: gray;
font-size: 12px;
}
.tab_tab{
/* .tab_tab{
padding-top: 25rpx;
padding-bottom: 25rpx;
margin: 25rpx 25rpx 0rpx 25rpx;
background-color: white;
border-radius: 10rpx;
}
} */
.function_list{
display:flex;
justify-content:space-between;
background:#fff;
flex-direction: column;
padding-top: 25rpx;
padding-bottom: 25rpx;
margin: 15rpx 25rpx 0rpx 25rpx;
background-color: white;
border-radius: 10rpx;
}
.function_left{
font-size:16px;
margin-left:10px;
.function_content{
margin-left:30rpx;
}
.function .iconfont {
line-height:27px;
.function_title{
font-size: 32rpx;
color: #333;
}
.function_text{
margin-top:10px;
margin-left:5px;
color:#666;
margin-top:10rpx;
font-size: 28rpx;
color:#999;
}
.function_time{
margin-left:5px;
margin-top:25rpx;
text-align: center;
font-size:15px;
color:#999;
background-color: #F4F5F6;
height: 60rpx;
line-height: 60rpx;
}
.line{
margin-top: 20rpx;
background-color:#eee;
height:2rpx;
width: 640rpx;
}
.function_bottom{
margin-top: 20rpx;
margin-left:30rpx;
display: flex;
flex-direction: row;
align-items: center;
}
.jiantou{
margin-top:40rpx;
position: absolute;
right: 55rpx;
width: 20rpx;
height: 20rpx;
padding-right:20rpx;
}
}

1
pages/product/detail.js

@ -166,7 +166,6 @@ Page({
var content = pro.content;
WxParse.wxParse('content', 'html', content, that, 5);
that.setData({
itemData: pro,
shop_list: data.shop_list,
kucun: pro.num,
bannerItem: pro.img_arr,

2
pages/set/set.wxml

@ -1,5 +1,5 @@
<!--pages/set/set.wxml-->
<view class="function" style='background:#fff'>
<view class="function">
<button class="function_list" bindtap="changePwd">
<view class='function_left'>

11
pages/set/set.wxss

@ -1,8 +1,14 @@
/* pages/set/set.wxss */
page{
width: 100%;
height: 100%;
background:#F4F5F6 !important;
}
.function{
width:95%;
margin: 10px auto;
border-radius: 5px;
background-color: #F4F5F6;
}
.mor{
color: gray;
@ -32,11 +38,6 @@
height: 10px;
padding-right:10px;
}
page{
width: 100%;
height: 100%;
background:#eee !important;
}
.logoutView{
margin:70rpx;
height: 80rpx;

85
pages/similar/similar.js

@ -0,0 +1,85 @@
// pages/similar/similar.js
var app = getApp();
var WXAPI = require('../../utils/server.js');
Page({
/**
* 页面的初始数据
*/
data: {
remind: '加载中',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 页面显示
this.getSimilarList(options);
},
getSimilarList: function (options) {
var that = this;
WXAPI.similarList({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
pro_id: options.id
}).then(res => {
if (res.code == 200) {
var data = res.data
that.setData({
list: data.product,
remind: ''
})
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

4
pages/similar/similar.json

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "发现"
}

53
pages/similar/similar.wxml

@ -0,0 +1,53 @@
<!--pages/similar/similar.wxml-->
<view class="body" wx:if="{{remind}}">
<view class='zong'>
<view class="spinner" >
<view class="spinner-container container1">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container2">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container3">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
</view>
</view>
</view>
<!-- 加载页面结束 -->
<block wx:else>
<view class="page">
<view class="search_no" wx:if="{{!list.length}}">
<view class="font_14"><image class="scimg" src="/images/search_no.png"></image></view>
<text>没有找到相似商品/(ㄒoㄒ)/~~</text>
</view>
<view class="shop df" wx:for="{{list}}" >
<navigator url="/pages/product/detail?productId={{item.p_id}}">
<image class="sh_slt" src="{{item.imgurl}}"></image>
</navigator>
<view class="df_1">
<view class="sp_text">
<navigator class="sp_tit ovh1" style='height:50%;' url="/pages/product/detail?productId={{item.p_id}}">
{{item.product_title}}
</navigator>
<!-- <view class="sp_tit ovh1" style='height:50%;'>{{item.product_title}}</view> -->
<view class="sp_jg">¥{{item.price}}</view>
</view>
</view>
</view>
<!-- <view style="height:50px;"></view>
<view class="dibu" wx:if="{{list.length}}">
<button bindtap="alldel" class="cz" hover-class="czz" style="background-color:{{bgcolor}};height: 45px;line-height: 45px;">全部取消收藏</button>
</view> -->
</view>
</block>

55
pages/similar/similar.wxss

@ -0,0 +1,55 @@
/* pages/similar/similar.wxss */
.shop{
background: #fff;
padding: 4%;
margin-bottom: 10px;
border-bottom:1px solid #eee;
}
.cz{
width: 100%;
background: #FF6347;
color: #fff;
border-radius:0;
}
.sh_slt{
width: 80px;
height: 80px;
overflow: hidden;
border-radius: 5px;
margin-right: 4%;
float: left;
}
.sp_text{
margin-left: 10rpx;
line-height: 20px;
width: 100%;
height:100%;
}
.sp_tit{
margin-top: 15rpx;
width: 100%;
overflow: hidden;
font-size: 14px;
}
.sp_neb{
width: 100%;
overflow: hidden;
font-size: 12px;
color: #999;
}
.sp_jg{
width: 100%;
overflow: hidden;
font-size: 14px;
color: #fc0628;
}
.dle{
color: #999;
font-size: 12px;
float: right;
}
.dibu{
position: fixed;
bottom:0;
width: 100%;
}

112
pages/store/store.js

@ -30,6 +30,7 @@ Page({
buynum: 1,
attrList: [],
sizeid: '',
itemData: {}
},
switchTab: function(e) {
var dataset = e.currentTarget.dataset
@ -131,13 +132,46 @@ Page({
var data = res.data;
var pro = data.pro;
that.setData({
itemData: pro,
// itemData: pro,
attrList: data.attrList,
sizeid: data.attrList[0].attr[0].attrId,
skuBeanList: data.skuBeanList
});
//默认选中
that.one();
}
});
},
//首次进去选中
one: function () {
var attrListIn = this.data.attrList;
var skuBeanListIn = this.data.skuBeanList;
var select_list = skuBeanListIn[0];
for (var i = 0; i < attrListIn.length; i++) {
for (var j = 0; j < attrListIn[i].attr.length; j++) {
for (var b = 0; b < select_list.attributes.length; b++) {
if (select_list.attributes[b].attributeId == attrListIn[i].attr[j].attributeId && select_list.attributes[b].attributeValId == attrListIn[i].attr[j].id) {
attrListIn[i].attr[j].select = true;
}
}
}
}
var itemData = this.data.itemData;
itemData.photo_x = select_list.imgurl;
itemData.price_yh = select_list.price;
itemData.num = select_list.count;
var sizeid = select_list.cid;
// 重新赋值
this.setData({
attrList: attrListIn,
skuBeanList: skuBeanListIn,
itemData: itemData,
sizeid: sizeid,
value: select_list.name
})
this.onData();
},
// 弹窗
setModalStatus: function (e) {
var animation = wx.createAnimation({
@ -219,9 +253,9 @@ Page({
var listItem = this.data.attrList;
var items = listItem[event.currentTarget.dataset.idx];
var item = items.attr[event.currentTarget.dataset.index];
if (!item.enable) {
return;
}
// if (!item.enable) {
// return;
// }
var select = !item.select;
for (var i = 0; i < items.attr.length; i++) {
items.attr[i].select = false;
@ -286,6 +320,76 @@ Page({
// 重新sku运算
this.onData();
},
/**
* Sku核心算法
* 根据所有出当前类别之外的选择 判断按钮的enable false or true
*/
onData: function () {
var attrListIn = this.data.attrList;
for (var i = 0; i < attrListIn.length; i++) {
var attrListBig = attrListIn[i];
//当前类别之外的选择列表
var attrsOtherSelect = [];
for (var j = 0; j < attrListIn.length; j++) {
var attrListSmall = attrListIn[j];
if (attrListSmall.id != attrListBig.id) {
for (var k = 0; k < attrListSmall.attr.length; k++) {
var attrListSmallAttr = attrListSmall.attr[k];
if (attrListSmallAttr.enable && attrListSmallAttr.select) {
attrsOtherSelect.push(attrListSmallAttr);
}
}
}
}
var enableIds = [];
var skuBeanListIn = this.data.skuBeanList;
for (var z = 0; z < skuBeanListIn.length; z++) {
var ism = true;
var skuBean = skuBeanListIn[z];
for (var j = 0; j < attrsOtherSelect.length; j++) {
var enable = false;
for (var k = 0; k < skuBean.attributes.length; k++) {
var goodAttrBean = skuBean.attributes[k];
if (attrsOtherSelect[j].attributeId == goodAttrBean.attributeId
&& attrsOtherSelect[j].id == goodAttrBean.attributeValId) {
enable = true;
break;
}
}
ism = enable && ism;
}
if (ism) {
for (var o = 0; o < skuBean.attributes.length; o++) {
var goodAttrBean = skuBean.attributes[o];
if (attrListBig.id == goodAttrBean.attributeId) {
enableIds.push(goodAttrBean.attributeValId);
}
}
}
}
var integers = enableIds;
for (var s = 0; s < attrListBig.attr.length; s++) {
var attrItem = attrListBig.attr[s];
attrItem.enable = integers.indexOf(attrItem.id) != -1;
}
}
// 重新赋值
this.setData({
attrList: attrListIn,
skuBeanList: skuBeanListIn
})
},
//加入购物车
addShopCart: function (e) {
// console.log(e.currentTarget.dataset)

10
utils/server.js

@ -113,6 +113,12 @@ module.exports = {
productDelAllCart: (data) => { //清空购物车
return requestServer('app.cart.delAllCart', 'post', data)
},
productAttribute: (data) => { //购物车选择规格
return requestServer('app.cart.dj_attribute', 'post', data)
},
modifyAttribute: (data) => { //购物车选择规格
return requestServer('app.cart.modify_attribute', 'post', data)
},
/* 我的 */
userIndex: (data) => { //个人中心
return requestServer('app.user.index', 'post', data)
@ -223,5 +229,7 @@ module.exports = {
cancelLation: (data) => { //撤销售后
return requestServer('app.order.Cancellation_of_application', 'post', data)
},
similarList: (data) => { //找相似
return requestServer('app.addFavorites.similar', 'post', data)
},
}
Loading…
Cancel
Save