换系统
This commit is contained in:
@@ -1,69 +1,69 @@
|
||||
// components/shopping/shoppingitem/shoppingitem.js
|
||||
import {request} from "../../../utils/bin"
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
shopname: String,
|
||||
shopdesc: String,
|
||||
price: Number,
|
||||
pic: String,
|
||||
gid:Number,
|
||||
num:Number,
|
||||
select:Boolean,
|
||||
index:Number
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
rm() {
|
||||
|
||||
if (this.data.num == 0) {
|
||||
|
||||
return
|
||||
} else {
|
||||
this.setData({
|
||||
num: this.data.num - 1
|
||||
})
|
||||
request({
|
||||
url:"Cart/updateNum",
|
||||
urldata:{
|
||||
id:this.data.gid,
|
||||
num:this.data.num - 1
|
||||
}
|
||||
}).then((res)=>{
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
add() {
|
||||
this.setData({
|
||||
num: this.data.num + 1
|
||||
})
|
||||
request({
|
||||
url:"Cart/updateNum",
|
||||
urldata:{
|
||||
id:this.data.gid,
|
||||
num:this.data.num + 1
|
||||
}
|
||||
}).then((res)=>{
|
||||
|
||||
})
|
||||
},
|
||||
sel(){
|
||||
this.triggerEvent('sel', {index:this.data.index,select:this.data.select})
|
||||
}
|
||||
|
||||
}
|
||||
// components/shopping/shoppingitem/shoppingitem.js
|
||||
import {request} from "../../../utils/bin"
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
shopname: String,
|
||||
shopdesc: String,
|
||||
price: Number,
|
||||
pic: String,
|
||||
gid:Number,
|
||||
num:Number,
|
||||
select:Boolean,
|
||||
index:Number
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
rm() {
|
||||
|
||||
if (this.data.num < 2) {
|
||||
|
||||
return
|
||||
} else {
|
||||
this.setData({
|
||||
num: this.data.num - 1
|
||||
})
|
||||
request({
|
||||
url:"Cart/updateNum",
|
||||
urldata:{
|
||||
id:this.data.gid,
|
||||
num:this.data.num
|
||||
}
|
||||
}).then((res)=>{
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
add() {
|
||||
this.setData({
|
||||
num: this.data.num + 1
|
||||
})
|
||||
request({
|
||||
url:"Cart/updateNum",
|
||||
urldata:{
|
||||
id:this.data.gid,
|
||||
num:this.data.num
|
||||
}
|
||||
}).then((res)=>{
|
||||
|
||||
})
|
||||
},
|
||||
sel(){
|
||||
this.triggerEvent('sel', {index:this.data.index,select:this.data.select})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
<view class="shoppingitem">
|
||||
<view class="select {{select ? 'selects':''}}" bind:tap="sel"></view>
|
||||
<view class="pic">
|
||||
<image src="{{pic}}"></image>
|
||||
</view>
|
||||
<view class="shopinfo">
|
||||
<view class="shopname">{{shopname}}</view>
|
||||
<view class="shopdesc">{{shopdesc}}</view>
|
||||
<view class="price">${{price}}</view>
|
||||
</view>
|
||||
<view class="numberset">
|
||||
<view class="reverse" bind:tap="rm">-</view>
|
||||
<view class="num">{{num}}</view>
|
||||
<view class="add" bind:tap="add">+</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="shoppingitem">
|
||||
<view class="select {{select ? 'selects':''}}" bind:tap="sel"></view>
|
||||
<view class="pic">
|
||||
<image src="{{pic}}"></image>
|
||||
</view>
|
||||
<view class="shopinfo">
|
||||
<view class="shopname">{{shopname}}</view>
|
||||
<view class="shopdesc">{{shopdesc}}</view>
|
||||
<view class="price">${{price}}</view>
|
||||
</view>
|
||||
<view class="numberset">
|
||||
<view class="reverse" bind:tap="rm">-</view>
|
||||
<view class="num">{{num}}</view>
|
||||
<view class="add" bind:tap="add">+</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -1,98 +1,98 @@
|
||||
.shoppingitem {
|
||||
width: 639rpx;
|
||||
height: 186rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.select {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
background: rgba(234, 234, 234, 1);
|
||||
border-radius: 50%;
|
||||
margin: auto 0;
|
||||
}
|
||||
.selects{
|
||||
background-color: #45C778;
|
||||
}
|
||||
.pic {
|
||||
/* width: 222rpx;
|
||||
height: 222rpx; */
|
||||
width: 186rpx;
|
||||
height: 186rpx;
|
||||
background-color: bisque;
|
||||
}
|
||||
|
||||
.pic>image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.shopinfo {
|
||||
width: 186rpx;
|
||||
}
|
||||
|
||||
.shopname {
|
||||
color: #333333;
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 18rpx;
|
||||
margin-top: 20rpx;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
|
||||
display: -webkit-box;
|
||||
|
||||
-webkit-box-orient: vertical;
|
||||
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.shopdesc {
|
||||
color: #666666;
|
||||
font-size: 22rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #D1D1D1;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.numberset {
|
||||
width: 85rpx;
|
||||
height: 186rpx;
|
||||
border: 1px solid rgba(233, 233, 233, 1);
|
||||
border-radius: 10px;
|
||||
margin-top: 11rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.reverse {
|
||||
width: 23rpx;
|
||||
height: 23rpx;
|
||||
/* background-color: #97DFB4; */
|
||||
margin: 0 auto;
|
||||
margin-top: 20rpx;
|
||||
line-height: 23rpx;
|
||||
font-size: 46rpx;
|
||||
}
|
||||
|
||||
.num {
|
||||
color: #242424;
|
||||
font-size: 30rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.add {
|
||||
width: 23rpx;
|
||||
height: 23rpx;
|
||||
/* background-color: #242424; */
|
||||
margin: 0 auto;
|
||||
margin-bottom: 17rpx;
|
||||
line-height: 23rpx;
|
||||
.shoppingitem {
|
||||
width: 639rpx;
|
||||
height: 186rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.select {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
background: rgba(234, 234, 234, 1);
|
||||
border-radius: 50%;
|
||||
margin: auto 0;
|
||||
}
|
||||
.selects{
|
||||
background-color: #45C778;
|
||||
}
|
||||
.pic {
|
||||
/* width: 222rpx;
|
||||
height: 222rpx; */
|
||||
width: 186rpx;
|
||||
height: 186rpx;
|
||||
background-color: bisque;
|
||||
}
|
||||
|
||||
.pic>image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.shopinfo {
|
||||
width: 186rpx;
|
||||
}
|
||||
|
||||
.shopname {
|
||||
color: #333333;
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 18rpx;
|
||||
margin-top: 20rpx;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
|
||||
display: -webkit-box;
|
||||
|
||||
-webkit-box-orient: vertical;
|
||||
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.shopdesc {
|
||||
color: #666666;
|
||||
font-size: 22rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #D1D1D1;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.numberset {
|
||||
width: 85rpx;
|
||||
height: 186rpx;
|
||||
border: 1px solid rgba(233, 233, 233, 1);
|
||||
border-radius: 10px;
|
||||
margin-top: 11rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.reverse {
|
||||
width: 23rpx;
|
||||
height: 23rpx;
|
||||
/* background-color: #97DFB4; */
|
||||
margin: 0 auto;
|
||||
margin-top: 20rpx;
|
||||
line-height: 23rpx;
|
||||
font-size: 46rpx;
|
||||
}
|
||||
|
||||
.num {
|
||||
color: #242424;
|
||||
font-size: 30rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.add {
|
||||
width: 23rpx;
|
||||
height: 23rpx;
|
||||
/* background-color: #242424; */
|
||||
margin: 0 auto;
|
||||
margin-bottom: 17rpx;
|
||||
line-height: 23rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user