Browse Source

购物车优化数量填写

登录优化
master
杜叶春 2 years ago
parent
commit
634f785c8d
  1. 11
      pages/cart/cart.wxss
  2. 2
      pages/category/category.wxss
  3. 19
      pages/listdetail/listdetail.js
  4. 4
      pages/listdetail/listdetail.wxml
  5. 8
      pages/listdetail/listdetail.wxss
  6. 50
      pages/login/login.js
  7. 2
      pages/order/order.wxml
  8. 11
      pages/order/pay.js
  9. 6
      pages/product/detail.js
  10. 2
      pages/product/detail.wxml
  11. 4
      pages/product/detail.wxss

11
pages/cart/cart.wxss

@ -274,7 +274,6 @@ page{
height: 21px!important; height: 21px!important;
font-size: 28rpx; font-size: 28rpx;
line-height: 20px; line-height: 20px;
min-height: 21px!important;
color: #666 color: #666
} }
@ -445,7 +444,7 @@ padding-right:16px;
/* overflow-y: scroll; */ /* overflow-y: scroll; */
} }
.text_center{ .text_center{
width: 97%; width: 97%;
position: absolute; position: absolute;
top: -40px; top: -40px;
} }
@ -521,14 +520,14 @@ padding-right:16px;
height: 100rpx; height: 100rpx;
} }
.stepper { .stepper {
text-align: right; /* text-align: right; */
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
width: 200rpx; width: 230rpx;
overflow: hidden; overflow: hidden;
margin-left: 250rpx; margin-left: 210rpx;
background-color: #F8F8F8; background-color: #F8F8F8;
border-top: 1px solid #DDD; border-top: 1px solid #DDD;
border-bottom: 1px solid #DDD; border-bottom: 1px solid #DDD;
@ -544,7 +543,7 @@ padding-right:16px;
font-weight: 900; font-weight: 900;
} }
.stepper input { .stepper input {
width: 30px; width: 60px;
height: 25px; height: 25px;
text-align: center; text-align: center;
} }

2
pages/category/category.wxss

@ -94,7 +94,7 @@ page{
/*给text设成块级元素*/ /*给text设成块级元素*/
display: block; display: block;
margin-top: 15px; margin-top: 15px;
font-size: 14px; font-size: 13px;
color: black; color: black;
/*设置文字溢出部分为...*/ /*设置文字溢出部分为...*/
overflow: hidden; overflow: hidden;

19
pages/listdetail/listdetail.js

@ -23,10 +23,11 @@ Page({
loading: false,//显示加载 loading: false,//显示加载
period: false,//显示无数据 period: false,//显示无数据
select: 0,//选中 select: 0,//选中
sort: 0,// 1 asc 升序 0 desc 降序 sort: '',// 1 asc 升序 0 desc 降序
types: '刷新', // 点击更多、下拉上啦刷新 types: '刷新', // 点击更多、下拉上啦刷新
bg: '', bg: '',
attrList: [], attrList: [],
sortType: '',
}, },
onPullDownRefresh: function () { onPullDownRefresh: function () {
console.log(111) console.log(111)
@ -92,7 +93,8 @@ Page({
page: page, page: page,
pro:'', pro:'',
keyword:'', keyword:'',
sort_criteria: sort, sort_criteria: that.data.sortType,
sort: sort,
query_criteria: '',//'{"brand_id":"","min_price":"","max_price":""}', query_criteria: '',//'{"brand_id":"","min_price":"","max_price":""}',
}).then(res => { }).then(res => {
if (res.code == 200) { if (res.code == 200) {
@ -220,7 +222,8 @@ Page({
var that = this; var that = this;
this.setData({ this.setData({
select: 0, select: 0,
sort: 1, sort: '',
sortType: '',
imageurl1: "../../images/mo.png", imageurl1: "../../images/mo.png",
imageurl2: "../../images/mo.png", imageurl2: "../../images/mo.png",
page: 1, page: 1,
@ -234,17 +237,18 @@ Page({
if (this.data.daindex1 == 0) { if (this.data.daindex1 == 0) {
this.setData({ this.setData({
imageurl1: "../../images/xia.png", imageurl1: "../../images/xia.png",
daindex1: 1, daindex1: 'desc',
imageurl2: "../../images/mo.png", imageurl2: "../../images/mo.png",
}) })
} else { } else {
this.setData({ this.setData({
imageurl1: "../../images/shang.png", imageurl1: "../../images/shang.png",
daindex1: 0, daindex1: 'asc',
imageurl2: "../../images/mo.png", imageurl2: "../../images/mo.png",
}) })
} }
this.setData({ this.setData({
sortType: 'volume',
select: 1, select: 1,
sort: that.data.daindex1, sort: that.data.daindex1,
page: 1, page: 1,
@ -258,17 +262,18 @@ Page({
if (this.data.daindex2 == 0) { if (this.data.daindex2 == 0) {
this.setData({ this.setData({
imageurl2: "../../images/shang.png", imageurl2: "../../images/shang.png",
daindex2: 1, daindex2: 'asc',
imageurl1: "../../images/mo.png", imageurl1: "../../images/mo.png",
}) })
} else { } else {
this.setData({ this.setData({
imageurl2: "../../images/xia.png", imageurl2: "../../images/xia.png",
imageurl1: "../../images/mo.png", imageurl1: "../../images/mo.png",
daindex2: 0 daindex2: 'desc'
}) })
} }
this.setData({ this.setData({
sortType: 'price',
select: 2, select: 2,
sort: that.data.daindex2, sort: that.data.daindex2,
page: 1, page: 1,

4
pages/listdetail/listdetail.wxml

@ -38,10 +38,10 @@
价格 价格
<image src="{{imageurl2}}"></image> <image src="{{imageurl2}}"></image>
</view> </view>
<view class='sort-btn' bindtap="tabchage"> <!-- <view class='sort-btn' bindtap="tabchage">
筛选 筛选
<image src="/images/filter.png"></image> <image src="/images/filter.png"></image>
</view> </view> -->
</view> </view>
<view class="list" wx:if="{{shopList.length > 0}}"> <view class="list" wx:if="{{shopList.length > 0}}">
<view class="cont" style='padding-top:10px;'> <view class="cont" style='padding-top:10px;'>

8
pages/listdetail/listdetail.wxss

@ -2,6 +2,14 @@ page {
height: 100%; height: 100%;
background: #f5f5f5 background: #f5f5f5
} }
.sort-btn{
width:33%;
text-align: center;
height:90rpx;
line-height:90rpx;
font-size: 28rpx;
color:#333;
}
.bxs{ .bxs{
display:none; display:none;
} }

50
pages/login/login.js

@ -161,29 +161,35 @@ Page({
}, },
loginAct: function () { loginAct: function () {
var that = this; var that = this;
WXAPI.login({ wx.login({
storeId: 239, success: function (res) {
storeType: 1, var code = res.code;
phone: that.data.account, WXAPI.login({
password: that.data.password, storeId: 239,
}).then(res => { storeType: 1,
if (res.code == 200) { account: that.data.account,
var data = res.data password: that.data.password,
app.globalData.accessId = data.access_id; code: code,
wx.setStorageSync('accessId', data.access_id) }).then(res => {
wx.setStorageSync('isLogin', true); if (res.code == 200) {
wx.setStorageSync('userInfo', data.data); var data = res.data
wx.navigateBack() app.globalData.accessId = data.access_id;
wx.showToast({ wx.setStorageSync('accessId', data.access_id)
title: '登录成功!', wx.setStorageSync('isLogin', true);
success: 2000 wx.setStorageSync('userInfo', data.data);
wx.navigateBack()
wx.showToast({
title: '登录成功!',
success: 2000
});
} else {
wx.showToast({
title: res.message,
icon: 'none',
duration: 1500,
})
}
}); });
} else {
wx.showToast({
title: res.message,
icon: 'none',
duration: 1500,
})
} }
}); });
}, },

2
pages/order/order.wxml

@ -28,7 +28,7 @@
<view class="spec">{{item.size}}</view> <view class="spec">{{item.size}}</view>
<view class="priceView"> <view class="priceView">
<view class="price">¥{{item.p_price}}</view> <view class="price">¥{{item.p_price}}</view>
<view class="quantity">共 {{item.num}} {{item.unit}}</view> <view class="quantity">共 {{item.num}} {{item.unit==null?'':item.unit}}</view>
</view> </view>
</view> </view>
</view> </view>

11
pages/order/pay.js

@ -228,14 +228,14 @@ Page({
pays: pays, pays: pays,
}); });
} else { } else {
that.setData({
remind: true
});
wx.showToast({ wx.showToast({
title: res.message, title: res.message,
icon: 'none', icon: 'none',
duration: 2000, duration: 2000,
}); });
setTimeout(function () {
wx.navigateBack()
}, 600)
} }
}); });
}, },
@ -560,6 +560,9 @@ Page({
// 确认订单 // 确认订单
createProductOrder: function () { createProductOrder: function () {
var that = this; var that = this;
var remarkArr = []
remarkArr.push(that.data.remark)
let remarkStr = JSON.stringify(remarkArr)
WXAPI.orderPayment({ WXAPI.orderPayment({
accessId: app.globalData.accessId, accessId: app.globalData.accessId,
storeId: 239, storeId: 239,
@ -567,7 +570,7 @@ Page({
cart_id: that.data.cartId, cart_id: that.data.cartId,
address_id: that.data.addrId, address_id: that.data.addrId,
coupon_id: 0, coupon_id: 0,
remarks: that.data.remark, remarks: remarkStr,
vipSource: 0, vipSource: 0,
product: that.data.productAry, product: that.data.productAry,
pay_type: that.data.paytype, pay_type: that.data.paytype,

6
pages/product/detail.js

@ -294,6 +294,12 @@ Page({
} }
}; };
}, },
//数量
bindManual: function (e) {
this.setData({
buynum: e.detail.value
})
},
//首次进去选中 //首次进去选中
one: function () { one: function () {
var attrListIn = this.data.attrList; var attrListIn = this.data.attrList;

2
pages/product/detail.wxml

@ -133,7 +133,7 @@
<!-- 减号 --> <!-- 减号 -->
<text class="normal" data-alpha-beta="0" bindtap="changeNum">-</text> <text class="normal" data-alpha-beta="0" bindtap="changeNum">-</text>
<!-- 数值 --> <!-- 数值 -->
<view class="nownum">{{buynum}}</view> <input class='nownum' type="number" bindinput="bindManual" value="{{buynum}}" />
<!-- 加号 --> <!-- 加号 -->
<text class="normal" data-alpha-beta="1" bindtap="changeNum">+</text> <text class="normal" data-alpha-beta="1" bindtap="changeNum">+</text>
</view> </view>

4
pages/product/detail.wxss

@ -400,7 +400,7 @@ page{
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
width: 200rpx; width: 230rpx;
overflow: hidden; overflow: hidden;
margin-left: 250rpx; margin-left: 250rpx;
background-color: #F8F8F8; background-color: #F8F8F8;
@ -418,7 +418,7 @@ page{
font-weight: 900; font-weight: 900;
} }
.stepper input { .stepper input {
width: 30px; width: 60px;
height: 25px; height: 25px;
text-align: center; text-align: center;
} }

Loading…
Cancel
Save