first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1 @@
5dce3b9a-5629-4f55-998c-22c88fc76900

View File

@@ -0,0 +1,165 @@
// user/address/address.js
const app = getApp();
const util = app.loadUtils("util")
const regeneratorRuntime = app.loadAsync()
const model = app.loadModel("index")
const http = app.loadHttp()
Page({
/**
* 页面的初始数据
*/
data: {
system: app.globalData.system, //设备相关信息
pageTitle: "选择地址", //头部标题
isBack: true,//显示返回
currentId: null,//当前选中的地址id
addList: [],//收货地址列表
isAdd: false,//是否点击地址返回上一层
right: [
{
text: '删除',
style: 'background-color: #F4333C; color: white',
}],
},
// 修改收货地址信息
updataAdd(e) {
let item = e.currentTarget.dataset.item
model.storage.setStorage("updataAdd", item)
wx.navigateTo({
url: "/user/address/address?modify=" + 0
})
},
// 获取微信收货地址
getWxAdd() {
wx.chooseAddress({
success(res) {
model.storage.setStorage("address", res)
wx.navigateBack({
url: "/user/appointment/appointment"
})
}
})
},
// 选择收货地址方法
selectAdd(e) {
if (this.data.isAdd) {
return
}
let index = e.currentTarget.dataset.index
this.setData({
currentId: index
})
// 获取下表对应的地址
let indexAdd = this.data.addList[index]
let data = {
provinceName: indexAdd.address + indexAdd.detail,
userName: indexAdd.userName,
telNumber: indexAdd.telNumber,
cityName: "",
countyName: "",
detailInfo: "",
type: true,
id: indexAdd.id
}
// 存构造好的地址返回上一页
model.storage.setStorage("address", data)
wx.navigateBack({
url: "/user/appointment/appointment"
})
},
// 获取收货地址列表
async getUserAddress() {
let res = await http.http.request2({ url: `${http.api.getUserAddress}`, method: "POST" })
// 拿出默认地址
let defaultAddress = res.data.data.filter((val)=> val.is_default == 1);
// 本地保存
if(defaultAddress.length !== 0){
let data = {
provinceName: defaultAddress[0].provinceName,
userName: defaultAddress[0].userName,
telNumber: defaultAddress[0].telNumber,
cityName: defaultAddress[0].cityName,
countyName: defaultAddress[0].countryName,
detailInfo: defaultAddress[0].detail,
type: true,
id: defaultAddress[0].id
}
model.storage.setStorage("address", data)
}
this.setData({
addList: res.data.data
})
if(res.data.data.length <= 0){
wx.redirectTo({
url: "/user/address/address?modify=1"
})
}
},
// 侧滑删除
onClick(e) {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let data = {
isAdd: options.isAdd
}
this.setData(data)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getUserAddress()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@@ -0,0 +1,9 @@
{
"navigationBarTextStyle": "black",
"usingComponents": {
"wux-swipe-action": "../../extend/wux/dist/swipe-action/index",
"wux-cell-group": "../../extend/wux/dist/cell-group/index",
"wux-checkbox-group": "../../extend/wux/dist/checkbox-group/index",
"wux-checkbox": "../../extend/wux/dist/checkbox/index"
}
}

View File

@@ -0,0 +1,41 @@
<!-- 头部 -->
<nav-bar isBack="{{isBack}}" pageTitle="{{pageTitle}}" system="{{system}}"></nav-bar>
<!-- user/address/address.wxml -->
<view class="add_List">
<view class="addList">
<view wx:for="{{addList}}" wx:key="{{index}}" data-index="{{index}}" bind:tap="selectAdd">
<view class="add_row pt20">
<!-- <view class="chioose">
<image class="" src="/static/img/icon/wxPay1.png"></image>
</view> -->
<view class="row_l fl">
<view class="row_title">
<view class="name">
<span>{{item.userName}}</span>
<span class="ml20">{{item.telNumber}}</span>
<span wx:if="{{item.is_default == 1}}" class="default ml10">
默认地址
</span>
<span class="row_img ml10" wx:if="{{currentId == index}}">
<image src="/static/img/icon/thyjtyujyukjyui.png" />
</span>
</view>
</view>
<view class="row_p">{{item.address}}{{item.detail}}</view>
</view>
<view class="row_r fr flex-con2" data-item="{{ item }}" catchtap="updataAdd">
<image src="/static/img/icon/efwergtrhtyjytuj.png" />
<!-- <text>编辑</text> -->
</view>
</view>
</view>
</view>
<navigator url="/user/address/address?modify=1" hover-class="none">
<view class="add">添加联系地址</view>
</navigator>
</view>
<!-- toasta提示 -->
<i-toast id="toast" />

View File

@@ -0,0 +1,123 @@
/* user/address/address.wxss */
.wxadd{
height: 88rpx;
width: 100%;
background-color: var(--white);
}
.my_list{
width: 100%;
height: 100%;
display: flex;
}
.my_left{
flex: 1;
}
.my_left image{
width: 39rpx;
height: 32rpx;
}
.my_con{
flex: 8;
font-family: PingFang-SC-Medium;
font-size: 28rpx;
font-weight: normal;
font-stretch: normal;
letter-spacing: 0px;
color: #333333;
}
.my_right{
flex: 1;
text-align: right;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row-reverse;
flex-direction: row-reverse;
}
.my_right image{
width: 15rpx;
height: 33rpx;
}
.chioose{
padding: 0 10rpx 0 10rpx;
}
.chioose image {
width: 14px;
height: 14px;
}
.addList{
padding-bottom: 120rpx;
}
.add_row{
display: flex;
justify-content: space-between;
height: 193rpx;
background-color: var(--white);
align-items: center;
padding-left: 24px;
}
.row_l {
width: 565rpx;
height: 100%;
}
.row_title{
margin-top: 38rpx;
display: flex;
}
.name{
flex: 1;
font-family: PingFang-SC-Medium;
font-size: 30rpx;
font-weight: normal;
font-stretch: normal;
letter-spacing: 0px;
color: #333333;
}
.row_img{
display: inline-block;
}
.row_img image{
width: 26rpx;
height: 26rpx;
}
.row_p{
margin-top: 24rpx;
word-wrap:break-word;
font-family: PingFang-SC-Medium;
font-size: 28rpx;
font-weight: normal;
font-stretch: normal;
line-height: 36rpx;
letter-spacing: 0px;
color: #666666;
}
.row_r{
/* width: 75rpx; */
height: 100%;
text-align: right;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row-reverse;
flex-direction: row-reverse;
position: relative;
padding: 0 40rpx;
}
.row_r::before{
content: "";
position: absolute;
left: 0;
width: 2rpx;
height: 66rpx;
background-color: #ebebeb;
}
.row_r image{
width: 36rpx;
height: 36rpx;
}
.default{
color: red;
}