作者 朱振飞

1

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

要显示太多修改。

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

packageA @ fa07629b
Subproject commit fa07629bea63caece0380a34b13e14ad18f14b80
const app=getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
list: Array
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
look_more(e) {
let login_new=app.globalData.login_new;
if(login_new==0){
wx.showToast({
title: '您还不是会员',
icon:"none"
})
setTimeout(function(){
wx.navigateTo({
url: '/packageA/pages/login/login',
})
},1500)
return false
}
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: '/packageA/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 wx:if="{{item.price2!=null}}">
<view class='goods_flex'>
<view class='price'>¥{{item.price}}</view>
<view class="lineprice" wx:if="{{item.line_price!=null}}">¥{{item.line_price}}</view>
<view class='sell'>已卖出{{item.sales}}件</view>
</view>
<!-- <view class='oldprice'>{{item.price}}</view> -->
</view>
<view class='goods_flex' wx:else>
<!-- <view class='score'>积分</view> -->
<view class='price'>¥{{item.price}}</view>
<view class="lineprice" wx:if="{{item.line_price!=null}}">¥{{item.line_price}}</view>
<view class='sell'>已卖出{{item.sales}}件</view>
</view>
</view>
<view class="pink_cover" wx:if="{{item.sold==0}}" />
</view>
</view>
\ No newline at end of file
... ...
.real_goods {
width: 750rpx;
margin: 0 auto;
background: #f9f9f9;
display: flex;
flex-wrap: wrap;
padding: 8rpx 0 20rpx;
box-sizing: border-box;
margin-bottom:120rpx;
}
.real_goods_item {
width: 367rpx;
margin-top: 20rpx;
border-radius: 10rpx;
background: #fff;
overflow: hidden;
position: relative;
display:flex;
flex-direction: column;
align-items: center;
}
.real_goods_item:nth-child(2n){
border-left:16rpx solid #f5f5f5;
}
.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 32rpx 28rpx 32rpx;
box-sizing: border-box;
background: #fff;
}
.goods_title {
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: 10rpx;
}
.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;
}
.oldprice{
color:#BDC4CE;
font-size: 24rpx;
text-decoration: line-through
}
.lineprice{
color: rgba(156, 156, 156, 1);
text-decoration: line-through;
font-size: 20rpx;
margin-right:5rpx;
}
\ 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: -24rpx;
bottom: 100rpx;
}
.item {
width: 60rpx;
height: 60rpx;
padding: 0;
border: none !important;
margin: 0 !important;
}
.item:first-child {
margin-bottom: 30rpx !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
// })
},
enter(){
console.log(this.data.list)
},
//加减商品数量
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
})
console.log(this.data.list)
},
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 wx:if='{{item.product.price2!=null||item.price2!=null}}'>{{type == 3 || type == 2?item.price2:item.product.price2}}</text>
<text wx:else>{{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 class="oldprice" wx:if="{{item.product.price2!=null||item.price2!=null}}">{{item.product.price||item.price}}</view> -->
</view>
</view>
</view>
<view class="info_box" wx:if="{{type == 3}}">
<view class="f_item">
<view class="shop" bindtap="enter">
商品积分
<text wx:if="{{item.price2!=null}}">{{item.price2*100*item.num/100}}积分</text>
<text wx:else>{{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;
}
.oldprice {
color: #bdc4ce;
font-size: 24rpx;
text-decoration: line-through;
margin-top:10rpx;
}
... ...
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">
<!-- style="padding-top:22rpx;" -->
<textarea placeholder="道路、门牌号、小区、楼栋号等" placeholder-class="inut_plclass" bindinput="getAddressFun" style="padding-top:2rpx;" ></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) {
console.log(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
... ...