作者 lihongjuan

1

正在显示 100 个修改的文件 包含 1747 行增加0 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

Component({
/**
* 组件的属性列表
*/
properties: {
list: Array
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
look_more(e) {
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: '/pages/shop_detail/shop_detail?id=' + id
})
},
},
lifetimes: {
created() {
// 在组件实例刚刚被创建时执行
},
attached() {
// 在组件实例进入页面节点树时执行
},
ready() {
// 在组件在视图层布局完成后执行
this.setData({
list: this.properties.list
})
},
detached() {
// 在组件实例被从页面节点树移除时执行
},
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class='real_goods'>
<view class="real_goods_item" wx:for="{{list}}" wx:key="index" data-id="{{item.id}}" bindtap="{{item.sold==0?'':'look_more'}}">
<view class='real_goods_img'>
<image src='{{item.images[0]}}' mode="aspectFill" />
<image src='/images/mei.png' class="tip" wx:if="{{item.sold == 0}}" />
</view>
<view class='real_goods_bottom'>
<view class='goods_title'>{{item.name}}</view>
<view class='goods_flex'>
<view class='score'>积分</view>
<view class='price'>{{item.price}}</view>
<view class='sell'>已卖出{{item.paynum}}件</view>
</view>
</view>
<view class="pink_cover" wx:if="{{item.sold == 0}}"/>
</view>
</view>
\ No newline at end of file
... ...
.real_goods {
width: 708rpx;
margin: 0 auto;
background: #f9f9f9;
display: flex;
flex-wrap: wrap;
padding: 8rpx 11rpx 20rpx;
box-sizing: border-box;
}
.real_goods_item {
width: 50%;
margin-top: 20rpx;
border-radius: 10rpx;
background: #fff;
overflow: hidden;
position: relative;
}
.real_goods_img {
width: 332rpx;
height: 332rpx;
margin-bottom: 16rpx;
border-top-left-radius: 10rpx;
border-top-right-radius: 10rpx;
overflow: hidden;
position: relative;
}
.real_goods_img image {
width: 100%;
height: 100%;
}
.tip {
width: 87rpx !important;
height: 80rpx !important;
position: absolute;
right: 0;
top: 0;
z-index: 2;
}
.real_goods_bottom {
padding: 16rpx 16rpx 28rpx 16rpx;
box-sizing: border-box;
background: #fff;
}
.goods_title {
height: 72rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 500;
line-height: 36rpx;
color: rgba(5, 9, 26, 1);
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
margin-bottom: 20rpx;
}
.goods_flex {
height: 50rpx;
display: flex;
align-items: center;
}
.score {
width: 64rpx;
height: 32rpx;
background: rgba(242, 0, 0, 1);
border-radius: 2rpx;
text-align: center;
color: #fff;
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 400;
margin-right: 12rpx;
}
.price {
font-size: 36rpx;
font-family: PingFang SC;
font-weight: bold;
color: rgba(242, 0, 0, 1);
margin-right: 20rpx;
}
.sell {
font-size: 20rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(156, 156, 156, 1);
}
.pink_cover{
width: 100%;
height: 100%;
background: #ccc;
opacity: 0.3;
position: absolute;
left: 0;
top: 0;
}
\ No newline at end of file
... ...
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
tel(){
wx.makePhoneCall({
phoneNumber: wx.getStorageSync('tel')
})
}
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class="concat_box">
<button open-type="contact" class="item" plain="true">
<image src="/images/icon_65.png" />
</button>
<view class="item" catchtap="tel">
<image src="/images/bodadianhua_icon.png" />
</view>
</view>
\ No newline at end of file
... ...
.concat_box {
width: 96rpx;
height: 210rpx;
position: fixed;
right: 32rpx;
bottom: 200rpx;
}
.item {
width: 96rpx;
height: 96rpx;
padding: 0;
border: none !important;
margin: 0 !important;
}
.item:first-child {
margin-bottom: 16rpx !important;
}
.item image {
width: 100%;
height: 100%;
}
... ...
Component({
/**
* 组件的属性列表
*/
properties: {
check_num: Number, //已选择商品数量
list: Array,
type: Number,
checkAll: Boolean
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
//查看商品详情
look_detail(e) {
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: '/pages/shop_detail/shop_detail?id=' + id
})
},
//加减商品数量
num_change(e) {
let num = Number(e.currentTarget.dataset.num)
let type = e.currentTarget.dataset.type
let index = e.currentTarget.dataset.index
let id = e.currentTarget.dataset.id
let product_id = e.currentTarget.dataset.product_id
if (type == 1) {
num++
} else {
num--
if (num < 1) {
//触发删除商品的接口
this.triggerEvent('delete_shop', {
index: index,
id: id
})
return
}
}
this.triggerEvent('change_num', {
num: num,
index: index,
type: type,
product_id: product_id
})
},
//改变商品选中状态
check_item(e){
let index = e.currentTarget.dataset.index
let check_type = e.currentTarget.dataset.check_type ? e.currentTarget.dataset.check_type:false
let check_num = Number(this.data.check_num)
if (!check_type){
check_num ++
} else {
check_num --
}
this.triggerEvent('check_type', {
index: index,
check_type: !check_type,
check_num: check_num
})
}
},
lifetimes: {
created() {
// 在组件实例刚刚被创建时执行
},
attached() {
// 在组件实例进入页面节点树时执行
},
ready() {
// 在组件在视图层布局完成后执行
this.setData({
list: this.properties.list,
type: this.properties.type,
checkAll: this.properties.checkAll,
check_num: this.properties.check_num ? this.properties.check_num:0
})
},
detached() {
// 在组件实例被从页面节点树移除时执行
},
}
})
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class="item" wx:for="{{list}}" wx:key="index">
<view class="top">
<image class="check_box" src="{{item.check_type?'/images/check@.png':'/images/check.png'}}" wx:if="{{type == 1 || type == 2}}" catchtap="check_item" data-check_type="{{item.check_type}}" data-index="{{index}}" />
<view class="content {{type==3?'active':''}}">
<image class="show_img" src="{{type == 3?item.images[0]:type==4?item.product.images[0]:type==2?item.image:item.product.allimages[0]}}" mode="aspectFill" bindtap="{{type == 1 || type == 2?'look_detail':''}}" data-id="{{item.product_id}}"/>
<view class="right {{type==3?'ractive':''}}">
<view class="word">{{type == 3?item.name:type==2?item.product_name:item.product.name}}</view>
<view class="info">
<view class="jifen">
<view class="name">积分</view>
<text>{{type == 3 || type == 2?item.price:item.product.price}}</text>
<text style="margin-left: 10rpx;color:#ccc;font-size: 28rpx;" wx:if="{{type == 3 || type == 4}}">X{{item.num}}</text>
</view>
<view class="num_box" wx:if="{{type == 1}}">
<image class="num_btn" src="/images/reduce.png" data-index="{{index}}" data-type="0" data-num="{{item.num}}" data-id="{{item.id}}" data-product_id="{{item.product_id}}" catchtap="num_change" />
<text>{{item.num}}</text>
<image class="num_btn" src="/images/add.png" data-index="{{index}}" data-type="1" data-num="{{item.num}}" data-id="{{item.id}}" data-product_id="{{item.product_id}}" catchtap="num_change"/>
</view>
</view>
</view>
</view>
</view>
<view class="info_box" wx:if="{{type == 3}}">
<view class="f_item">
<view class="shop">
商品积分
<text>{{item.price*100*item.num/100}}积分</text>
</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
.item {
width: 100%;
background: #fff;
padding: 0 24rpx;
box-sizing: border-box;
margin-top: 20rpx;
}
.item:first-child {
margin-top: 0;
}
.item .top {
padding: 36rpx 0;
box-sizing: border-box;
display: flex;
align-items: center;
}
.check_box {
width: 36rpx;
height: 36rpx;
padding: 30rpx 30rpx 30rpx 0;
}
.content {
width: 564rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.show_img {
width: 164rpx;
height: 164rpx;
margin-right: 24rpx;
}
.right {
width: 376rpx;
}
.word {
width: 100%;
height: 76rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.info {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 32rpx;
}
.jifen {
display: flex;
align-items: center;
}
.jifen .name {
width: 64rpx;
height: 36rpx;
background: rgba(242, 0, 0, 1);
border-radius: 4rpx;
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 400;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
margin-right: 20rpx;
}
.jifen text {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: bold;
color: rgba(242, 0, 0, 1);
}
.num_box {
display: flex;
align-items: center;
justify-content: space-between;
}
.num_box .num_btn {
width: 36rpx;
height: 36rpx;
}
.num_box text {
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(19, 26, 46, 1);
margin: 0 24rpx;
}
.active {
width: 100%;
}
.ractive {
width: 448rpx;
}
.info_box {
width: 100%;
margin-top: 26rpx;
}
.f_item {
width: 100%;
padding: 28rpx 0;
box-sizing: border-box;
border-bottom: 1px solid #eee;
}
.f_item .shop {
width: 100%;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(19, 26, 46, 1);
display: flex;
justify-content: space-between;
align-items: center;
}
.f_item .shop text:last-child {
color: #8e8e8e;
}
.youfei {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 34rpx;
color: rgba(142, 142, 142, 1);
margin-top: 10rxp;
}
.jifen_num {
width: 100%;
padding: 28rpx 0;
box-sizing: border-box;
display: flex;
flex-direction: row-reverse;
align-items: center;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: Regular;
color: #131a2e;
}
.jifen_num text:last-child {
font-size: 32rpx;
color: rgba(242, 0, 0, 1);
font-family: PingFang SC Bold;
font-weight: Bold;
}
.jifen_num text:first-child {
color: rgba(242, 0, 0, 1);
margin-left: 10rpx;
}
... ...
App({
onLaunch: function () {
//自动更新版本
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
wx.showModal({
title: '更新提示',
content: '新版本下载失败',
showCancel: false
})
})
},
post: function (url, data, showLoad) {
wx.showNavigationBarLoading()
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data
// let baseUrl = 'https://binhai.w.broing.cn/api';
let baseUrl ='http://binhaitest.w.brotop.cn/api'
//网络请求
wx.request({
url: baseUrl + url,
data: postData,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'token': wx.getStorageSync('token') || ''
},
success: function (res) { //返回取得的数据
if (res.data.code == '200') {
resolve(res.data)
} else if (res.data.code == '5000') {
wx.hideLoading();
wx.removeStorageSync('token');
wx.removeStorageSync('login');
wx.navigateTo({
url: '/pages/register/register?type=1',
})
} else {
wx.showModal({
title: '提示',
content: res.data.msg,
showCancel: false
})
reject(res.data)
}
setTimeout(function () {
wx.hideNavigationBarLoading()
}, 600)
},
fail: function (e) {
reject('网络出错');
wx.hideNavigationBarLoading()
}
})
});
return promise;
},
//接口管理
interface: {
openid: '/getopenid/get', // 获取openid
getcode: '/getopenid/getcode', // 获取验证码
readteacher: '/getopenid/readteacher', // 获取个人信息
login: '/getopenid/smslogin', // 登录
jifenlist: '/order/jifenlist', // 积分列表
address: '/address/index', // 地址列表
addaddress: '/address/add', // 添加地址
editaddress: '/address/edit', // 修改地址
deladdress: '/address/delete', // 删除地址
mraddress: '/address/mo', // 修改默认地址
adshow: '/address/editshow', //地址详情(数据回显)
about: '/wb/wb', // 关于我们
order: '/order/orderlist', // 获取订单列表
payorder: '/order/payorder', // 订单页点击支付
disorder: '/order/disorder', // 订单列表取消订单
orderrefund: '/order/orderrefund', // 退换货详情
// upload: 'https://binhai.w.broing.cn/api/common/upload', // 上传图片
upload: 'http://binhaitest.w.brotop.cn/api',
refund: '/order/refund', // 退货提交
delorder: '/order/delorder', // 删除订单
okorder: '/order/okorder', // 确认订单
orderInfo: '/order/orderInfo', // 订单详情
kuaidi: '/kuaidi/kuaidi', //物流信息
collectdel: '/product/collectdel', //收藏删除
collectList: '/getopenid/collectlist', //收藏列表
deleteseach: '/product/deleteseach', //删除搜索历史
order_pay: '/order/pay', //订单支付
now_add: '/order/now_add', //点击结算
hotsreach: '/product/hotsreach', // 热门搜索
searchhis: '/product/searchhis', // 商品搜索历史
search: '/product/search', // 商品搜索结果列表
getPid: '/cap/getpid', // 分类页面
prev_pay: '/shop/prev_pay', // 购物车点击结算
gwcshop: '/shop/gwcshop', //购物车数量修改保存
deletes: '/shop/deletes', //购物车删除
shopcar: '/shop/shopcar', // 购物车页面
now_prev_pay: '/shop/now_prev_pay', // 直接购买
addshop: '/shop/addshop', // 添加购物车
collect: '/product/collect', // 收藏
getInfo: '/product/getInfo', //商品详情
good_list: '/product/get', // 商品
index: '/cap/get', // 首页大小分类
banner: '/banner/index', // 轮播图
notice: '/cap/notice', // 公告
youfei: '/shop/youfei1', // 单算邮费
youfei1: '/shop/youfei', // 購物車邮费
shopcarNum: '/shop/shopcarnum', // 购物车数量
orderlist: '/shop/orderlist', // 订单各状态数量
order_read: '/shop/read', // 订单数
},
globalData: {
}
})
\ No newline at end of file
... ...
{
"pages": [
"pages/register/register",
"pages/messagedetail/messagedetail",
"pages/message/message",
"pages/login/login",
"pages/index/index",
"pages/shop_cart/shop_cart",
"pages/classify/classify",
"pages/my/my",
"pages/shop_detail/shop_detail",
"pages/order/order",
"pages/Collection/collection",
"pages/order/return_goods/return_goods",
"pages/my/about_us/about_us",
"pages/my/my_integral/my_integral",
"pages/address/address",
"pages/address/edit_address/edit_address",
"pages/address/add_address/add_address",
"pages/search/search",
"pages/search/search_result/search_result",
"pages/order/order_list/order_list",
"pages/order/order_detail/order_detail",
"pages/logistics/logistics",
"pages/notice/notice",
"pages/outerChain/outerChain",
"pages/zhuanqu/zhuanqu",
"pages/taocandetail/taocandetail",
"pages/taocanpay/taocanpay",
"pages/orderdetail/orderdetail",
"pages/xianshi/xianshi"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#3D9AF8",
"navigationBarTitleText": "海创诚品",
"navigationBarTextStyle": "white"
},
"tabBar": {
"list": [
{
"pagePath": "pages/index/index",
"text": "商品",
"iconPath": "images/tabbar/icon_75.png",
"selectedIconPath": "images/tabbar/icon_68.png"
},
{
"pagePath": "pages/message/message",
"text": "消息",
"iconPath": "images/tabbar/icon_69.png",
"selectedIconPath": "images/tabbar/icon_74.png"
},
{
"pagePath": "pages/shop_cart/shop_cart",
"text": "购物车",
"iconPath": "images/tabbar/icon_70.png",
"selectedIconPath": "images/tabbar/icon_73.png"
},
{
"pagePath": "pages/my/my",
"text": "我的",
"iconPath": "images/tabbar/icon_71.png",
"selectedIconPath": "images/tabbar/icon_72.png"
}
],
"selectedColor": "#05091A"
},
"sitemapLocation": "sitemap.json"
}
\ No newline at end of file
... ...
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
.flex{
display:flex;
}
.flexone {
display: flex;
align-items: center;
}
.flextwo {
display: flex;
align-items: center;
justify-content: space-between;
}
.flexthree {
display: flex;
align-items: center;
justify-content: center;
}
.flex {
display: flex;
}
.flexone {
display: flex;
align-items: center;
}
.flextwo {
display: flex;
align-items: center;
justify-content: space-between;
}
.flexthree {
display: flex;
align-items: center;
justify-content: center;
}
... ...

595 字节

533 字节

578 字节

976 字节

662 字节

740 字节

1007 字节

688 字节

const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
check_num: 0, //选中数量
checkAll: false, //全选状态
check_str: ''
},
//改变商品状态
check_type(e) {
let index = Number(e.detail.index)
this.setData({
[`list[${index}].check_type`]: e.detail.check_type,
check_num: e.detail.check_num
})
if (e.detail.check_num == this.data.list.length) {
this.setData({
checkAll: true
})
} else if (e.detail.check_num == 0) {
this.setData({
checkAll: false
})
}
this.get_all()
},
//全选|全不选
check_all() {
let list = this.data.list
for (let obj of list) {
obj.check_type = !this.data.checkAll
}
this.setData({
checkAll: !this.data.checkAll,
list: list,
check_num: !this.data.checkAll ? list.length : 0
})
this.get_all()
},
//获取选中商品
get_all() {
let that = this
let list = that.data.list
let check_str = ''
for (let obj of list) {
if (obj.check_type) {
if (check_str == ""){
check_str = obj.id
} else {
check_str = check_str + ',' + obj.id
}
}
}
that.setData({
check_str: check_str
})
},
delete_item(){
if (this.data.check_str == ""){
wx.showToast({
title: '请先选中商品',
icon: 'none',
duration: 1000
})
return
}
let url = app.interface.collectdel
let params = {
ids: this.data.check_str
}
app.post(url,params).then((res)=>{
wx.showToast({
title: '删除成功',
duration: 1000
})
this.get_info()
})
},
//获取页面信息
get_info() {
wx.showLoading({
title: '加载中'
})
let that = this
let url = app.interface.collectList
app.post(url, {}).then((res) => {
wx.hideLoading()
that.setData({
list: res.msg
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.get_info()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "我的收藏",
"usingComponents": {
"shop_item": "/Components/shop_item/shop_item"
}
}
\ No newline at end of file
... ...
<view class="content">
<shop_item list="{{list}}" type="2" bindcheck_type="check_type" check_num="{{check_num}}" />
<view class="empty" wx:if="{{list.length == 0}}">暂无更多数据</view>
</view>
<view class="footer" wx:if="{{list.length>0}}">
<view class="check_box" bindtap="check_all">
<image class="check" src="{{checkAll?'/images/check@.png':'/images/check.png'}}" />
<text>全选</text>
</view>
<view class="del" catchtap="delete_item">删除</view>
</view>
\ No newline at end of file
... ...
page {
background: #f9f9f9;
}
.content {
width: 100%;
padding: 30rpx 32rpx 120rpx;
box-sizing: border-box;
}
.footer {
width: 100%;
height: 100rpx;
padding: 0 32rpx;
box-sizing: border-box;
background: #fff;
position: fixed;
left: 0;
bottom: 0;
display: flex;
justify-content: space-between;
align-items: center;
}
.footer .check_box {
display: flex;
align-items: center;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(19, 26, 46, 1);
}
.footer .check_box .check {
width: 36rpx;
height: 36rpx;
padding: 20rpx 20rpx 20rpx 0;
}
.footer .del {
width: 180rpx;
height: 68rpx;
background: rgba(242, 0, 0, 1);
border-radius: 34rpx;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(255, 255, 255, 1);
display: flex;
justify-content: center;
align-items: center;
}
.empty {
font-size: 36rpx;
font-family: PingFang SC;
font-weight: 400;
color: #ccc;
margin-top: 200rpx;
text-align: center;
}
... ...
const a = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
name: '',
tel: '',
area: '',
address: '',
mr: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
// 获取名字
nameFun(e) {
this.setData({
name: e.detail.value.replace(/\s+/g, '')
})
},
// 获取手机号
telFun(e) {
this.setData({
tel: e.detail.value.replace(/\s+/g, '')
})
},
// 获取详细地址
getAddressFun(e) {
this.setData({
address: e.detail.value
})
},
bindRegionChange(e) {
this.setData({
area: e.detail.value[0] + ' ' + e.detail.value[1] + ' ' + e.detail.value[2]
})
},
// 设置默认地址
switchChange(e) {
if (e.detail.value) {
this.setData({
mr: 1
})
} else {
this.setData({
mr: 0
})
}
},
// 保存地址
addFun() {
let t = this;
let AuglyTest_phone = /^1(3|4|5|6|7|8|9)\d{9}$/;
let u = a.interface.addaddress;
let d = {
tel: t.data.tel,
name: t.data.name,
area: t.data.area,
address: t.data.address,
mo: t.data.mr
}
if (d.name == '') {
wx.showToast({
title: '请输入收货人名称',
icon: 'none',
duration: 1300
})
} else if (d.tel == '') {
wx.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1300
})
} else if (!AuglyTest_phone.test(d.tel)) {
wx.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1300
})
} else if (d.area == '') {
wx.showToast({
title: '请选择省市区',
icon: 'none',
duration: 1300
})
} else if (d.address == '') {
wx.showToast({
title: '请输入详细地址',
icon: 'none',
duration: 1300
})
} else {
a.post(u, d).then((r) => {
if (r.code == 200) {
wx.showToast({
title: '保存成功',
icon: 'none',
duration: 1300
})
setTimeout(() => {
wx.navigateBack()
}, 1300)
}
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "新增地址"
}
\ No newline at end of file
... ...
<view class="box">
<view class="list">
<view class="list_left">收货人</view>
<view class="list_right">
<input placeholder="请输入收货人" bindinput="nameFun" placeholder-class="inut_plclass"></input>
</view>
</view>
<view class="list">
<view class="list_left">手机号码</view>
<view class="list_right">
<input placeholder="请输入手机号" type="number" maxlength="11" bindinput="telFun" placeholder-class="inut_plclass"></input>
</view>
</view>
<picker mode="region" style="width: 100%;" bindchange="bindRegionChange">
<view class="list">
<view class="list_left">所在地区</view>
<view class="list_right">
<view class="area">{{area}}</view>
<view class="list_right_img">
<image src="/images/youjiantou.png"></image>
</view>
</view>
</view>
</picker>
<view class="list_textarea">
<view class="list_left">详细地址</view>
<view class="list_right">
<textarea placeholder="道路、门牌号、小区、楼栋号等" placeholder-class="inut_plclass" bindinput="getAddressFun" style="padding-top:22rpx;"></textarea>
</view>
</view>
<view class="list">
<view class="list_left">设为默认地址</view>
<view class="list_right">
<switch type="switch" color="rgba(242, 0, 0, 1)" bindchange="switchChange" />
</view>
</view>
</view>
<view class="add_btn_box">
<view class="add_btn" bindtap="addFun">保存</view>
</view>
\ No newline at end of file
... ...
page {
width: 100%;
height: 100%;
}
.box {
width: 100%;
height: 200%;
background: rgba(255, 255, 255, 1);
box-sizing: border-box;
padding-left: 32rpx;
}
.list,.list_textarea {
width: 100%;
height: 122rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
padding-right: 32rpx;
border-bottom: 1px solid rgba(238, 238, 238, 1);
}
.list_textarea {
height: 202rpx;
align-items: flex-start;
padding: 40rpx 32rpx 40rpx 0;
}
.list_left {
min-width: 166rpx;
}
.list_right {
flex: 1;
height: 100%;
display: flex;
justify-content: flex-end;
align-items: center;
margin-top: 10ropx;
}
.area {
flex: 1;
font-size: 30rpx;
color: rgba(19, 26, 46, 1);
font-weight: bold;
}
.list_right_img {
width: 48rpx;
height: 48rpx;
}
.list_right_img image {
display: block;
width: 100%;
height: 100%;
}
.list_right input,.list_textarea textarea {
flex: 1;
height: 100%;
color: rgba(19, 26, 46, 1);
font-size: 30rpx;
font-weight: bold;
display: block;
}
.list_textarea textarea {
width: 100%;
}
.inut_plclass {
font-weight: normal;
}
.add_btn_box {
width: 100%;
box-sizing: border-box;
padding: 32rpx;
background: rgba(255, 255, 255, 1);
position: fixed;
bottom: 0;
left: 0;
}
.add_btn {
width: 100%;
height: 80rpx;
background: rgba(242, 0, 0, 1);
border-radius: 40rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 30rpx;
color: rgba(255, 255, 255, 1);
}
... ...
const a = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
list: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
// 获取地址列表
getListFun() {
let t = this;
let u = a.interface.address
a.post(u, {}).then((r) => {
if (r.code == 200) {
t.setData({
list: r.msg,
check: true
})
if (r.msg.length == 0){
wx.setStorageSync('no_address', true)
}
}
}).catch((er) => {
})
},
//选择地址返回确认订单页面
selectAdddressFun(e) {
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2]; //上一个页面
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
prevPage.setData({
name: e.currentTarget.dataset.n,
area: e.currentTarget.dataset.a,
tel: e.currentTarget.dataset.tel,
address: e.currentTarget.dataset.ad,
id: e.currentTarget.dataset.id
})
wx.navigateBack({
delta: 1
})
},
// 设置默认地址
mrAddressFun(e) {
let t = this
let index = e.currentTarget.dataset.index
let u = a.interface.mraddress;
let d = {
id: e.currentTarget.dataset.id,
mo: 1
}
a.post(u, d).then((r) => {
if (r.code == 200) {
t.setData({
[`list[${index}].check`]: true
})
wx.showToast({
title: '设置成功',
icon: 'none',
duration: 1300
})
setTimeout(() => {
t.getListFun()
}, 1300)
}
}).catch((er) => {
})
},
// 修改地址
editAddressFun(e) {
wx.navigateTo({
url: '/pages/address/edit_address/edit_address?id=' + e.currentTarget.dataset.id,
})
},
// 删除地址
delAddressFun(e) {
let t = this;
let u = a.interface.deladdress;
let d = {
id: e.currentTarget.dataset.id
}
a.post(u, d).then((r) => {
if (r.code == 200) {
wx.showToast({
title: '删除成功',
icon: 'none',
duration: 1300
})
setTimeout(() => {
t.getListFun()
}, 1300)
}
}).catch((er) => {
})
},
// 新增地址
addFun() {
wx.navigateTo({
url: '/pages/address/add_address/add_address',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.getListFun()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "我的地址"
}
\ No newline at end of file
... ...
<view class="content">
<view class="item" wx:for="{{list}}" wx:key data-id="{{item.id}}" data-n="{{item.name}}" data-tel="{{item.tel}}" data-a="{{item.area}}" data-ad="{{item.address}}" bindtap="selectAdddressFun">
<view class="user_info">
<view class="name">{{item.name}}</view>
<view class="tel">{{item.tel}}</view>
<view class="type" wx:if="{{item.mo == 1}}">默认</view>
</view>
<view class="address">
{{item.area}} {{item.address}}
</view>
<view class="btn_box">
<view class="check" data-id="{{item.id}}" data-index="{{index}}" wx:if="{{item.mo != 1}}" catchtap="mrAddressFun">
<image wx:if="{{!item.check}}" src="/images/check.png" />
<image wx:else src="/images/check@.png" /> 设为默认地址
</view>
<block>
<view class="btn_item" data-id="{{item.id}}" catchtap="editAddressFun">
<image src="/images/icon_60.png" style="width: 26rpx;height: 26rpx;" />编辑
</view>
<view class="btn_item" data-id="{{item.id}}" catchtap="delAddressFun">
<image src="/images/icon_48.png" />删除
</view>
</block>
</view>
</view>
<view class="empty" wx:if="{{list.length==0}}">暂无地址信息,请去添加</view>
</view>
<view class="add_btn_box">
<view class="add_btn" bindtap="addFun">+ 添加收货地址</view>
</view>
\ No newline at end of file
... ...
page {
background: #f9f9f9;
padding-bottom: 120rpx;
}
.content {
padding: 32rpx;
box-sizing: border-box;
}
.item {
width: 100%;
background: #fff;
border-radius: 10rpx;
margin-bottom: 20rpx;
}
.item .user_info {
width: 100%;
height: 96rpx;
padding: 0 40rpx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.user_info .name {
font-size: 32rpx;
font-family: PingFang SC;
font-weight: bold;
color: rgba(6, 14, 35, 1);
}
.user_info .tel {
font-size: 32rpx;
font-family: PingFang SC;
font-weight: bold;
color: rgba(19, 26, 46, 1);
margin-left: 40rpx;
margin-right: 20rpx;
}
.user_info .type {
width: 56rpx;
height: 28rpx;
background: rgba(242, 0, 0, 1);
border-radius: 4rpx;
font-size: 20rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(255, 255, 255, 1);
display: flex;
justify-content: center;
align-items: center;
}
.address {
padding: 0 40rpx 20rpx 40rpx;
box-sizing: border-box;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(102, 102, 102, 1);
border-bottom: 1rpx solid #eee;
}
.btn_box {
height: 70rpx;
display: flex;
justify-content: flex-end;
}
.btn_item {
width: 100rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(102, 102, 102, 1);
display: flex;
align-items: center;
margin-right: 52rpx;
}
.btn_item:last-child {
margin-right: 38rpx;
}
.btn_item image {
width: 28rpx;
height: 30rpx;
margin-right: 16rpx;
}
.check {
flex: 1;
/* width: 200rpx; */
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 36px;
color: rgba(102, 102, 102, 1);
display: flex;
align-items: center;
margin-left: 48rpx;
}
.check image {
width: 26rpx;
height: 26rpx;
margin-right: 20rpx;
}
/* 添加地址按钮 */
.add_btn_box {
width: 100%;
box-sizing: border-box;
padding: 32rpx;
background: rgba(249, 249, 249, 1);
position: fixed;
bottom: 0;
left: 0;
}
.add_btn {
width: 100%;
height: 80rpx;
background: rgba(242, 0, 0, 1);
border-radius: 40rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 30rpx;
color: rgba(255, 255, 255, 1);
}
.empty{
width: 100%;
text-align: center;
font-size: 36rpx;
color: #ccc;
margin-top: 200rpx;
}
... ...