初始化
61
README.md
Normal file
@ -0,0 +1,61 @@
|
||||
一个基于vue、element ui 的轻量级、前后端分离、拥有完整sku和下单流程的完全开源商城 小程序端
|
||||
|
||||
|
||||
|
||||
该项目仅供学习参考、可供个人学习使用、如需商用联系作者进行授权,否则必将追究法律责任
|
||||
|
||||
|
||||
|
||||
## 前言
|
||||
|
||||
`亚米商城`项目致力于为中小企业打造一个完整、易于维护的开源的电商系统,采用现阶段流行技术实现。后台管理系统包含商品管理、订单管理、运费模板、规格管理、会员管理、运营管理、内容管理、统计报表、权限管理、设置等模块。
|
||||
|
||||
|
||||
|
||||
## 项目链接
|
||||
|
||||
java后台:https://gitee.com/gz-yami/mall4j
|
||||
|
||||
vue后台:https://gitee.com/gz-yami/mall4v
|
||||
|
||||
小程序:https://gitee.com/gz-yami/mall4m
|
||||
|
||||
|
||||
|
||||
## 演示地址
|
||||
|
||||
后台:<http://mall4j-admin.gz-yami.com> 账号:admin/123456
|
||||
|
||||
小程序:1. 扫描二维码
|
||||
|
||||

|
||||
|
||||
2. 搜索小程序 **亚米商城**
|
||||
|
||||
|
||||
|
||||
## 相关截图
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
## 提交反馈
|
||||
|
||||
提问之前,请先阅读[提问的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md):
|
||||
|
||||
- QQ群:722835385
|
||||
|
||||

|
||||
|
||||
- 论坛:<http://bbs.gz-yami.com>
|
||||
|
||||
- 商务邮箱:yamitech@163.com
|
||||
24
app.js
Normal file
@ -0,0 +1,24 @@
|
||||
//app.js
|
||||
var http = require("utils/http.js");
|
||||
App({
|
||||
onLaunch: function () {
|
||||
http.getToken();
|
||||
wx.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting['scope.userInfo']) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/login/login',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
globalData: {
|
||||
// 定义全局请求队列
|
||||
requestQueue: [],
|
||||
// 是否正在进行登陆
|
||||
isLanding: true,
|
||||
// 购物车商品数量
|
||||
totalCartCount: 0
|
||||
}
|
||||
})
|
||||
62
app.json
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"pages": [
|
||||
|
||||
"pages/index/index",
|
||||
"pages/logs/logs",
|
||||
"pages/user/user",
|
||||
"pages/basket/basket",
|
||||
"pages/category/category",
|
||||
"pages/search-page/search-page",
|
||||
"pages/delivery-address/delivery-address",
|
||||
"pages/editAddress/editAddress",
|
||||
"pages/orderList/orderList",
|
||||
"pages/order-detail/order-detail",
|
||||
"pages/submit-order/submit-order",
|
||||
"pages/binding-phone/binding-phone",
|
||||
"pages/express-delivery/express-delivery",
|
||||
"pages/pay-result/pay-result",
|
||||
"pages/search-prod-show/search-prod-show",
|
||||
"pages/prod/prod",
|
||||
"pages/login/login",
|
||||
"pages/prod-classify/prod-classify",
|
||||
"pages/recent-news/recent-news",
|
||||
"pages/news-detail/news-detail"
|
||||
],
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "WeChat",
|
||||
"navigationBarTextStyle": "black"
|
||||
},
|
||||
"tabBar": {
|
||||
"selectedColor": "#3a86b9",
|
||||
"color": "#b8b8b8",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "首页",
|
||||
"iconPath": "images/tabbar/homepage.png",
|
||||
"selectedIconPath": "images/tabbar/homepage-sel.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/category/category",
|
||||
"text": "分类",
|
||||
"iconPath": "images/tabbar/category.png",
|
||||
"selectedIconPath": "images/tabbar/category-sel.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/basket/basket",
|
||||
"text": "购物车",
|
||||
"iconPath": "images/tabbar/basket.png",
|
||||
"selectedIconPath": "images/tabbar/basket-sel.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/user/user",
|
||||
"text": "我的",
|
||||
"iconPath": "images/tabbar/user.png",
|
||||
"selectedIconPath": "images/tabbar/user-sel.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sitemapLocation": "sitemap.json"
|
||||
}
|
||||
31
app.wxss
Normal file
@ -0,0 +1,31 @@
|
||||
/**app.wxss**/
|
||||
.container {
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
color: #333;
|
||||
font-family: helvetica,'Heiti SC',PingFangSC-Light;
|
||||
}
|
||||
.price{
|
||||
font-family: Arial;
|
||||
display: inline-block;
|
||||
color: #eb2444;
|
||||
padding-bottom:10rpx;
|
||||
padding-left:10rpx;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 价格数字显示不同大小 */
|
||||
|
||||
.symbol {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.big-num {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.small-num {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
67
components/coupon/coupon.js
Normal file
@ -0,0 +1,67 @@
|
||||
var http = require('../../utils/http.js');
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
item: Object,
|
||||
type: Number,
|
||||
order: Boolean,
|
||||
canUse: Boolean,
|
||||
index: Number,
|
||||
showTimeType: Number
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
stsType: 4
|
||||
|
||||
},
|
||||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||||
attached: function() {
|
||||
//console.log(this.data.item);
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
receiveCoupon() {
|
||||
var couponId = this.data.item.couponId;
|
||||
http.request({
|
||||
url: "/p/myCoupon/receive",
|
||||
method: "POST",
|
||||
data: couponId,
|
||||
callBack: () => {
|
||||
var coupon = this.data.item;
|
||||
coupon.canReceive = false;
|
||||
this.setData({
|
||||
item: coupon
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
checkCoupon(e) {
|
||||
// this.triggerEvent('checkCoupon', this.data.index);
|
||||
this.triggerEvent('checkCoupon', {
|
||||
couponId: e.currentTarget.dataset.couponid
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 立即使用
|
||||
*/
|
||||
useCoupon() {
|
||||
var url = '/pages/prod-classify/prod-classify?sts=' + this.data.stsType;
|
||||
var id = this.data.item.couponId;
|
||||
var title = "优惠券活动商品";
|
||||
if (id) {
|
||||
url += "&tagid=" + id + "&title=" + title;
|
||||
}
|
||||
wx.navigateTo({
|
||||
url: url
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
4
components/coupon/coupon.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
30
components/coupon/coupon.wxml
Normal file
@ -0,0 +1,30 @@
|
||||
<view class="coupon-item {{canUse?'':'gray'}}">
|
||||
<view class='left'>
|
||||
<view class="num" wx:if="{{item.couponType == 1}}">
|
||||
¥
|
||||
<text class="coupon-price">{{item.reduceAmount}}</text>
|
||||
</view>
|
||||
<view class="num" wx:if="{{item.couponType == 2}}">
|
||||
<text class="coupon-price">{{item.couponDiscount}}</text>折
|
||||
</view>
|
||||
<view class='condition'>
|
||||
满{{item.cashCondition}}元可用
|
||||
</view>
|
||||
</view>
|
||||
<view class='right'>
|
||||
<view class="c-des">
|
||||
<text class="c-type">{{item.suitableProdType==0?'通用':'商品'}}</text> {{item.suitableProdType==0?'全场通用':'指定商品可用'}}
|
||||
</view>
|
||||
<view class="c-date">
|
||||
<text wx:if="{{showTimeType==1 && item.couponType==2}}" class="c-data-info">领券{{item.validDays}}天后失效</text>
|
||||
<text wx:else class="c-data-info">{{item.startTime}}~{{item.endTime}}</text>
|
||||
<text class="c-btn" wx:if="{{item.canReceive && !order}}" bindtap='receiveCoupon'>立即领取</text>
|
||||
<text class="c-btn get-btn" wx:if="{{!item.canReceive && !order}}" bindtap='useCoupon'>立即使用</text>
|
||||
</view>
|
||||
<view wx:if="{{order && canUse}}" class="sel-btn">
|
||||
<checkbox color="#eb2444" data-couponid="{{item.couponId}}" checked="{{item.choose}}" bindtap="checkCoupon"></checkbox>
|
||||
</view>
|
||||
</view>
|
||||
<image class="tag-img" src="../../images/icon/coupon-used.png" wx:if="{{type==1}}"></image>
|
||||
<image class="tag-img" src="../../images/icon/coupon-ot.png" wx:if="{{type==2}}"></image>
|
||||
</view>
|
||||
118
components/coupon/coupon.wxss
Normal file
@ -0,0 +1,118 @@
|
||||
.coupon-item{
|
||||
margin: 15px 0;
|
||||
position: relative;
|
||||
box-shadow: 1px 1px 3px rgba(0,0,0,0.15);
|
||||
height: 95px;
|
||||
background: #fff;
|
||||
}
|
||||
.coupon-item .left{
|
||||
float: left;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-left: 1px dashed #fff;
|
||||
padding: 20px 0;
|
||||
background: -webkit-gradient(linear,left top,right top,from(#F45C43),to(#eb2444));
|
||||
background: -o-linear-gradient(left,#F45C43,#eb2444);
|
||||
background: linear-gradient(left,#F45C43,#eb2444);
|
||||
background: -webkit-linear-gradient(left,#F45C43,#eb2444);
|
||||
width: 260rpx;
|
||||
height: 55px;
|
||||
}
|
||||
.coupon-item .left .num{
|
||||
font-weight:600;
|
||||
font-size:36rpx;
|
||||
height:70rpx;
|
||||
line-height:70rpx;
|
||||
font-family:arial;
|
||||
}
|
||||
.coupon-item .left .num .coupon-price{
|
||||
font-size: 72rpx;
|
||||
line-height: 72rpx;
|
||||
display: inline-block;
|
||||
font-family: arial;
|
||||
}
|
||||
.coupon-item .left .condition{
|
||||
font-size: 28rpx;
|
||||
line-height: 28rpx;
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding: 0 2px;
|
||||
font-family: arial;
|
||||
}
|
||||
.coupon-item .right{
|
||||
margin-left: 280rpx;
|
||||
padding: 5px;
|
||||
position: relative;
|
||||
}
|
||||
.coupon-item .right .c-des{
|
||||
height: 30px;
|
||||
font-size: 26rpx;
|
||||
line-height: 30px;
|
||||
overflow: hidden;
|
||||
font-weight: 600;
|
||||
}
|
||||
.coupon-item .right .c-des .c-type{
|
||||
font-size: 24rpx;
|
||||
background: #fdf0f0;
|
||||
color: #eb2444;
|
||||
border-radius: 8px;
|
||||
padding:3px 10px;
|
||||
}
|
||||
.coupon-item .right .c-date{
|
||||
font-size: 24rpx;
|
||||
margin-top:25px;
|
||||
}
|
||||
.coupon-item .right .c-date .c-data-info{
|
||||
font-family: arial;
|
||||
}
|
||||
.coupon-item .right .c-date .c-btn{
|
||||
position: absolute;
|
||||
bottom:0;
|
||||
right:10px;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
font-family: arial;
|
||||
border-radius: 14px;
|
||||
padding:3px 7px;
|
||||
/* background: -webkit-gradient(linear,left top,right top,from(#6c96da),to(#6b83d7));
|
||||
background: -o-linear-gradient(left,#6c96da,#6b83d7);
|
||||
background: linear-gradient(left,#6c96da,#6b83d7);
|
||||
background: -webkit-linear-gradient(left,#6c96da,#6b83d7); */
|
||||
background: #eb2444;
|
||||
border: 1px solid #eb2444;
|
||||
}
|
||||
|
||||
.coupon-item .right .c-date .c-btn.get-btn{
|
||||
background: #fff;
|
||||
border: 1px solid #eb2444;
|
||||
color:#eb2444;
|
||||
}
|
||||
|
||||
.coupon-item.gray .left{
|
||||
background: #bbb;
|
||||
}
|
||||
|
||||
.coupon-item.gray .right .c-des .c-type{
|
||||
background: #bbb;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.coupon-item.gray .right .c-date .c-btn{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.coupon-item .tag-img{
|
||||
position: absolute;
|
||||
top:0;
|
||||
right:0;
|
||||
width:120rpx;
|
||||
height:120rpx;
|
||||
}
|
||||
|
||||
.coupon-item .sel-btn{
|
||||
position:absolute;
|
||||
right:10px;
|
||||
top:35px;
|
||||
}
|
||||
30
components/production/production.js
Normal file
@ -0,0 +1,30 @@
|
||||
// components/production/production.js
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
item:Object,
|
||||
sts:Number,
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
toProdPage: function (e) {
|
||||
var prodid = e.currentTarget.dataset.prodid;
|
||||
wx.navigateTo({
|
||||
url: '/pages/prod/prod?prodid=' + prodid,
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
4
components/production/production.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
19
components/production/production.wxml
Normal file
@ -0,0 +1,19 @@
|
||||
<view class='prod-items' bindtap='toProdPage' data-prodid="{{item.prodId}}">
|
||||
<view class='hot-imagecont'>
|
||||
<image src='{{item.pic}}' class='hotsaleimg' ></image>
|
||||
</view>
|
||||
<view class='hot-text'>
|
||||
<view class='hotprod-text'>{{item.prodName}}</view>
|
||||
<view class='prod-info' wx:if='{{sts==6}}'>{{item.prodCommNumber}}评价 {{item.positiveRating}}%好评</view>
|
||||
<view class='prod-text-info'>
|
||||
<view class='price'>
|
||||
<text wx:if='{{sts==2}}' class='deadline-price'>限时价</text>
|
||||
<text class='symbol'>¥</text>
|
||||
<text class='big-num'>{{wxs.parsePrice(item.price)[0]}}</text>
|
||||
<text class='small-num'>.{{wxs.parsePrice(item.price)[1]}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<wxs module="wxs" src="../../wxs/number.wxs" />
|
||||
66
components/production/production.wxss
Normal file
@ -0,0 +1,66 @@
|
||||
@import "../../app.wxss";
|
||||
.prod-items {
|
||||
width: 375rpx;
|
||||
float: left;
|
||||
background: #fff;
|
||||
padding-bottom: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
prod:nth-child(2n-1) .prod-items {
|
||||
padding: 20rpx 10rpx 10rpx 20rpx;
|
||||
}
|
||||
|
||||
prod:nth-child(2n) .prod-items {
|
||||
padding: 20rpx 20rpx 10rpx 10rpx;
|
||||
}
|
||||
|
||||
.hot-imagecont .hotsaleimg {
|
||||
width:345rpx;
|
||||
height:345rpx;
|
||||
|
||||
}
|
||||
|
||||
.hot-text .hotprod-text {
|
||||
height: 76rpx;
|
||||
font-size: 28rpx;
|
||||
display: -webkit-box;
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.prod-items .hot-imagecont {
|
||||
border-radius: 8rpx;
|
||||
text-align: center;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.prod-items .hot-text {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.prod-items .hot-text .prod-info {
|
||||
font-size: 20rpx;
|
||||
color: #777;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.prod-items .hot-text .prod-text-info {
|
||||
position: relative;
|
||||
height: 50rpx;
|
||||
line-height: 70rpx;
|
||||
font-family: Arial;
|
||||
}
|
||||
|
||||
.prod-items .hot-text .prod-text-info .price {
|
||||
color: #eb2444;
|
||||
}
|
||||
.deadline-price{
|
||||
font-size: 22rpx;
|
||||
margin-right: 5rpx;
|
||||
}
|
||||
BIN
images/icon/addr.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
images/icon/bg1.png
Normal file
|
After Width: | Height: | Size: 800 B |
BIN
images/icon/car-new.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
images/icon/car.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
images/icon/clear-his.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
images/icon/coupon-ot.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
images/icon/coupon-used.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
images/icon/delive-dot.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
images/icon/delivery-car.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
images/icon/dot.png
Normal file
|
After Width: | Height: | Size: 775 B |
BIN
images/icon/empty-cash.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
images/icon/everydaySale.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
images/icon/getCoupon.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
images/icon/horn.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
images/icon/menu-01.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
images/icon/menu-02.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
images/icon/menu-03.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
images/icon/menu-04.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
images/icon/more.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
images/icon/myAddr.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
images/icon/myCoupon.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
images/icon/newProd.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
images/icon/neweveryday.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
images/icon/newprods.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
images/icon/plus-sign.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
images/icon/prod-col-red.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
images/icon/prod-col.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
images/icon/promotion.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
images/icon/revise.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
images/icon/search-01.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
images/icon/search-col.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
images/icon/search-col2.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
images/icon/search.png
Normal file
|
After Width: | Height: | Size: 767 B |
BIN
images/icon/star-empty.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
images/icon/star-red.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
images/icon/timePrice.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
images/icon/toComment.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
images/icon/toDelivery.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
images/icon/toPay.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
images/icon/toTake.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
images/icon/tuiguang01.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
images/icon/tuiguang02.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
images/icon/tuiguang03.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
images/tabbar/basket-sel.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
images/tabbar/basket.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
images/tabbar/category-sel.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
images/tabbar/category.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
images/tabbar/homepage-sel.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
images/tabbar/homepage.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
images/tabbar/user-sel.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
images/tabbar/user.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
306
pages/basket/basket.js
Normal file
@ -0,0 +1,306 @@
|
||||
// pages/basket/basket.js
|
||||
var http = require("../../utils/http.js");
|
||||
// var config = require("../../utils/config.js");
|
||||
const Big = require("../../utils/big.min.js");
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
// picDomain: config.picDomain,
|
||||
shopCartItemDiscounts: [],
|
||||
finalMoney: 0,
|
||||
totalMoney: 0,
|
||||
subtractMoney: 0,
|
||||
allChecked: true
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
wx.showLoading();
|
||||
//加载购物车
|
||||
var params = {
|
||||
url: "/p/shopCart/info",
|
||||
method: "POST",
|
||||
data: {},
|
||||
callBack: res => {
|
||||
if (res.length > 0) {
|
||||
// 默认全选
|
||||
var shopCartItemDiscounts = res[0].shopCartItemDiscounts;
|
||||
shopCartItemDiscounts.forEach(shopCartItemDiscount => {
|
||||
shopCartItemDiscount.shopCartItems.forEach(shopCartItem => {
|
||||
shopCartItem.checked = true;
|
||||
})
|
||||
})
|
||||
|
||||
this.setData({
|
||||
shopCartItemDiscounts: shopCartItemDiscounts,
|
||||
allChecked: true
|
||||
});
|
||||
|
||||
} else {
|
||||
this.setData({
|
||||
shopCartItemDiscounts: [],
|
||||
});
|
||||
}
|
||||
this.calTotalPrice();//计算总价
|
||||
wx.hideLoading();
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
|
||||
http.getCartCount();//重新计算购物车总数量
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 去结算
|
||||
*/
|
||||
toFirmOrder: function () {
|
||||
var shopCartItemDiscounts = this.data.shopCartItemDiscounts;
|
||||
var basketIds = [];
|
||||
shopCartItemDiscounts.forEach(shopCartItemDiscount => {
|
||||
shopCartItemDiscount.shopCartItems.forEach(shopCartItem => {
|
||||
if (shopCartItem.checked) {
|
||||
basketIds.push(shopCartItem.basketId)
|
||||
}
|
||||
})
|
||||
})
|
||||
if (!basketIds.length) {
|
||||
wx.showToast({
|
||||
title: '请选择商品',
|
||||
icon: "none"
|
||||
})
|
||||
return
|
||||
}
|
||||
wx.setStorageSync("basketIds", JSON.stringify(basketIds));
|
||||
wx.navigateTo({
|
||||
url: '/pages/submit-order/submit-order?orderEntry=0',
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 全选
|
||||
*/
|
||||
onSelAll: function () {
|
||||
var allChecked = this.data.allChecked;
|
||||
allChecked = !allChecked; //改变状态
|
||||
var shopCartItemDiscounts = this.data.shopCartItemDiscounts;
|
||||
|
||||
for (var i = 0; i < shopCartItemDiscounts.length; i++) {
|
||||
var cItems = shopCartItemDiscounts[i].shopCartItems;
|
||||
for (var j = 0; j < cItems.length; j++) {
|
||||
cItems[j].checked = allChecked;
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
allChecked: allChecked,
|
||||
shopCartItemDiscounts: shopCartItemDiscounts
|
||||
});
|
||||
this.calTotalPrice();//计算总价
|
||||
},
|
||||
|
||||
/**
|
||||
* 每一项的选择事件
|
||||
*/
|
||||
onSelectedItem: function (e) {
|
||||
var index = e.currentTarget.dataset.index;// 获取data- 传进来的index
|
||||
var scindex = e.currentTarget.dataset.scindex;
|
||||
|
||||
var shopCartItemDiscounts = this.data.shopCartItemDiscounts;// 获取购物车列表
|
||||
var checked = shopCartItemDiscounts[scindex].shopCartItems[index].checked; // 获取当前商品的选中状态
|
||||
shopCartItemDiscounts[scindex].shopCartItems[index].checked = !checked; // 改变状态
|
||||
this.setData({
|
||||
shopCartItemDiscounts: shopCartItemDiscounts
|
||||
});
|
||||
this.checkAllSelected();//检查全选状态
|
||||
this.calTotalPrice();//计算总价
|
||||
},
|
||||
|
||||
/**
|
||||
* 检查全选状态
|
||||
*/
|
||||
checkAllSelected: function () {
|
||||
var allChecked = true;
|
||||
var shopCartItemDiscounts = this.data.shopCartItemDiscounts;
|
||||
|
||||
var flag = false;
|
||||
for (var i = 0; i < shopCartItemDiscounts.length; i++) {
|
||||
var cItems = shopCartItemDiscounts[i].shopCartItems;
|
||||
for (var j = 0; j < cItems.length; j++) {
|
||||
if (!cItems[j].checked) {
|
||||
allChecked = !allChecked;
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
allChecked: allChecked
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 计算购物车总额
|
||||
*/
|
||||
calTotalPrice: function () {
|
||||
var shopCartItemDiscounts = this.data.shopCartItemDiscounts;
|
||||
var shopCartIds = [];
|
||||
for (var i = 0; i < shopCartItemDiscounts.length; i++) {
|
||||
var cItems = shopCartItemDiscounts[i].shopCartItems;
|
||||
for (var j = 0; j < cItems.length; j++) {
|
||||
if (cItems[j].checked) {
|
||||
shopCartIds.push(cItems[j].basketId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ths = this;
|
||||
wx.showLoading();
|
||||
var params = {
|
||||
url: "/p/shopCart/totalPay",
|
||||
method: "POST",
|
||||
data: shopCartIds,
|
||||
callBack: function (res) {
|
||||
ths.setData({
|
||||
finalMoney: res.finalMoney,
|
||||
totalMoney: res.totalMoney,
|
||||
subtractMoney: res.subtractMoney
|
||||
});
|
||||
wx.hideLoading();
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 减少数量
|
||||
*/
|
||||
onCountMinus: function (e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
var scindex = e.currentTarget.dataset.scindex;
|
||||
var shopCartItemDiscounts = this.data.shopCartItemDiscounts;
|
||||
var prodCount = shopCartItemDiscounts[scindex].shopCartItems[index].prodCount;
|
||||
if (prodCount > 1) {
|
||||
this.updateCount(shopCartItemDiscounts, scindex, index, -1);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 增加数量
|
||||
*/
|
||||
onCountPlus: function (e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
var scindex = e.currentTarget.dataset.scindex;
|
||||
var shopCartItemDiscounts = this.data.shopCartItemDiscounts;
|
||||
this.updateCount(shopCartItemDiscounts, scindex, index, 1);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 改变购物车数量接口
|
||||
*/
|
||||
updateCount: function (shopCartItemDiscounts, scindex, index, prodCount) {
|
||||
var ths = this;
|
||||
wx.showLoading({
|
||||
mask: true
|
||||
});
|
||||
var params = {
|
||||
url: "/p/shopCart/changeItem",
|
||||
method: "POST",
|
||||
data: {
|
||||
count: prodCount,
|
||||
prodId: shopCartItemDiscounts[scindex].shopCartItems[index].prodId,
|
||||
skuId: shopCartItemDiscounts[scindex].shopCartItems[index].skuId,
|
||||
shopId: 1
|
||||
},
|
||||
callBack: function (res) {
|
||||
shopCartItemDiscounts[scindex].shopCartItems[index].prodCount += prodCount;
|
||||
ths.setData({
|
||||
shopCartItemDiscounts: shopCartItemDiscounts
|
||||
});
|
||||
ths.calTotalPrice();//计算总价
|
||||
wx.hideLoading();
|
||||
|
||||
http.getCartCount();//重新计算购物车总数量
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除购物车商品
|
||||
*/
|
||||
onDelBasket: function () {
|
||||
var ths = this;
|
||||
|
||||
var shopCartItemDiscounts = this.data.shopCartItemDiscounts;
|
||||
var basketIds = [];
|
||||
for (var i = 0; i < shopCartItemDiscounts.length; i++) {
|
||||
var cItems = shopCartItemDiscounts[i].shopCartItems;
|
||||
for (var j = 0; j < cItems.length; j++) {
|
||||
if (cItems[j].checked) {
|
||||
basketIds.push(cItems[j].basketId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (basketIds.length == 0) {
|
||||
wx.showToast({
|
||||
title: '请选择商品',
|
||||
icon: "none"
|
||||
})
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '',
|
||||
content: '确认要删除选中的商品吗?',
|
||||
confirmColor: "#eb2444",
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
|
||||
wx.showLoading({
|
||||
mask: true
|
||||
});
|
||||
var params = {
|
||||
url: "/p/shopCart/deleteItem",
|
||||
method: "DELETE",
|
||||
data: basketIds,
|
||||
callBack: function (res) {
|
||||
wx.hideLoading();
|
||||
ths.onShow();
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
6
pages/basket/basket.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "购物车",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
114
pages/basket/basket.wxml
Normal file
@ -0,0 +1,114 @@
|
||||
<!--pages/basket/basket.wxml-->
|
||||
<view class='container'>
|
||||
<view class="prod-list">
|
||||
<block wx:for="{{shopCartItemDiscounts}}" wx:key='' wx:for-index="scIndex">
|
||||
<view class='prod-block'>
|
||||
<view class='discount-tips' hidden='{{!item.chooseDiscountItemDto}}'>
|
||||
<text class='text-block'>{{wxs.parseDiscount(item.chooseDiscountItemDto.discountRule)}}</text>
|
||||
<text class='text-list'>{{wxs.parseDiscountMsg(item.chooseDiscountItemDto.discountRule,item.chooseDiscountItemDto.needAmount,item.chooseDiscountItemDto.discount)}}</text>
|
||||
</view>
|
||||
<block wx:for="{{item.shopCartItems}}" wx:key='' wx:for-item="prod">
|
||||
<view class='item'>
|
||||
<view class="btn">
|
||||
<label>
|
||||
<checkbox bindtap='onSelectedItem' data-scindex="{{scIndex}}" data-index="{{index}}" value="{{prod.prodId}}" checked="{{prod.checked}}" color="#105c3e" />
|
||||
</label>
|
||||
</view>
|
||||
<view class='prodinfo'>
|
||||
<view class="pic">
|
||||
<image src='{{prod.pic}}' />
|
||||
</view>
|
||||
<view class="opt">
|
||||
<view class='prod-name'>{{prod.prodName}}</view>
|
||||
<text class='prod-info-text {{prod.skuName?"":"empty-n"}}'>{{prod.skuName}}</text>
|
||||
<view class='price-count'>
|
||||
<view class='price'>
|
||||
<text class='symbol'>¥</text>
|
||||
<text class='big-num'>{{wxs.parsePrice(prod.price)[0]}}</text>
|
||||
<text class='small-num'>.{{wxs.parsePrice(prod.price)[1]}}</text>
|
||||
</view>
|
||||
<view class="m-numSelector">
|
||||
<view bindtap='onCountMinus' class="minus" data-scindex="{{scIndex}}" data-index="{{index}}"></view>
|
||||
<input type='number' value='{{prod.prodCount}}' disabled></input>
|
||||
<view bindtap='onCountPlus' class="plus" data-scindex="{{scIndex}}" data-index="{{index}}"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- <view class='lose-efficacy'>
|
||||
<view class='discount-tips'>
|
||||
|
||||
<text class='text-list'>失效商品</text>
|
||||
<text class='empty-prod'>清空失效商品</text>
|
||||
</view>
|
||||
<view class='item'>
|
||||
<view class="staus">
|
||||
<text>失效</text>
|
||||
</view>
|
||||
<view class='prodinfo'>
|
||||
<view class="pic">
|
||||
<image src='../../images/prod/pic11.jpg' />
|
||||
</view>
|
||||
<view class="opt">
|
||||
<view class='prod-name'>宠物用品洗澡香波沐浴除臭留</view>
|
||||
<view class='prod-info-text'>60克</view>
|
||||
<view class='price-count'>
|
||||
<view class='price'>
|
||||
<text class='symbol'>¥</text>
|
||||
<text class='big-num'>{{wxs.parsePrice(10.00)[0]}}</text>
|
||||
<text class='small-num'>.{{wxs.parsePrice(10.00)[1]}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
|
||||
<view class="empty" wx:if="{{shopCartItemDiscounts.length==0}}">
|
||||
<view class="img">
|
||||
<image src='../../images/tabbar/basket.png'></image>
|
||||
</view>
|
||||
<view class="txt">
|
||||
您还没有添加任何商品哦~
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="cart-footer" wx:if="{{shopCartItemDiscounts.length>0}}">
|
||||
<view class="btn all">
|
||||
<label bindtap='onSelAll'>
|
||||
<checkbox checked='{{allChecked}}' color='#f7d731;' />全选</label>
|
||||
</view>
|
||||
<view class="btn del" bindtap='onDelBasket'>
|
||||
<text>删除</text>
|
||||
</view>
|
||||
<view class="btn total">
|
||||
<view class="finally">
|
||||
<text>合计:</text>
|
||||
<view class='price'>
|
||||
<text class='symbol'>¥</text>
|
||||
<text class='big-num'>{{wxs.parsePrice(finalMoney)[0]}}</text>
|
||||
<text class='small-num'>.{{wxs.parsePrice(finalMoney)[1]}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="total-msg" wx:if="{{subtractMoney>0}}">
|
||||
总额:¥{{wxs.toPrice(totalMoney)}} 立减:¥{{wxs.toPrice(subtractMoney)}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn settle" bindtap='toFirmOrder'>
|
||||
<text>结算</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- end 底部按钮 -->
|
||||
|
||||
</view>
|
||||
|
||||
<wxs module="wxs" src="../../wxs/number.wxs" />
|
||||
387
pages/basket/basket.wxss
Normal file
@ -0,0 +1,387 @@
|
||||
/* pages/basket/basket.wxss */
|
||||
|
||||
page {
|
||||
width: 100%;
|
||||
background: #f4f4f4;
|
||||
}
|
||||
.container{
|
||||
padding-bottom:118rpx;
|
||||
}
|
||||
container .prod-list {
|
||||
width: 100%;
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.prod-list .prod-block {
|
||||
background: #fff;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.prod-list .prod-block .discount-tips {
|
||||
padding: 20rpx 0 20rpx 20rpx;
|
||||
border-bottom: 2rpx solid #f4f4f4;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.prod-list .prod-block .discount-tips .text-block {
|
||||
padding:3rpx 5rpx;
|
||||
/* padding: 0 5rpx; */
|
||||
border-radius: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #eb2444;
|
||||
border: 2rpx solid #eb2444;
|
||||
}
|
||||
|
||||
.prod-list .prod-block .discount-tips .text-list {
|
||||
font-size: 24rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.prod-list .item {
|
||||
background: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.prod-list .item .prodinfo {
|
||||
position: relative;
|
||||
color: #999;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.prod-list .item .prodinfo::after {
|
||||
content: '';
|
||||
background-color: #f4f4f4;
|
||||
left: 0;
|
||||
height: 1px;
|
||||
transform-origin: 50% 100% 0;
|
||||
bottom: -20rpx;
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 642rpx;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
.prod-list .item:last-child .prodinfo::after {
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.prod-list .item .staus {
|
||||
text-align: center;
|
||||
background: rgb(196, 192, 192);
|
||||
font-size: 20rpx;
|
||||
width: 50rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.prodinfo {
|
||||
display: flex;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.prod-list .item .opt {
|
||||
font-size: 28rpx;
|
||||
margin-left: 20rpx;
|
||||
width:100%;
|
||||
|
||||
}
|
||||
|
||||
.prodinfo .opt .prod-name {
|
||||
color:#333;
|
||||
max-height: 72rpx;
|
||||
line-height: 36rpx;
|
||||
display: -webkit-box;
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.prodinfo .opt .prod-info-text {
|
||||
color: #999;
|
||||
display: inline-block;
|
||||
-webkit-line-clamp: 1;
|
||||
height: 48rpx;
|
||||
line-height: 48rpx;
|
||||
background: #f9f9f9;
|
||||
padding: 0 10rpx 0 10rpx;
|
||||
border-radius: 4rpx;
|
||||
margin: 10rpx 0 0rpx 0;
|
||||
overflow: hidden;
|
||||
font-size: 24rpx;
|
||||
position: relative;
|
||||
font-family: arial;
|
||||
}
|
||||
.prodinfo .opt .prod-info-text.empty-n{
|
||||
padding:0;
|
||||
}
|
||||
|
||||
/* .prod-info-text:before, .prod-info-text:after {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
border: 5px solid transparent;
|
||||
right: 5px;
|
||||
top: 10px;
|
||||
} */
|
||||
|
||||
.prod-info-text:before {
|
||||
border-top: 5px solid #aaa;
|
||||
}
|
||||
|
||||
.prod-info-text:after {
|
||||
border-top: 5px solid #f9f9f9;
|
||||
top: 9px;
|
||||
}
|
||||
|
||||
.prod-list .item .prodinfo .pic {
|
||||
text-align: center;
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
line-height: 180rpx;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.prod-list .item .pic image {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
/* border-radius: 8rpx; */
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.prodinfo .opt .price-count {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.prodinfo .opt .price-count .price {
|
||||
color: #eb2444;
|
||||
}
|
||||
|
||||
.lose-efficacy .prodinfo .opt .price-count .price {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 加减框 */
|
||||
|
||||
.m-numSelector .minus, .m-numSelector input, .m-numSelector .plus {
|
||||
float: left;
|
||||
box-sizing: border-box;
|
||||
height: 56rpx;
|
||||
border: 2rpx solid #d9d9d9;
|
||||
}
|
||||
|
||||
.m-numSelector {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.m-numSelector .minus, .m-numSelector .plus {
|
||||
position: relative;
|
||||
width: 56rpx;
|
||||
}
|
||||
|
||||
.m-numSelector .minus {
|
||||
border-right: 0;
|
||||
border-top-left-radius: 4rpx;
|
||||
border-bottom-left-radius: 4rpx;
|
||||
}
|
||||
|
||||
.m-numSelector input {
|
||||
width: 56rpx;
|
||||
text-align: center;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.m-numSelector .plus {
|
||||
border-left: 0;
|
||||
border-top-right-radius: 4rpx;
|
||||
border-bottom-right-radius: 4rpx;
|
||||
}
|
||||
|
||||
.m-numSelector .minus::before, .m-numSelector .plus::before,
|
||||
.m-numSelector .plus::after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
content: ' ';
|
||||
width: 22rpx;
|
||||
height: 3rpx;
|
||||
background-color: #7f7f7f;
|
||||
}
|
||||
|
||||
.m-numSelector .plus::after {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.m-numSelector:not(.disabled) .minus:not(.disabled):active,
|
||||
.m-numSelector:not(.disabled) .plus:not(.disabled):active {
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
|
||||
/*checkbox 选项框大小 */
|
||||
|
||||
checkbox .wx-checkbox-input {
|
||||
border-radius: 50%;
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
}
|
||||
|
||||
/*checkbox选中后样式 */
|
||||
|
||||
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
|
||||
background: #eb2444;
|
||||
border-color: #eb2444;
|
||||
}
|
||||
|
||||
/*checkbox选中后图标样式 */
|
||||
|
||||
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
|
||||
text-align: center;
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
background: transparent;
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
-webkit-transform: translate(-50%, -50%) scale(1);
|
||||
}
|
||||
|
||||
/* 购物车为空 */
|
||||
|
||||
.empty {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.empty .txt {
|
||||
text-align: center;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.empty .img {
|
||||
margin-top: 80rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty .img image {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
}
|
||||
|
||||
/* 失效商品 */
|
||||
|
||||
.lose-efficacy {
|
||||
margin-top: 20rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.lose-efficacy .item {
|
||||
background: #f8f8f9;
|
||||
}
|
||||
|
||||
.prod-list .lose-efficacy .discount-tips {
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 2rpx solid #ddd;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.lose-efficacy .discount-tips .empty-prod {
|
||||
color: #777;
|
||||
font-size: 26rpx;
|
||||
border: 2rpx solid #999;
|
||||
padding: 0 10rpx;
|
||||
border-radius: 8rpx;
|
||||
float: right;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.price-count .disable-price {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.prod-list .lose-efficacy .discount-tips .text-list {
|
||||
font-size: 30rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
/** 底部按钮 */
|
||||
|
||||
.cart-footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row nowrap;
|
||||
height: 98rpx;
|
||||
border-top: 2rpx solid #f4f4f4;
|
||||
z-index:999;
|
||||
}
|
||||
|
||||
.cart-footer .btn {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 0;
|
||||
background-color: #fafafa;
|
||||
background:rgba(255,255,255,0.95);
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.cart-footer .btn .total-msg{
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.cart-footer .btn.total{
|
||||
display:flex;
|
||||
flex-flow:column;
|
||||
align-items:flex-start;
|
||||
|
||||
}
|
||||
.cart-footer .btn.del {
|
||||
color:#eb2444;
|
||||
width:70rpx;
|
||||
font-size:22rpx;
|
||||
text-align:left;
|
||||
display:block;
|
||||
line-height:102rpx;
|
||||
|
||||
}
|
||||
|
||||
.cart-footer .btn.all {
|
||||
width: 150rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.cart-footer .btn.all label {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.cart-footer .btn.total {
|
||||
width: 300rpx;
|
||||
}
|
||||
|
||||
.cart-footer .btn.total .price {
|
||||
color: #eb2444;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.cart-footer .btn.settle {
|
||||
width: 200rpx;
|
||||
background: #eb2444;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/** end 底部按钮 */
|
||||
106
pages/binding-phone/binding-phone.js
Normal file
@ -0,0 +1,106 @@
|
||||
// pages/binding-phone/binding-phone.js
|
||||
|
||||
var http = require("../../utils/http.js");
|
||||
var config = require("../../utils/config.js");
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
phonenum:'',
|
||||
code:'',
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
|
||||
getCodeNumber:function(){
|
||||
if (this.data.phoneNumber == "" ) {
|
||||
wx.showToast({
|
||||
title: '请输入手机号',
|
||||
icon: "none"
|
||||
})
|
||||
return;
|
||||
}
|
||||
var params = {
|
||||
url: "/p/sms/send",
|
||||
method: "POST",
|
||||
data: {
|
||||
// phonenum: this.data.phonenum,
|
||||
// code: this.data.code
|
||||
},
|
||||
callBack: (res) => {
|
||||
this.setData({
|
||||
phonenum: this.data.phonenum,
|
||||
code: this.data.code
|
||||
});
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
},
|
||||
onPhoneInput:function(e){
|
||||
this.setData({
|
||||
phonenum: e.detail.value
|
||||
});
|
||||
},
|
||||
onCodeInput: function (e) {
|
||||
this.setData({
|
||||
code: e.detail.value
|
||||
});
|
||||
}
|
||||
})
|
||||
6
pages/binding-phone/binding-phone.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "绑定手机号码",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
21
pages/binding-phone/binding-phone.wxml
Normal file
@ -0,0 +1,21 @@
|
||||
<!--pages/binding-phone/binding-phone.wxml-->
|
||||
<view class='container'>
|
||||
<view class='binding-phone'>
|
||||
<!-- <block wx:for='{{couponList}}' wx:key=''> -->
|
||||
<view class='item'>
|
||||
<text class='item-tip'>手机号码:</text>
|
||||
<input placeholder='输入手机号码' type='number' maxlength='11' value="{{phonenum}}" bindinput="onPhoneInput" ></input>
|
||||
</view>
|
||||
<view class='item '>
|
||||
<text class='item-tip'>验证码:</text>
|
||||
<input placeholder='输入验证码' type='number' value="{{code}}" bindinput="onCodeInput" ></input>
|
||||
<text class='get-code gray' bindtap='getCodeNumber'>获取验证码</text>
|
||||
</view>
|
||||
<!-- </block> -->
|
||||
</view>
|
||||
|
||||
<view class='btn-box'>
|
||||
<text class='sure-btn gray'>确定</text>
|
||||
<text class='sure-btn '>确定</text>
|
||||
</view>
|
||||
</view>
|
||||
69
pages/binding-phone/binding-phone.wxss
Normal file
@ -0,0 +1,69 @@
|
||||
/* pages/binding-phone/binding-phone.wxss */
|
||||
|
||||
page {
|
||||
background: #f4f4f4;
|
||||
}
|
||||
|
||||
.binding-phone {
|
||||
height: 100%;
|
||||
margin-top: 20rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.binding-phone .item {
|
||||
display: flex;
|
||||
padding: 20rpx 0;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border-bottom: 2rpx solid #e1e1e1;
|
||||
}
|
||||
|
||||
.binding-phone .item:last-child {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.binding-phone .item input {
|
||||
flex: 1;
|
||||
height: auto;
|
||||
padding: 0 20rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.binding-phone .item .item-tip {
|
||||
width: 140rpx;
|
||||
font-size: 28rpx;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
.binding-phone .item .get-code {
|
||||
font-size: 30rpx;
|
||||
color: #999;
|
||||
margin-right: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.binding-phone .item .get-code.gray {
|
||||
color: #3eb370;
|
||||
}
|
||||
|
||||
.btn-box {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
|
||||
.btn-box .sure-btn {
|
||||
display: block;
|
||||
font-size: 32rpx;
|
||||
color: #fff;
|
||||
background: #3eb370;
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
padding: 20rpx 0;
|
||||
border-radius: 50rpx;
|
||||
}
|
||||
|
||||
.btn-box .sure-btn.gray {
|
||||
background: #e1e1e1;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
140
pages/category/category.js
Normal file
@ -0,0 +1,140 @@
|
||||
// pages/category/category.js
|
||||
|
||||
var http = require("../../utils/http.js");
|
||||
var config = require("../../utils/config.js");
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
selIndex: 0,
|
||||
categoryList:[],
|
||||
productList: [],
|
||||
categoryImg: '',
|
||||
prodid:''
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
var ths = this;
|
||||
//加载分类列表
|
||||
var params = {
|
||||
url: "/category/categoryInfo",
|
||||
method: "GET",
|
||||
data: {
|
||||
parentId: ''
|
||||
},
|
||||
callBack: function (res) {
|
||||
// console.log(res);
|
||||
ths.setData({
|
||||
categoryImg: res[0].pic,
|
||||
categoryList: res,
|
||||
});
|
||||
ths.getProdList(res[0].categoryId)
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 分类点击事件
|
||||
*/
|
||||
onMenuTab: function (e) {
|
||||
console.log(e);
|
||||
var id = e.currentTarget.dataset.id;
|
||||
var index = e.currentTarget.dataset.index;
|
||||
// this.getProdList(id);
|
||||
this.getProdList(this.data.categoryList[index].categoryId);
|
||||
this.setData({
|
||||
categoryImg: this.data.categoryList[index].pic,
|
||||
selIndex: index
|
||||
});
|
||||
},
|
||||
|
||||
// 跳转搜索页
|
||||
toSearchPage: function () {
|
||||
wx.navigateTo({
|
||||
url: '/pages/search-page/search-page',
|
||||
})
|
||||
},
|
||||
getProdList(categoryId) {
|
||||
//加载分类列表
|
||||
var params = {
|
||||
url: "/prod/pageProd",
|
||||
method: "GET",
|
||||
data: {
|
||||
categoryId: categoryId
|
||||
},
|
||||
callBack: (res) => {
|
||||
// console.log(res);
|
||||
this.setData({
|
||||
productList: res.records,
|
||||
});
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
//跳转商品详情页
|
||||
toProdPage: function (e) {
|
||||
var prodid = e.currentTarget.dataset.prodid;
|
||||
wx.navigateTo({
|
||||
url: '/pages/prod/prod?prodid=' + prodid,
|
||||
})
|
||||
},
|
||||
})
|
||||
6
pages/category/category.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "分类商品",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
58
pages/category/category.wxml
Normal file
@ -0,0 +1,58 @@
|
||||
<!--pages/category/category.wxml-->
|
||||
|
||||
<view class="container">
|
||||
|
||||
|
||||
<!-- 头部搜索区 -->
|
||||
|
||||
<view class='search-bar'>
|
||||
<view class='search-box' bindtap='toSearchPage'>
|
||||
<image src='../../images/icon/search.png' class='search-img'></image>
|
||||
<text class='sear-input'>搜索您想要的商品</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 滚动内容区 -->
|
||||
<view class="main">
|
||||
<!-- 左侧菜单start -->
|
||||
<scroll-view scroll-y="true" class='leftmenu'>
|
||||
<block wx:for='{{ categoryList}}' wx:key=''>
|
||||
<view class='menu-item {{selIndex==index?"active":""}} ' data-index="{{index}}" data-id="{{item.categoryId}}" bindtap='onMenuTab'>
|
||||
{{item.categoryName}}
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
<!-- 左侧菜单end -->
|
||||
|
||||
<!-- 右侧内容start -->
|
||||
<scroll-view scroll-y="true" class='rightcontent' scroll-into-view="{{toViewId}}">
|
||||
<!-- <block wx:for='{{ productList}}' wx:key=''> -->
|
||||
<view class='adver-map'>
|
||||
<view class='item-a'>
|
||||
<image src='{{categoryImg}}' mode='widthFix'></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class='cont-item'>
|
||||
<block wx:for='{{productList}}' wx:key=''>
|
||||
<view class='show-item' bindtap='toProdPage' data-prodid="{{item.prodId}}">
|
||||
<view class='more-prod-pic'>
|
||||
<image src='{{item.pic}}' class='more-pic'mode='widthFix'></image>
|
||||
</view>
|
||||
<view class='prod-text-right'>
|
||||
<view class='prod-text more'>{{item.prodName}}</view>
|
||||
<view class='cate-prod-info'>{{item.brief}}</view>
|
||||
<view class='prod-price more'>
|
||||
<text class='symbol'>¥</text> <text class='big-num'>{{wxs.parsePrice(item.price)[0]}}</text><text class='small-num'>.{{wxs.parsePrice(item.price)[1]}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</block>
|
||||
</view>
|
||||
<!-- </block> -->
|
||||
</scroll-view>
|
||||
<!-- 右侧内容end -->
|
||||
<!-- </block> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<wxs module="wxs" src="../../wxs/number.wxs" />
|
||||
223
pages/category/category.wxss
Normal file
@ -0,0 +1,223 @@
|
||||
/* pages/category/category.wxss */
|
||||
|
||||
page {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.main {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
margin-top: 100rpx;
|
||||
height: calc(100% - 100rpx);
|
||||
}
|
||||
|
||||
/* 搜索栏 */
|
||||
|
||||
.search-bar {
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
color: #777;
|
||||
background: #fff;
|
||||
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.07);
|
||||
z-index: 3;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.search-bar .arrow {
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
border-bottom: 2rpx solid #777;
|
||||
border-left: 2rpx solid #777;
|
||||
transform: rotate(45deg);
|
||||
position: absolute;
|
||||
left: 30rpx;
|
||||
top: 41rpx;
|
||||
}
|
||||
|
||||
.search-bar .search-box {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 60rpx;
|
||||
background: #f7f7f7;
|
||||
z-index: 999;
|
||||
width: 92%;
|
||||
border-radius: 50rpx;
|
||||
text-align: center;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.sear-input {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.search-bar .search-hint {
|
||||
font-size: 28rpx;
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 32rpx;
|
||||
}
|
||||
|
||||
.search-bar .search-box .search-img {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
/* 左侧菜单栏 */
|
||||
|
||||
.leftmenu {
|
||||
width: 200rpx;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
background-color: #f5f6f7;
|
||||
overflow: scroll;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
text-align: center;
|
||||
border-bottom: 2rpx silid #e3e3e3;
|
||||
position: relative;
|
||||
color: #777;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.menu-item.active {
|
||||
color: #eb2444;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
position: relative;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.menu-item.active:before {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
content: "";
|
||||
width: 8rpx;
|
||||
height: 32rpx;
|
||||
top: 29rpx;
|
||||
background: #eb2444;
|
||||
}
|
||||
|
||||
.menu-item text.tips-num {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 15rpx;
|
||||
border-radius: 15rpx;
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
background: red;
|
||||
color: #fff;
|
||||
font-size: 25rpx;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
/* 右侧商品栏 */
|
||||
|
||||
.rightcontent {
|
||||
width: 550rpx;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.rightcontent .adver-map {
|
||||
width: auto;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
margin: 30rpx 20rpx 0;
|
||||
}
|
||||
|
||||
.rightcontent .adver-map .item-a {
|
||||
display: block;
|
||||
font-size: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.rightcontent .adver-map .item-a image {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.rightcontent .cont-item {
|
||||
padding: 0 20rpx 20rpx 20rpx;
|
||||
}
|
||||
|
||||
.rightcontent .cont-item .show-item .more-prod-pic {
|
||||
text-align: center;
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
line-height: 150rpx;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.rightcontent .cont-item .show-item .more-prod-pic .more-pic {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
border-radius: 8rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.rightcontent .cont-item .show-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: start;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.rightcontent .cont-item .show-item::after {
|
||||
content: '';
|
||||
background-color: #f4f4f4;
|
||||
left: 0;
|
||||
height: 1px;
|
||||
transform-origin: 50% 100% 0;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 510rpx;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
.rightcontent .cont-item .show-item .prod-text-right {
|
||||
margin-left: 20rpx;
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
.rightcontent .cont-item .show-item .prod-text-right .cate-prod-info {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin: 10rpx 0 20rpx 0;
|
||||
}
|
||||
|
||||
.rightcontent .cont-item .show-item .prod-text-right .prod-text.more {
|
||||
margin: 0;
|
||||
font-size: 28rpx;
|
||||
display: -webkit-box;
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.rightcontent .cont-item .show-item .prod-text-right .prod-price.more {
|
||||
font-size: 28rpx;
|
||||
color: #eb2444;
|
||||
font-family: arial;
|
||||
}
|
||||
98
pages/delivery-address/delivery-address.js
Normal file
@ -0,0 +1,98 @@
|
||||
// pages/delivery-address/delivery-address.js
|
||||
|
||||
var http = require("../../utils/http.js");
|
||||
// var config = require("../../utils/config.js");
|
||||
|
||||
Page({
|
||||
data: {
|
||||
defaultSize: 'mini',
|
||||
disabled: false,
|
||||
plain: true,
|
||||
loading: false,
|
||||
addressList: [],
|
||||
addAddress: '',
|
||||
order: -1
|
||||
},
|
||||
|
||||
onLoad: function (option) {
|
||||
if (option.order) {
|
||||
this.setData({
|
||||
order: option.order
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
//新增收货地址
|
||||
onAddAddr: function (e) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/editAddress/editAddress',
|
||||
})
|
||||
},
|
||||
|
||||
//设置为默认地址
|
||||
onDefaultAddr: function (e) {
|
||||
var addrId = e.currentTarget.dataset.addrid;
|
||||
console.log(addrId)
|
||||
var ths = this;
|
||||
wx.showLoading();
|
||||
var params = {
|
||||
url: "/p/address/defaultAddr/" + addrId,
|
||||
method: "PUT",
|
||||
data: {
|
||||
addrId:addrId
|
||||
},
|
||||
callBack: function (res) {
|
||||
wx.hideLoading();
|
||||
|
||||
}
|
||||
}
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
//加载地址列表
|
||||
onShow: function () {
|
||||
var ths = this;
|
||||
wx.showLoading();
|
||||
|
||||
|
||||
var params = {
|
||||
url: "/p/address/list",
|
||||
method: "GET",
|
||||
data: {},
|
||||
callBack: function (res) {
|
||||
//console.log(res)
|
||||
ths.setData({
|
||||
addressList: res
|
||||
});
|
||||
wx.hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
// 修改地址
|
||||
toEditAddress: function (e) {
|
||||
var addrId = e.currentTarget.dataset.addrid;
|
||||
wx.navigateTo({
|
||||
url: '/pages/editAddress/editAddress?addrId=' + addrId,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择地址 跳转回提交订单页
|
||||
*/
|
||||
selAddrToOrder: function (e) {
|
||||
if (this.data.order == 0) {
|
||||
var pages = getCurrentPages();//当前页面
|
||||
var prevPage = pages[pages.length - 2];//上一页面
|
||||
prevPage.setData({//直接给上移页面赋值
|
||||
item: e.currentTarget.dataset.item,
|
||||
selAddress: 'yes'
|
||||
});
|
||||
wx.navigateBack({//返回
|
||||
delta: 1
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
6
pages/delivery-address/delivery-address.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "收货地址",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
37
pages/delivery-address/delivery-address.wxml
Normal file
@ -0,0 +1,37 @@
|
||||
<!--pages/delivery-address/delivery-address.wxml-->
|
||||
<view class='container'>
|
||||
<view class='main'>
|
||||
<view class="empty" wx:if="{{addressList.length==0}}">
|
||||
<view class="img">
|
||||
<image src='http://jiales.gz-yami.com/addr.png'></image>
|
||||
</view>
|
||||
<view class='txt'>您还没有收货地址</view>
|
||||
</view>
|
||||
<radio-group class="radio-group" bindchange="radioChange">
|
||||
<block wx:for="{{addressList}}">
|
||||
<view class='address'>
|
||||
<view class='personal' bindtap='selAddrToOrder' data-item="{{item}}">
|
||||
<view class='info-tit'>
|
||||
<text class='name'>{{item.receiver}}</text>
|
||||
<text class='tel'>{{item.mobile}}</text>
|
||||
<image src='../../images/icon/revise.png' catchtap='toEditAddress' data-addrid="{{item.addrId}}"></image>
|
||||
</view>
|
||||
<view class='addr'>
|
||||
|
||||
<text class='addr-get'> {{item.province}}{{item.city}}{{item.area}}{{item.addr}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class='select-btn'>
|
||||
<view class="box">
|
||||
<label bindtap='onDefaultAddr' data-addrid="{{item.addrId}}">
|
||||
<radio value="{{item.prodId}}" checked="{{item.commonAddr==1}}" color="#eb2444" />设为默认地址</label>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</radio-group>
|
||||
</view>
|
||||
<view class='footer' bindtap='onAddAddr'>
|
||||
<text>新增收货地址</text>
|
||||
</view>
|
||||
</view>
|
||||
101
pages/delivery-address/delivery-address.wxss
Normal file
@ -0,0 +1,101 @@
|
||||
/* pages/delivery-address/delivery-address.wxss */
|
||||
|
||||
page {
|
||||
background-color: #f4f4f4;
|
||||
border-top: 2rpx solid #e9eaec;
|
||||
padding-bottom: 150rpx;
|
||||
}
|
||||
|
||||
.main {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.address {
|
||||
margin-bottom: 15rpx;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border-bottom: 2rpx solid #e9eaec;
|
||||
}
|
||||
|
||||
.address .personal {
|
||||
position: relative;
|
||||
padding: 20rpx 30rpx;
|
||||
border-bottom: 3rpx dashed #e9eaec;
|
||||
}
|
||||
|
||||
.address .personal .info-tit .name {
|
||||
margin-right: 30rpx;
|
||||
font-size: 32rpx;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.address .personal .info-tit .tel {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.address .personal .info-tit image {
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 46rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-left: 50rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.personal .addr {
|
||||
font-size: 26rpx;
|
||||
margin: 10rpx 0;
|
||||
}
|
||||
|
||||
.personal .addr .addr-get {
|
||||
display: inline-block;
|
||||
color: #999;
|
||||
width: 85%;
|
||||
}
|
||||
|
||||
.address .select-btn {
|
||||
padding: 15rpx 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.address .select-btn .box {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 -1rpx 8rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.footer text {
|
||||
font-size: 32rpx;
|
||||
color: #eb2444;
|
||||
}
|
||||
|
||||
.empty .img {
|
||||
text-align: center;
|
||||
margin-top: 130rpx;
|
||||
}
|
||||
|
||||
.empty .img image {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
display: block;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.empty .txt {
|
||||
margin-top: 30rpx;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
}
|
||||
409
pages/editAddress/editAddress.js
Normal file
@ -0,0 +1,409 @@
|
||||
// pages/editAddress/editAddress.js
|
||||
var http = require("../../utils/http.js");
|
||||
var config = require("../../utils/config.js");
|
||||
var index = [18, 0, 0];
|
||||
|
||||
var t = 0;
|
||||
var show = false;
|
||||
var moveY = 200;
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
value: [0, 0, 0],
|
||||
provArray: [],
|
||||
cityArray: [],
|
||||
areaArray: [],
|
||||
province: "",
|
||||
city: "",
|
||||
area: "",
|
||||
provinceId: 0,
|
||||
cityId: 0,
|
||||
areaId: 0,
|
||||
receiver: "",
|
||||
mobile: "",
|
||||
addr: "",
|
||||
addrId: 0
|
||||
},
|
||||
|
||||
onLoad: function (options) {
|
||||
if (options.addrId) {
|
||||
wx.showLoading();
|
||||
var params = {
|
||||
url: "/p/address/addrInfo/" + options.addrId,
|
||||
method: "GET",
|
||||
data: {},
|
||||
callBack: res => {
|
||||
//console.log(res)
|
||||
this.setData({
|
||||
province: res.province,
|
||||
city: res.city,
|
||||
area: res.area,
|
||||
provinceId: res.provinceId,
|
||||
cityId: res.cityId,
|
||||
areaId: res.areaId,
|
||||
receiver: res.receiver,
|
||||
mobile: res.mobile,
|
||||
addr: res.addr,
|
||||
addrId: options.addrId
|
||||
});
|
||||
this.initCityData(res.provinceId, res.cityId, res.areaId);
|
||||
wx.hideLoading();
|
||||
}
|
||||
}
|
||||
http.request(params);
|
||||
} else {
|
||||
this.initCityData(this.data.provinceId, this.data.cityId, this.data.areaId);
|
||||
}
|
||||
},
|
||||
|
||||
initCityData: function (provinceId, cityId, areaId) {
|
||||
var ths = this;
|
||||
wx.showLoading();
|
||||
var params = {
|
||||
url: "/p/area/listByPid",
|
||||
method: "GET",
|
||||
data: {
|
||||
pid: 0
|
||||
},
|
||||
callBack: function (res) {
|
||||
//console.log(res)
|
||||
ths.setData({
|
||||
provArray: res
|
||||
});
|
||||
if (provinceId) {
|
||||
for (var index in res) {
|
||||
if (res[index].areaId == provinceId) {
|
||||
ths.setData({
|
||||
value: [index, ths.data.value[1], ths.data.value[2]]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
ths.getCityArray(provinceId ? provinceId : res[0].areaId, cityId, areaId);
|
||||
wx.hideLoading();
|
||||
}
|
||||
}
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
//滑动事件
|
||||
bindChange: function (e) {
|
||||
var ths = this;
|
||||
var val = e.detail.value
|
||||
|
||||
//判断滑动的是第几个column
|
||||
//若省份column做了滑动则定位到地级市和区县第一位
|
||||
if (index[0] != val[0]) {
|
||||
val[1] = 0;
|
||||
val[2] = 0;
|
||||
//更新数据
|
||||
ths.getCityArray(this.data.provArray[val[0]].areaId);//获取地级市数据
|
||||
} else { //若省份column未做滑动,地级市做了滑动则定位区县第一位
|
||||
if (index[1] != val[1]) {
|
||||
val[2] = 0;
|
||||
//更新数据
|
||||
ths.getAreaArray(this.data.cityArray[val[1]].areaId);//获取区县数据
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
index = val;
|
||||
this.setData({
|
||||
value: [val[0], val[1], val[2]],
|
||||
})
|
||||
ths.setData({
|
||||
province: ths.data.provArray[ths.data.value[0]].areaName,
|
||||
city: ths.data.cityArray[ths.data.value[1]].areaName,
|
||||
area: ths.data.areaArray[ths.data.value[2]].areaName,
|
||||
provinceId: ths.data.provArray[ths.data.value[0]].areaId,
|
||||
cityId: ths.data.cityArray[ths.data.value[1]].areaId,
|
||||
areaId: ths.data.areaArray[ths.data.value[2]].areaId
|
||||
})
|
||||
},
|
||||
|
||||
onReady: function () {
|
||||
this.animation = wx.createAnimation({
|
||||
transformOrigin: "50% 50%",
|
||||
duration: 0,
|
||||
timingFunction: "ease",
|
||||
delay: 0
|
||||
}
|
||||
)
|
||||
this.animation.translateY(200 + 'vh').step();
|
||||
this.setData({
|
||||
animation: this.animation.export(),
|
||||
show: show
|
||||
})
|
||||
},
|
||||
//移动按钮点击事件
|
||||
translate: function (e) {
|
||||
if (t == 0) {
|
||||
moveY = 0;
|
||||
show = false;
|
||||
t = 1;
|
||||
} else {
|
||||
moveY = 200;
|
||||
show = true;
|
||||
t = 0;
|
||||
}
|
||||
// this.animation.translate(arr[0], arr[1]).step();
|
||||
this.animationEvents(this, moveY, show);
|
||||
|
||||
},
|
||||
//隐藏弹窗浮层
|
||||
hiddenFloatView(e) {
|
||||
//console.log(e);
|
||||
moveY = 200;
|
||||
show = true;
|
||||
t = 0;
|
||||
this.animationEvents(this, moveY, show);
|
||||
|
||||
},
|
||||
|
||||
//动画事件
|
||||
animationEvents: function (that, moveY, show) {
|
||||
//console.log("moveY:" + moveY + "\nshow:" + show);
|
||||
that.animation = wx.createAnimation({
|
||||
transformOrigin: "50% 50%",
|
||||
duration: 400,
|
||||
timingFunction: "ease",
|
||||
delay: 0
|
||||
}
|
||||
)
|
||||
that.animation.translateY(moveY + 'vh').step()
|
||||
|
||||
that.setData({
|
||||
animation: that.animation.export(),
|
||||
show: show
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据省份ID获取 城市数据
|
||||
*/
|
||||
getCityArray: function (provinceId, cityId, areaId) {
|
||||
var ths = this;
|
||||
var params = {
|
||||
url: "/p/area/listByPid",
|
||||
method: "GET",
|
||||
data: {
|
||||
pid: provinceId
|
||||
},
|
||||
callBack: function (res) {
|
||||
//console.log(res)
|
||||
ths.setData({
|
||||
cityArray: res
|
||||
});
|
||||
if (cityId) {
|
||||
for (var index in res) {
|
||||
if (res[index].areaId == cityId) {
|
||||
ths.setData({
|
||||
value: [ths.data.value[0], index, ths.data.value[2]]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
ths.getAreaArray(cityId ? cityId : res[0].areaId, areaId);
|
||||
wx.hideLoading();
|
||||
}
|
||||
}
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据城市ID获取 区数据
|
||||
*/
|
||||
getAreaArray: function (cityId, areaId) {
|
||||
var ths = this;
|
||||
var params = {
|
||||
url: "/p/area/listByPid",
|
||||
method: "GET",
|
||||
data: {
|
||||
pid: cityId
|
||||
},
|
||||
callBack: function (res) {
|
||||
//console.log(res)
|
||||
ths.setData({
|
||||
areaArray: res
|
||||
});
|
||||
if (areaId) {
|
||||
|
||||
for (var _index in res) {
|
||||
if (res[_index].areaId == areaId) {
|
||||
ths.setData({
|
||||
value: [ths.data.value[0], ths.data.value[1], _index]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
index = ths.data.value;
|
||||
|
||||
ths.setData({
|
||||
province: ths.data.province,
|
||||
city: ths.data.city,
|
||||
area: ths.data.area,
|
||||
provinceId: ths.data.provinceId,
|
||||
cityId: ths.data.cityId,
|
||||
areaId: ths.data.areaId
|
||||
})
|
||||
|
||||
} else {
|
||||
ths.setData({
|
||||
province: ths.data.provArray[ths.data.value[0]].areaName,
|
||||
city: ths.data.cityArray[ths.data.value[1]].areaName,
|
||||
area: ths.data.areaArray[ths.data.value[2]].areaName,
|
||||
provinceId: ths.data.provArray[ths.data.value[0]].areaId,
|
||||
cityId: ths.data.cityArray[ths.data.value[1]].areaId,
|
||||
areaId: ths.data.areaArray[ths.data.value[2]].areaId
|
||||
})
|
||||
}
|
||||
|
||||
wx.hideLoading();
|
||||
}
|
||||
}
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
bindRegionChange: function (e) {
|
||||
//console.log('picker发送选择改变,携带值为', e.detail.value)
|
||||
this.setData({
|
||||
region: e.detail.value
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 保存地址
|
||||
*/
|
||||
onSaveAddr: function () {
|
||||
var ths = this;
|
||||
var receiver = ths.data.receiver;
|
||||
var mobile = ths.data.mobile;
|
||||
var addr = ths.data.addr;
|
||||
|
||||
if (!receiver) {
|
||||
wx.showToast({
|
||||
title: '请输入收货人姓名',
|
||||
icon: "none"
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (!mobile) {
|
||||
wx.showToast({
|
||||
title: '请输入手机号码',
|
||||
icon: "none"
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (mobile.length != 11) {
|
||||
wx.showToast({
|
||||
title: '请输入正确的手机号码',
|
||||
icon: "none"
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (!addr) {
|
||||
wx.showToast({
|
||||
title: '请输入详细地址',
|
||||
icon: "none"
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
wx.showLoading();
|
||||
var url = "/p/address/addAddr";
|
||||
var method = "POST";
|
||||
if (ths.data.addrId != 0) {
|
||||
url = "/p/address/updateAddr";
|
||||
method = "PUT";
|
||||
}
|
||||
//添加或修改地址
|
||||
var params = {
|
||||
url: url,
|
||||
method: method,
|
||||
data: {
|
||||
receiver: ths.data.receiver,
|
||||
mobile: ths.data.mobile,
|
||||
addr: ths.data.addr,
|
||||
province: ths.data.province,
|
||||
provinceId: ths.data.provinceId,
|
||||
city: ths.data.city,
|
||||
cityId: ths.data.cityId,
|
||||
areaId: ths.data.areaId,
|
||||
area: ths.data.area,
|
||||
userType: 0,
|
||||
addrId: ths.data.addrId
|
||||
},
|
||||
callBack: function (res) {
|
||||
wx.hideLoading();
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}
|
||||
}
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
onReceiverInput: function (e) {
|
||||
this.setData({
|
||||
receiver: e.detail.value
|
||||
});
|
||||
},
|
||||
|
||||
onMobileInput: function (e) {
|
||||
this.setData({
|
||||
mobile: e.detail.value
|
||||
});
|
||||
},
|
||||
|
||||
onAddrInput: function (e) {
|
||||
this.setData({
|
||||
addr: e.detail.value
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
//删除配送地址
|
||||
onDeleteAddr: function (e) {
|
||||
var ths = this;
|
||||
wx.showModal({
|
||||
title: '',
|
||||
content: '确定要删除此收货地址吗?',
|
||||
confirmColor: "#eb2444",
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
var addrId = ths.data.addrId;
|
||||
|
||||
wx.showLoading();
|
||||
var params = {
|
||||
url: "/p/address/deleteAddr/" + addrId,
|
||||
method: "DELETE",
|
||||
data: {},
|
||||
callBack: function (res) {
|
||||
wx.hideLoading();
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}
|
||||
}
|
||||
http.request(params);
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
})
|
||||
6
pages/editAddress/editAddress.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "编辑收货地址",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
66
pages/editAddress/editAddress.wxml
Normal file
@ -0,0 +1,66 @@
|
||||
<!--pages/editAddress/editAddress.wxml-->
|
||||
|
||||
<view class='container'>
|
||||
<!--input列表 -->
|
||||
<view class='input-box'>
|
||||
<view class="section">
|
||||
<text>收 货 人</text>
|
||||
<input placeholder='姓名' type='text' maxlength='15' value="{{receiver}}" bindinput="onReceiverInput" ></input>
|
||||
</view>
|
||||
<view class="section">
|
||||
<text>手机号码</text>
|
||||
<input placeholder='11位手机号码' type='number' maxlength='11' value="{{mobile}}" bindinput="onMobileInput"></input>
|
||||
</view>
|
||||
<view class="section" bindtap="translate">
|
||||
<text>所在地区</text>
|
||||
<view class="pca">{{province}} {{city}} {{area}}</view>
|
||||
<view class="animation-element-wrapper" animation="{{animation}}" style="visibility:{{show ? 'visible':'hidden'}}" bindtap="hiddenFloatView">
|
||||
<view class="animation-element" catchtap="nono">
|
||||
<text class="right-bt" catchtap="hiddenFloatView">确定</text>
|
||||
<view class="line"></view>
|
||||
<picker-view indicator-style="height: 50rpx;" value="{{value}}" bindchange="bindChange" catchtap="nono">
|
||||
<!--省-->
|
||||
<picker-view-column>
|
||||
<view wx:for="{{provArray}}" wx:key="">
|
||||
{{item.areaName}}
|
||||
</view>
|
||||
</picker-view-column>
|
||||
<!--地级市-->
|
||||
<picker-view-column>
|
||||
<view wx:for="{{cityArray}}" wx:key="">
|
||||
{{item.areaName}}
|
||||
</view>
|
||||
</picker-view-column>
|
||||
<!--区县-->
|
||||
<picker-view-column>
|
||||
<view wx:for="{{areaArray}}" wx:key="">
|
||||
{{item.areaName}}
|
||||
</view>
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='arrow'>
|
||||
<image src='../../images/icon/more.png'></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="section">
|
||||
<text>详细地址</text>
|
||||
<input placeholder='如楼号/单元/门牌号' type='text' value="{{addr}}" bindinput="onAddrInput"></input>
|
||||
</view>
|
||||
</view>
|
||||
<!-- end input列表 -->
|
||||
<!-- 功能按钮 -->
|
||||
<view class='btn-box'>
|
||||
<view class='keep btn' bindtap='onSaveAddr'>
|
||||
<text>保存收货地址</text>
|
||||
</view>
|
||||
|
||||
<view class='clear btn' bindtap="onDeleteAddr" wx:if="{{addrId!=0}}">
|
||||
<text>删除收货地址</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- end 功能按钮 -->
|
||||
</view>
|
||||
|
||||
181
pages/editAddress/editAddress.wxss
Normal file
@ -0,0 +1,181 @@
|
||||
/* pages/editAddress/editAddress.wxss */
|
||||
|
||||
page {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* input列表 */
|
||||
|
||||
.input-box {
|
||||
margin-bottom: 50rpx;
|
||||
background: #fff;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.input-box .section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
font-size: 28rpx;
|
||||
padding: 30rpx 0;
|
||||
line-height: 48rpx;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
border-bottom: 2rpx solid #e5e5e5;
|
||||
}
|
||||
|
||||
.input-box .section text {
|
||||
width: 20%;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.input-box .section input {
|
||||
width: 70%;
|
||||
padding: 0 20rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.input-box .section picker {
|
||||
width: 70%;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.input-box .section .pca {
|
||||
width: 70%;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.input-box .section .arrow {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
}
|
||||
|
||||
.input-box .section .arrow image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* end input列表 */
|
||||
|
||||
/* 功能按钮 */
|
||||
|
||||
.btn-box {
|
||||
padding: 5px 10px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.btn-box text {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.btn-box .clear.btn, .keep.btn {
|
||||
width: 60%;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
border: 1rpx solid #eb2444;
|
||||
border-radius: 50rpx;
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 0 rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.btn-box .keep {
|
||||
color: #fff;
|
||||
background-color: #eb2444;
|
||||
}
|
||||
|
||||
.btn-box .clear.btn {
|
||||
margin-top: 40rpx;
|
||||
color: #eb2444;
|
||||
background-color: #f8f0f1b6;
|
||||
}
|
||||
|
||||
/* end 功能按钮 */
|
||||
|
||||
.infoText {
|
||||
margin-top: 20rpx;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
picker-view {
|
||||
background-color: white;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 380rpx;
|
||||
bottom: 0;
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
picker-view-column view {
|
||||
vertical-align: middle;
|
||||
font-size: 28rpx;
|
||||
line-height: 28rpx;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.animation-element-wrapper {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.animation-element {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 470rpx;
|
||||
bottom: 0;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
.animation-button {
|
||||
top: 20rpx;
|
||||
width: 290rpx;
|
||||
height: 100rpx;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
picker-view text {
|
||||
color: #999;
|
||||
display: inline-flex;
|
||||
position: fixed;
|
||||
margin-top: 20rpx;
|
||||
height: 50rpx;
|
||||
text-align: center;
|
||||
line-height: 50rpx;
|
||||
font-size: 34rpx;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
.left-bt {
|
||||
left: 30rpx;
|
||||
}
|
||||
|
||||
.right-bt {
|
||||
right: 20rpx;
|
||||
top: 20rpx;
|
||||
position: absolute;
|
||||
width: 80rpx !important;
|
||||
}
|
||||
|
||||
.line {
|
||||
display: block;
|
||||
position: fixed;
|
||||
height: 2rpx;
|
||||
width: 100%;
|
||||
margin-top: 89rpx;
|
||||
background-color: #eee;
|
||||
}
|
||||
88
pages/express-delivery/express-delivery.js
Normal file
@ -0,0 +1,88 @@
|
||||
// pages/express-delivery/express-delivery.js
|
||||
|
||||
var http = require('../../utils/http.js');
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
companyName: "",
|
||||
dvyFlowId: "",
|
||||
dvyData: []
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
var ths = this;
|
||||
wx.showLoading();
|
||||
var params = {
|
||||
url: "/delivery/check",
|
||||
method: "GET",
|
||||
data: {
|
||||
orderNumber: options.orderNum
|
||||
},
|
||||
callBack: function (res) {
|
||||
//console.log(res);
|
||||
ths.setData({
|
||||
companyName: res.companyName,
|
||||
dvyFlowId: res.dvyFlowId,
|
||||
dvyData: res.data
|
||||
});
|
||||
wx.hideLoading();
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
6
pages/express-delivery/express-delivery.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "物流查询",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
35
pages/express-delivery/express-delivery.wxml
Normal file
@ -0,0 +1,35 @@
|
||||
<!--pages/express-delivery/express-delivery.wxml-->
|
||||
<!-- 物流信息 -->
|
||||
<view class='container'>
|
||||
<view class="wrapper">
|
||||
<view class="deliveryInfo" style="background:url(http://jiales.gz-yami.com/delivery-bg.png) center center no-repeat #fff;">
|
||||
<view class="icon-express" style="background:url(http://jiales.gz-yami.com/delivery-car.png) no-repeat;background-size:100% 100%;">
|
||||
</view>
|
||||
<view class="infoWarp">
|
||||
<view class="companyname">
|
||||
<text class="key">物流公司:</text>
|
||||
<text class="value">{{companyName}}</text>
|
||||
</view>
|
||||
<view class="expno">
|
||||
<text class="key">运单编号:</text>
|
||||
<text class="value">{{dvyFlowId}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="deliveryDetail">
|
||||
<block wx:for="{{dvyData}}" wx:key=''>
|
||||
|
||||
<view class="detailItem {{index==0?'lastest':''}}" >
|
||||
<view class="dot">
|
||||
<image src='../../images/icon/delive-dot.png' ></image>
|
||||
<image src='../../images/icon/dot.png' ></image>
|
||||
</view>
|
||||
<view class="detail">
|
||||
<view class="desc">{{item.context}}</view>
|
||||
<view class="time">{{item.time}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
184
pages/express-delivery/express-delivery.wxss
Normal file
@ -0,0 +1,184 @@
|
||||
/* pages/express-delivery/express-delivery.wxss */
|
||||
|
||||
.container {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.padding20 {
|
||||
padding-top: 88rpx;
|
||||
}
|
||||
|
||||
.f-fl {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.f-fr {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.navWrap {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
overflow: hidden;
|
||||
background-color: #fafafa;
|
||||
border-bottom: 2rpx solid #f4f4f4;
|
||||
height: 92rpx;
|
||||
}
|
||||
|
||||
.nav {
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
}
|
||||
|
||||
.nav-slider {
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
height: 4rpx;
|
||||
background-color: #b4282d;
|
||||
transition: transform 0.3s;
|
||||
transition: transform 0.3s, -webkit-transform 0.3s;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
float: left;
|
||||
height: 88rpx;
|
||||
padding: 0 16rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.nav-item text {
|
||||
box-sizing: border-box;
|
||||
color: #333;
|
||||
padding: 27rpx 16rpx 23rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
||||
.nav-item.active text {
|
||||
color: #b4282d;
|
||||
}
|
||||
|
||||
.u-icon {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.deliveryInfo {
|
||||
height: 198rpx;
|
||||
width: 100%;
|
||||
vertical-align: middle;
|
||||
padding-left: 30rpx;
|
||||
background-size: cover;
|
||||
display: table;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.icon-express {
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
background-size: 100% 100%;
|
||||
position: absolute;
|
||||
top: 48rpx;
|
||||
left: 30rpx;
|
||||
}
|
||||
|
||||
.infoWarp {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.deliveryInfo .companyname, .deliveryInfo .expno {
|
||||
line-height: 1;
|
||||
margin-left: 136rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.deliveryInfo .companyname .key, .deliveryInfo .expno .key {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.deliveryInfo .expno {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.deliveryDetail {
|
||||
margin-top: 20rpx;
|
||||
padding-top: 40rpx;
|
||||
background-color: #fff;
|
||||
min-height: 670rpx;
|
||||
}
|
||||
|
||||
.detailItem {
|
||||
border-left: 1px dashed #f4f4f4;
|
||||
margin-left: 42rpx;
|
||||
position: relative;
|
||||
margin-bottom: 2rpx;
|
||||
}
|
||||
|
||||
.dot image {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
background-size: 100%;
|
||||
position: absolute;
|
||||
top: 40rpx;
|
||||
left: -18rpx;
|
||||
}
|
||||
|
||||
.lastest .dot image {
|
||||
top: -2rpx;
|
||||
}
|
||||
|
||||
.detail .desc {
|
||||
font-size: 24rpx;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
.detail .time {
|
||||
font-size: 24rpx;
|
||||
line-height: 30rpx;
|
||||
color: #999;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.detail {
|
||||
border-top: 1px solid #f4f4f4;
|
||||
margin-left: 28rpx;
|
||||
overflow: hidden;
|
||||
padding-right: 30rpx;
|
||||
}
|
||||
|
||||
.detail .desc {
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.detail .time {
|
||||
margin-bottom: 39rpx;
|
||||
}
|
||||
|
||||
.lastest .detail .desc, .lastest .detail .time {
|
||||
color: #105c3e;
|
||||
}
|
||||
|
||||
.lastest .detail {
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.lastest .detail .desc {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.deliveryTip {
|
||||
height: 80rpx;
|
||||
background-color: #fff8d8;
|
||||
padding-left: 30rpx;
|
||||
color: #f48f18;
|
||||
font-size: 28rpx;
|
||||
line-height: 80rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
216
pages/index/index.js
Normal file
@ -0,0 +1,216 @@
|
||||
//index.js
|
||||
//获取应用实例
|
||||
var http = require("../../utils/http.js");
|
||||
var config = require("../../utils/config.js");
|
||||
const app = getApp()
|
||||
|
||||
Page({
|
||||
data: {
|
||||
indicatorDots: true,
|
||||
indicatorColor: '#d1e5fb',
|
||||
indicatorActiveColor: '#1b7dec',
|
||||
autoplay: true,
|
||||
interval: 2000,
|
||||
duration: 1000,
|
||||
indexImgs: [],
|
||||
seq: 0,
|
||||
news: [],
|
||||
taglist: [],
|
||||
sts: 0,
|
||||
},
|
||||
//事件处理函数
|
||||
bindViewTap: function() {
|
||||
wx.navigateTo({
|
||||
url: '../logs/logs'
|
||||
})
|
||||
},
|
||||
onLoad: function() {
|
||||
this.getAllData();
|
||||
|
||||
},
|
||||
|
||||
// 页面滚动到指定位置指定元素固定在顶部
|
||||
onPageScroll: function(e) { //监听页面滚动
|
||||
this.setData({
|
||||
scrollTop: e.scrollTop
|
||||
})
|
||||
},
|
||||
|
||||
toProdPage: function(e) {
|
||||
var prodid = e.currentTarget.dataset.prodid;
|
||||
if (prodid) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/prod/prod?prodid=' + prodid,
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
toCouponCenter: function() {
|
||||
wx.showToast({
|
||||
icon:"none",
|
||||
title: '该功能未开源'
|
||||
})
|
||||
},
|
||||
|
||||
// 跳转搜索页
|
||||
toSearchPage: function() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/search-page/search-page',
|
||||
})
|
||||
},
|
||||
|
||||
//跳转商品活动页面
|
||||
toClassifyPage: function(e) {
|
||||
var url = '/pages/prod-classify/prod-classify?sts=' + e.currentTarget.dataset.sts;
|
||||
var id = e.currentTarget.dataset.id;
|
||||
var title = e.currentTarget.dataset.title;
|
||||
if (id) {
|
||||
url += "&tagid=" + id + "&title=" + title;
|
||||
}
|
||||
wx.navigateTo({
|
||||
url: url
|
||||
})
|
||||
},
|
||||
|
||||
//跳转公告列表页面
|
||||
onNewsPage: function() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/recent-news/recent-news',
|
||||
})
|
||||
},
|
||||
|
||||
onShow: function() {
|
||||
wx.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting['scope.userInfo']) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/login/login',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
getAllData() {
|
||||
http.getCartCount(); //重新计算购物车总数量
|
||||
this.getIndexImgs();
|
||||
this.getNoticeList();
|
||||
this.getTag();
|
||||
},
|
||||
//加载轮播图
|
||||
getIndexImgs() {
|
||||
//加载轮播图
|
||||
var params = {
|
||||
url: "/indexImgs",
|
||||
method: "GET",
|
||||
data: {},
|
||||
callBack: (res) => {
|
||||
this.setData({
|
||||
indexImgs: res,
|
||||
seq: res
|
||||
});
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
},
|
||||
getNoticeList() {
|
||||
// 加载公告
|
||||
var params = {
|
||||
url: "/shop/notice/topNoticeList",
|
||||
method: "GET",
|
||||
data: {},
|
||||
callBack: (res) => {
|
||||
this.setData({
|
||||
news: res,
|
||||
});
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
|
||||
// 加载商品标题分组列表
|
||||
getTag() {
|
||||
var params = {
|
||||
url: "/prod/tag/prodTagList",
|
||||
method: "GET",
|
||||
data: {},
|
||||
callBack: (res) => {
|
||||
this.setData({
|
||||
taglist: res,
|
||||
});
|
||||
for (var i = 0; i < res.length; i++) {
|
||||
this.getTagProd(res[i].id, i);
|
||||
}
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
getTagProd(id, index) {
|
||||
var param = {
|
||||
url: "/prod/prodListByTagId",
|
||||
method: "GET",
|
||||
data: {
|
||||
tagId: id,
|
||||
size: 6
|
||||
},
|
||||
callBack: (res) => {
|
||||
var taglist = this.data.taglist;
|
||||
taglist[index].prods = res.records
|
||||
|
||||
this.setData({
|
||||
taglist: taglist,
|
||||
});
|
||||
}
|
||||
};
|
||||
http.request(param);
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
// onPullDownRefresh: function () {
|
||||
// wx.request({
|
||||
// url: '',
|
||||
// data: {},
|
||||
// method: 'GET',
|
||||
// success: function (res) { },
|
||||
// fail: function (res) { },
|
||||
// complete: function (res) {
|
||||
// wx.stopPullDownRefresh();
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
|
||||
onPullDownRefresh: function() {
|
||||
|
||||
// wx.showNavigationBarLoading() //在标题栏中显示加载
|
||||
|
||||
//模拟加载
|
||||
var ths = this;
|
||||
setTimeout(function() {
|
||||
|
||||
ths.getAllData();
|
||||
|
||||
// wx.hideNavigationBarLoading() //完成停止加载
|
||||
|
||||
wx.stopPullDownRefresh() //停止下拉刷新
|
||||
|
||||
}, 100);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 跳转至商品详情
|
||||
*/
|
||||
showProdInfo: function(e) {
|
||||
let relation = e.currentTarget.dataset.relation;
|
||||
if (relation) {
|
||||
wx.navigateTo({
|
||||
url: 'pages/prod/prod',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
7
pages/index/index.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"backgroundTextStyle": "dark",
|
||||
"navigationBarBackgroundColor": "white",
|
||||
"navigationBarTextStyle": "black",
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "亚米科技mall4j"
|
||||
}
|
||||
151
pages/index/index.wxml
Normal file
@ -0,0 +1,151 @@
|
||||
<!--index.wxml-->
|
||||
<view class="container">
|
||||
<view class='bg-sear'>
|
||||
<view class="scrolltop">
|
||||
<view class='section' bindtap='toSearchPage'>
|
||||
<image src='../../images/icon/search.png' class='search-img'></image>
|
||||
<text class='placeholder'>搜索</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='content'>
|
||||
<!-- swiper -->
|
||||
<swiper autoplay="{{autoplay}}" indicator-color="{{indicatorColor}}" interval="{{interval}}" duration="{{duration}}" indicator-active-color="{{indicatorActiveColor}} " circular='true' class='pic-swiper' indicator-dots previous-margin='20rpx' next-margin='20rpx'>
|
||||
<block wx:for='{{indexImgs}}' wx:key=''>
|
||||
<swiper-item class="banner-item">
|
||||
<view class='img-box'>
|
||||
<image src='{{item.imgUrl}}' data-prodid='{{item.relation}}' bindtap='toProdPage' class='banner'></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<!-- end swiper -->
|
||||
|
||||
<view class='cat-item'>
|
||||
<view class='item' bindtap='toClassifyPage' data-sts="1">
|
||||
<image src='../../images/icon/newProd.png'></image>
|
||||
<text>新品推荐</text>
|
||||
</view>
|
||||
<view class='item' bindtap='toClassifyPage' data-sts="2">
|
||||
<image src='../../images/icon/timePrice.png'></image>
|
||||
<text>限时特惠</text>
|
||||
</view>
|
||||
<view class='item' bindtap='toClassifyPage' data-sts="3">
|
||||
<image src='../../images/icon/neweveryday.png'></image>
|
||||
<text>每日疯抢</text>
|
||||
</view>
|
||||
<view class='item' bindtap='toCouponCenter'>
|
||||
<image src='../../images/icon/newprods.png'></image>
|
||||
<text>领优惠券</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 消息播放 -->
|
||||
<view class='message-play' bindtap='onNewsPage'>
|
||||
<image src='../../images/icon/horn.png' class='hornpng'></image>
|
||||
<swiper vertical='true' autoplay='true' duration='1000' class='swiper-cont'>
|
||||
<block wx:for='{{news}}' wx:key=''>
|
||||
<swiper-item class="items">{{item.title}}</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<text class='arrow'></text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<block wx:for="{{taglist}}" wx:key="id">
|
||||
<!-- 每日上新 -->
|
||||
<view class='up-to-date' wx:if="{{item.style==2}}">
|
||||
<view class='title'>
|
||||
<text>{{item.title}}</text>
|
||||
<view class='more-prod-cont' bindtap='toClassifyPage' data-sts="0" data-id="{{item.id}}" data-title="{{item.title}}">
|
||||
<text class='more'>查看更多</text>
|
||||
<!-- <text class='arrow'></text> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class='item-cont'>
|
||||
<block wx:for="{{item.prods}}" wx:for-item="prod" wx:key="prodId">
|
||||
<view class='prod-item' bindtap='toProdPage' data-prodid="{{prod.prodId}}">
|
||||
<view>
|
||||
<view class='imagecont'>
|
||||
<image src='{{prod.pic}}' class='prodimg'></image>
|
||||
</view>
|
||||
<view class='prod-text'>{{prod.prodName}}</view>
|
||||
<view class='price'>
|
||||
<text class='symbol'>¥</text>
|
||||
<text class='big-num'>{{wxs.parsePrice(prod.price)[0]}}</text>
|
||||
<text class='small-num'>.{{wxs.parsePrice(prod.price)[1]}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商城热卖 -->
|
||||
<view class='hot-sale' wx:if="{{item.style==1}}">
|
||||
<view class='title'>
|
||||
<text>{{item.title}}</text>
|
||||
<view class='more-prod-cont' bindtap='toClassifyPage' data-sts="0" data-id="{{item.id}}" data-title="{{item.title}}">
|
||||
<text class='more'>更多</text>
|
||||
<text class='arrow'></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class='hotsale-item-cont'>
|
||||
<block wx:for="{{item.prods}}" wx:for-item="prod" wx:key="prodId">
|
||||
<view class='prod-items' bindtap='toProdPage' data-prodid="{{prod.prodId}}">
|
||||
<view class='hot-imagecont'>
|
||||
<image src='{{prod.pic}}' class='hotsaleimg'></image>
|
||||
</view>
|
||||
<view class='hot-text'>
|
||||
<view class='hotprod-text'>{{prod.prodName}}</view>
|
||||
<view class='prod-info'>{{prod.brief}}</view>
|
||||
<view class='prod-text-info'>
|
||||
<view class='price'>
|
||||
<text class='symbol'>¥</text>
|
||||
<text class='big-num'>{{wxs.parsePrice(prod.price)[0]}}</text>
|
||||
<text class='small-num'>.{{wxs.parsePrice(prod.price)[1]}}</text>
|
||||
</view>
|
||||
<!-- <view class='singal-price'>
|
||||
<text>¥</text>
|
||||
<text>{{prod.oriPrice}}</text>
|
||||
</view> -->
|
||||
<image src='../../images/tabbar/basket-sel.png' class='basket-img'></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 更多宝贝 -->
|
||||
<view class='more-prod' wx:if="{{item.style==0}}">
|
||||
<view class='title'>{{item.title}}</view>
|
||||
<view class='prod-show'>
|
||||
<block wx:for="{{item.prods}}" wx:for-item="prod" wx:key="prodId">
|
||||
<view class='show-item' bindtap='toProdPage' data-prodid="{{prod.prodId}}">
|
||||
<view class='more-prod-pic'>
|
||||
<image src='{{prod.pic}}' class='more-pic'></image>
|
||||
</view>
|
||||
<view class='prod-text-right'>
|
||||
<view class='prod-text more'>{{prod.prodName}}</view>
|
||||
<view class='prod-info'>{{prod.brief}}</view>
|
||||
<view class='b-cart'>
|
||||
<view class='price'>
|
||||
<text class='symbol'>¥</text>
|
||||
<text class='big-num'>{{wxs.parsePrice(prod.price)[0]}}</text>
|
||||
<text class='small-num'>.{{wxs.parsePrice(prod.price)[1]}}</text>
|
||||
</view>
|
||||
<!-- <view class='go-to-buy'>立即购买</view> -->
|
||||
<image src='../../images/tabbar/basket-sel.png' class='basket-img'></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<wxs module="wxs" src="../../wxs/number.wxs" />
|
||||
462
pages/index/index.wxss
Normal file
@ -0,0 +1,462 @@
|
||||
/**index.wxss**/
|
||||
|
||||
page {
|
||||
background: #f7f7f7;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* 轮播图及搜索框 */
|
||||
|
||||
swiper {
|
||||
width: 100%;
|
||||
height: 350rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
swiper.pic-swiper {
|
||||
margin-top: 75rpx;
|
||||
padding: 10rpx 0;
|
||||
background: #fff;
|
||||
height: 422rpx;
|
||||
}
|
||||
|
||||
swiper-item {
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
swiper.pic-swiper .img-box {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.wx-swiper-dots {
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.banner-item {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
swiper.pic-swiper .banner {
|
||||
position: absolute;
|
||||
width: 690rpx;
|
||||
margin: 0 10rpx;
|
||||
height: 402rpx;
|
||||
border-radius: 8rpx;
|
||||
display: inline-block;
|
||||
box-shadow: 0 4px 10px 0 rgba(83, 83, 83, 0.288);
|
||||
}
|
||||
|
||||
.container .bg-sear {
|
||||
position: fixed;
|
||||
z-index: 999;
|
||||
width: 100%;
|
||||
line-height: 56rpx;
|
||||
background: #fff;
|
||||
padding-bottom: 20rpx;
|
||||
text-align: center;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.bg-sear .section {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 60rpx;
|
||||
background: #fff;
|
||||
z-index: 1;
|
||||
border-radius: 50rpx;
|
||||
width: 92%;
|
||||
margin: auto;
|
||||
left: 4%;
|
||||
background: #f7f7f7;
|
||||
}
|
||||
|
||||
.bg-sear .section .placeholder {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.bg-sear .section .search-img {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
/* 分类栏目 */
|
||||
|
||||
.content {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.cat-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
background: #fff;
|
||||
padding-top: 20rpx;
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.cat-item .item {
|
||||
text-align: center;
|
||||
width: 25%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: auto;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.cat-item .item image {
|
||||
width: 75rpx;
|
||||
height: 75rpx;
|
||||
}
|
||||
|
||||
.cat-item .item text {
|
||||
font-size: 26rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
/* 消息播放 */
|
||||
|
||||
.message-play {
|
||||
position: relative;
|
||||
height: 90rpx;
|
||||
background: #fff;
|
||||
margin: auto;
|
||||
padding: 0 60rpx 0 100rpx;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 16rpx 32rpx 0 rgba(7, 17, 27, 0.05);
|
||||
border: 2rpx solid #fafafa;
|
||||
}
|
||||
|
||||
.message-play .hornpng {
|
||||
width: 77rpx;
|
||||
height: 36rpx;
|
||||
position: absolute;
|
||||
left: 20rpx;
|
||||
top: 27rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.message-play .swiper-cont {
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
}
|
||||
|
||||
.message-play .swiper-cont .items {
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
width: 15rpx;
|
||||
height: 15rpx;
|
||||
border-top: 3rpx solid #686868;
|
||||
border-right: 3rpx solid #686868;
|
||||
transform: rotate(45deg);
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 34rpx;
|
||||
}
|
||||
|
||||
/* 每日上新 */
|
||||
|
||||
.title {
|
||||
position: relative;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
font-size: 32rpx;
|
||||
padding:40rpx 0 10rpx 30rpx;
|
||||
color:#333;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.up-to-date .title{
|
||||
color: #fff;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.title .more-prod-cont {
|
||||
color: #999;
|
||||
display: inline-block;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.up-to-date .title .more-prod-cont .more {
|
||||
position:absolute;
|
||||
right:30rpx;
|
||||
top:48rpx;
|
||||
color:#fff;
|
||||
font-size:24rpx;
|
||||
background:#65addf;
|
||||
border-radius:30rpx;
|
||||
padding:0 30rpx;
|
||||
height:44rpx;
|
||||
line-height:44rpx;
|
||||
|
||||
}
|
||||
|
||||
.title .more-prod-cont .more{
|
||||
position:absolute;
|
||||
right:30rpx;
|
||||
top:48rpx;
|
||||
color:#666;
|
||||
font-size:24rpx;
|
||||
padding:0 20rpx;
|
||||
height:44rpx;
|
||||
line-height:44rpx;
|
||||
}
|
||||
|
||||
.title .more-prod-cont .arrow {
|
||||
top:58rpx;
|
||||
right: 30rpx;
|
||||
border-top: 2rpx solid #666;
|
||||
border-right: 2rpx solid #666;
|
||||
}
|
||||
|
||||
.up-to-date {
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAABxCAYAAACkwXoWAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0LCAyMDE2LzA5LzE0LTAxOjA5OjAxICAgICAgICAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIi8+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo8P3hwYWNrZXQgZW5kPSJyIj8+IEmuOgAAAZBJREFUeJzt1DEBwCAAwLAxYfhEGXJABkcTBb065trnAwj6XwcAvGKAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGRdKykDj9OUNYkAAAAASUVORK5CYII=");
|
||||
background-position: top;
|
||||
background-size: 100% 332rpx;
|
||||
background-repeat: no-repeat;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.up-to-date .item-cont {
|
||||
margin: auto;
|
||||
height: auto;
|
||||
width: calc(100% - 40rpx);
|
||||
padding:0 20rpx;
|
||||
display: flex;
|
||||
flex-wrap:wrap;
|
||||
justify-content: space-around;
|
||||
/* padding: 10rpx 0 0 0; */
|
||||
}
|
||||
|
||||
.hotsale-item-cont {
|
||||
padding-bottom: 20rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.up-to-date .item-cont::before {
|
||||
clear: both;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.up-to-date .item-cont .prod-item {
|
||||
border-radius: 10rpx;
|
||||
width: 220rpx;
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
margin-bottom:20rpx;
|
||||
box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2);
|
||||
}
|
||||
|
||||
.up-to-date .item-cont .prod-item .imagecont {
|
||||
width: 100%;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.up-to-date .item-cont .prod-item .imagecont .prodimg {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
vertical-align: middle;
|
||||
border-top-left-radius: 10rpx;
|
||||
border-top-right-radius: 10rpx;
|
||||
font-size:0;
|
||||
|
||||
}
|
||||
|
||||
.up-to-date .item-cont .prod-item .prod-text {
|
||||
font-size: 28rpx;
|
||||
overflow: hidden;
|
||||
margin: 10rpx 0;
|
||||
height: 75rpx;
|
||||
display: -webkit-box;
|
||||
word-break: break-all;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
color: #000;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.up-to-date .item-cont .prod-item .prod-price {
|
||||
font-size: 25rpx;
|
||||
color: #eb2444;
|
||||
font-family: Arial;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.more.prod-price {
|
||||
position: absolute;
|
||||
bottom: 20rpx;
|
||||
}
|
||||
|
||||
/* 商城热卖 */
|
||||
|
||||
.hot-sale {
|
||||
/* margin: 15rpx 0; */
|
||||
}
|
||||
|
||||
.hot-sale .prod-items {
|
||||
width: 345rpx;
|
||||
display: inline-block;
|
||||
background: #fff;
|
||||
padding-bottom: 20rpx;
|
||||
box-sizing: border-box;
|
||||
/* border: 2rpx solid #e1e1e1; */
|
||||
box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2);
|
||||
}
|
||||
|
||||
.hot-sale .prod-items:nth-child(2n-1) {
|
||||
margin: 20rpx 10rpx 10rpx 20rpx;
|
||||
}
|
||||
|
||||
.hot-sale .prod-items:nth-child(2n) {
|
||||
margin: 20rpx 20rpx 10rpx 10rpx;
|
||||
}
|
||||
|
||||
.prod-items .hot-imagecont .hotsaleimg {
|
||||
width: 341rpx;
|
||||
height: 341rpx;
|
||||
}
|
||||
|
||||
.prod-items .hot-text .hotprod-text {
|
||||
font-size: 28rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.prod-items .hot-imagecont {
|
||||
font-size: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.prod-items .hot-text {
|
||||
margin-top: 20rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.prod-items .hot-text .prod-info, .more-prod .prod-text-right .prod-info {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.prod-items .hot-text .prod-text-info {
|
||||
position: relative;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
font-family: Arial;
|
||||
}
|
||||
|
||||
.prod-items .hot-text .prod-text-info .hotprod-price {
|
||||
display: inline;
|
||||
font-size: 26rpx;
|
||||
color: #eb2444;
|
||||
}
|
||||
|
||||
.prod-items .hot-text .prod-text-info .basket-img {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 7rpx;
|
||||
/* border: 2rpx solid #eb2444;
|
||||
border-radius: 50%; */
|
||||
padding: 8rpx;
|
||||
}
|
||||
|
||||
.singal-price {
|
||||
display: inline;
|
||||
font-size: 20rpx;
|
||||
text-decoration: line-through;
|
||||
color: #777;
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
|
||||
/* 更多宝贝 */
|
||||
|
||||
.more-prod {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
|
||||
.more-prod .prod-show .show-item .more-prod-pic {
|
||||
width: 250rpx;
|
||||
height: 250rpx;
|
||||
}
|
||||
|
||||
.more-prod .prod-show .show-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
justify-content: start;
|
||||
border-top: 2rpx solid #f4f4f4;
|
||||
}
|
||||
|
||||
.more-prod .prod-show .show-item .more-prod-pic .more-pic {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.more-prod .prod-show .show-item .prod-text-right {
|
||||
margin-left: 30rpx;
|
||||
width: 72%;
|
||||
padding-bottom: 10rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.more-prod .prod-show .show-item .prod-text-right .go-to-buy {
|
||||
font-size: 26rpx;
|
||||
background: #fff2f5;
|
||||
color: #eb2444;
|
||||
border-radius: 50rpx;
|
||||
text-align: center;
|
||||
padding: 12rpx 20rpx;
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
bottom: 20rpx;
|
||||
}
|
||||
|
||||
.more-prod .prod-show .show-item .prod-text-right .prod-text.more {
|
||||
margin: 0;
|
||||
font-size: 28rpx;
|
||||
overflow: hidden;
|
||||
margin-bottom: 20rpx;
|
||||
display: -webkit-box;
|
||||
word-break: break-all;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.more-prod .prod-show .show-item .prod-text-right .more.prod-price {
|
||||
font-size: 28rpx;
|
||||
font-family: arial;
|
||||
}
|
||||
|
||||
.b-cart {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.b-cart .basket-img {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
position: absolute;
|
||||
right: 46rpx;
|
||||
/* border: 2rpx solid #eb2444;
|
||||
border-radius: 50%; */
|
||||
padding: 8rpx;
|
||||
}
|
||||
73
pages/login/login.js
Normal file
@ -0,0 +1,73 @@
|
||||
var http = require("../../utils/http.js");
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
onGotUserInfo: function (res) {
|
||||
|
||||
http.updateUserInfo();
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
3
pages/login/login.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
5
pages/login/login.wxml
Normal file
@ -0,0 +1,5 @@
|
||||
<!--pages/login/login.wxml-->
|
||||
<image src='http://img-test.gz-yami.com/mini/logo.jpg' class='c-logo'></image>
|
||||
<view class="title">亚米科技mall4j</view>
|
||||
<view class="msg">申请获得你的公开信息(昵称、头像等)</view>
|
||||
<button color="#eb2444" open-type="getUserInfo" lang = "zh_CN" bindgetuserinfo = "onGotUserInfo" class=''>微信授权</button>
|
||||
44
pages/login/login.wxss
Normal file
@ -0,0 +1,44 @@
|
||||
/* pages/login/login.wxss */
|
||||
|
||||
|
||||
image {
|
||||
display: block;
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
margin: auto;
|
||||
margin-top: 100rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
view.msg {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
view.title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-top: 30rpx;
|
||||
width: 450rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
font-size: 30rpx;
|
||||
color: #fff;
|
||||
background: #eb2444;
|
||||
border: 2rpx solid #eb2444;
|
||||
}
|
||||
|
||||
|
||||
.button-hover{
|
||||
background-color: #fff;
|
||||
color: #eb2444;
|
||||
}
|
||||
15
pages/logs/logs.js
Normal file
@ -0,0 +1,15 @@
|
||||
//logs.js
|
||||
const util = require('../../utils/util.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
logs: []
|
||||
},
|
||||
onLoad: function () {
|
||||
this.setData({
|
||||
logs: (wx.getStorageSync('logs') || []).map(log => {
|
||||
return util.formatTime(new Date(log))
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
4
pages/logs/logs.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "查看启动日志",
|
||||
"usingComponents": {}
|
||||
}
|
||||
6
pages/logs/logs.wxml
Normal file
@ -0,0 +1,6 @@
|
||||
<!--logs.wxml-->
|
||||
<view class="container log-list">
|
||||
<block wx:for="{{logs}}" wx:for-item="log">
|
||||
<text class="log-item">{{index + 1}}. {{log}}</text>
|
||||
</block>
|
||||
</view>
|
||||
9
pages/logs/logs.wxss
Normal file
@ -0,0 +1,9 @@
|
||||
.log-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 40rpx;
|
||||
}
|
||||
|
||||
.log-item {
|
||||
margin: 10rpx;
|
||||
}
|
||||
94
pages/news-detail/news-detail.js
Normal file
@ -0,0 +1,94 @@
|
||||
// pages/news-detail/news-detail.js
|
||||
var http = require("../../utils/http.js");
|
||||
var config = require("../../utils/config.js");
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
news: {
|
||||
title: '',
|
||||
content: '',
|
||||
id: null
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
// var ths = this;
|
||||
//加载公告详情
|
||||
|
||||
var params = {
|
||||
// `/shop/notice/info/${options.id}`
|
||||
url: '/shop/notice/info/' + options.id,
|
||||
method: "GET",
|
||||
// data: {
|
||||
// id: id,
|
||||
// },
|
||||
// callBack: function(news){
|
||||
callBack: res => {
|
||||
res.content = res.content.replace(/width=/gi, 'sss=');
|
||||
res.content = res.content.replace(/height=/gi, 'sss=');
|
||||
res.content = res.content.replace(/ \/\>/gi, ' style="max-width:100% !important;display:block;" \/\>');
|
||||
this.setData({
|
||||
news: res
|
||||
});
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||