import menus from './resources/menus.js'
Page({
data: {
text: "Page main",
background: [
{
color: 'green',
sort: 1
},
{
color: 'red',
sort: 2
},
{
color: 'yellow',
sort: 3
}
],
indicatorDots: true,
vertical: false,
autoplay: false,
interval: 3000,
duration: 1200,
toView: 'blue',
'menus': menus,
selectedMenuId: 1,
total: {
count: 0,
money: 0
}
},
selectMenu: function (event) {
let data = event.currentTarget.dataset
this.setData({
toView: data.tag,
selectedMenuId: data.id
})
// this.data.toView = 'red'
},
addCount: function (event) {
let data = event.currentTarget.dataset
let total = this.data.total
let menus = this.data.menus
let menu = menus.find(function (v) {
return v.id == data.cid
})
let dish = menu.dishs.find(function (v) {
return v.id == data.id
})
dish.count += 1;
total.count += 1
total.money += dish.price
this.setData({
'menus': menus,
'total': total
})
console.log(this.data.menus)
},
minusCount: function (event) {
let data = event.currentTarget.dataset
let total = this.data.total
let menus = this.data.menus
let menu = menus.find(function (v) {
return v.id == data.cid
})
let dish = menu.dishs.find(function (v) {
return v.id == data.id
})
if (dish.count <= 0)
return
dish.count -= 1;
total.count -= 1
total.money -= dish.price
this.setData({
'menus': menus,
'total': total
})
},
onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数
},
onReady: function () {
// 页面渲染完成
},
onShow: function () {
// 页面显示
},
onHide: function () {
// 页面隐藏
},
onUnload: function () {
// 页面关闭
},
onScroll: function (e) {
console.log(e)
}
})
没有合适的资源?快使用搜索试试~ 我知道了~
微信小程序带购物车功能 移动开发实现菜单切换,加减数量,汇总金额,实现支付的用例.zip
共61个文件
png:34个
js:8个
wxss:6个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 17 浏览量
2023-09-14
13:04:09
上传
评论
收藏 984KB ZIP 举报
温馨提示
微信小程序带购物车功能 移动开发实现菜单切换,加减数量,汇总金额,实现支付的用例.zip
资源推荐
资源详情
资源评论
收起资源包目录
微信小程序带购物车功能 移动开发实现菜单切换,加减数量,汇总金额,实现支付的用例.zip (61个子文件)
T
A
微信小程序带购物车功能 移动开发实现菜单切换,加减数量,汇总金额,实现支付的用例
cart
pages
cart
cart.wxml 0B
cart.wxss 0B
cart.js 923B
cart.json 146B
index
index.wxml 523B
index.js 1KB
index.wxss 268B
jiushui
jiushui.js 2KB
resources
menus.js 1KB
jiushui.wxml 5KB
jiushui.json 152B
jiushui.wxss 4KB
mine
mine.js 859B
mine.json 2B
mine.wxss 26B
mine.wxml 62B
logs
logs.json 52B
logs.js 261B
logs.wxml 173B
logs.wxss 106B
app.json 1KB
project.config.json 518B
drink
bigSpri.png 5KB
yinliao.png 12KB
maotai.png 56KB
countMinus.png 2KB
diner.png 68KB
CO.png 25KB
mealBoxAdd.png 2KB
coconut.png 48KB
JDB.png 22KB
bigCo.png 11KB
jiugui.png 44KB
Sorange.png 35KB
snow.png 19KB
one.png 8KB
zhujiang.png 14KB
orange.png 57KB
orderBox.png 18KB
Wine.png 56KB
Can_qingdao.png 43KB
vodka.png 12KB
hutu.jpg 35KB
Can_Pepsi.png 12KB
milk.png 64KB
qingjiu.png 6KB
countSelAdd.png 2KB
ding-ico1.png 2KB
Can_snow.png 103KB
jiushui.png 64KB
Can_one.png 8KB
erguotou.png 35KB
jinjiu.png 38KB
WLJ.png 31KB
dish-1.jpg 42KB
jiannanchun.png 15KB
qingdao.png 7KB
Can_Spri.png 29KB
app.js 1KB
utils
util.js 472B
app.wxss 280B
共 61 条
- 1
资源评论
处处清欢
- 粉丝: 149
- 资源: 2471
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功