更新小程序仓库

This commit is contained in:
zoujiandong
2023-11-17 09:51:35 +08:00
parent 13f54a26df
commit 4506940c2d
936 changed files with 60022 additions and 0 deletions
+161
View File
@@ -0,0 +1,161 @@
// pages/address/address.js
const app = getApp();
import {getAddress,delAddress} from "../../api/address"
import {throttle} from "../../utils/util"
Page({
/**
* 页面的初始数据
*/
data: {
addressList:[],
address_id:'',
isTriggered:false,
order_prescription_id:'',
message:'',
currentId:'',
show:false,
img_host:'https://oss.prod.applets.igandanyiyuan.com/applet/patient/static'
},
addAddresss:throttle(function(){
app.method.navigateTo({
url: '/pages/editAddress/editAddress?order_prescription_id='+this.data.order_prescription_id,
})
}),
confirm:throttle(function(event){
if(event.detail){
this.handelDelAddress();
}
}),
onCloseAddress(event) {
let id=event.currentTarget.dataset.id;
const {instance } = event.detail;
instance.close();
this.setData({
show:true,
currentId:id,
message:"确定删除该地址?"
})
},
handleRefresher(){
this.handleGetAddress()
},
handleGetAddress(){
getAddress().then(data=>{
this.setData({
isTriggered:false,
addressList:data
})
})
},
goBack(){
wx.navigateBack({
delta: 1,
})
},
handelDelAddress(){
let id=this.data.currentId;
delAddress(id).then(data=>{
wx.showToast({
title: '删除成功',
icon:"none"
});
this.handleGetAddress();
})
},
selectAddress(event){
if(this.data.address_id){
let{id,name,phone,province,city,country,address}=event.currentTarget.dataset
this.setData({
address_id: id,
});
let addressInfo={
name,
phone,
province,
city,
country,
address,
address_id:id
};
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2]; //上上一页
prevPage.setData({
prevData:JSON.stringify(addressInfo)
});
wx.navigateBack({
delta: 1,
})
}
},
goEdit(event){
let id=event.currentTarget.dataset.id
app.method.navigateTo({
url: '/pages/editAddress/editAddress?address_id='+id+"&order_prescription_id="+this.data.order_prescription_id
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let address_id=options.address_id;
let order_prescription_id=options.order_prescription_id;
if(address_id){
this.setData({
address_id,
order_prescription_id
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow(options) {
this.handleGetAddress();
this.setData({
img_host:app.hostConfig().imghost
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
})
+11
View File
@@ -0,0 +1,11 @@
{
"usingComponents": {
"van-swipe-cell": "@vant/weapp/swipe-cell/index",
"dialog":"../../components/dialog/dialog",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"nav":"../../components/nav/nav"
},
"navigationStyle":"custom",
"navigationBarTitleText": "肝胆相照互联网医院"
}
+51
View File
@@ -0,0 +1,51 @@
<!--pages/address/address.wxml-->
<view class="page">
<nav navName="地址管理"></nav>
<scroll-view scroll-y="true" class="hasdata" bindrefresherrefresh="handleRefresher" refresher-triggered="{{isTriggered}}" refresher-threshold="100" refresher-enabled="true">
<view wx:if="{{addressList.length>0}}">
<van-radio-group value="{{address_id}}" bind:change="onChange">
<van-swipe-cell right-width="{{ 65 }}" wx:for="{{addressList}}" wx:key="address_id" bind:close="onCloseAddress" data-id="{{item.address_id}}" async-close>
<van-cell-group >
<view class="list">
<view class="cell" bindtap="selectAddress" data-id="{{item.address_id}}" data-name="{{item.consignee_name}}" data-phone="{{item.consignee_tel}}"
data-province="{{item.province}}"
data-city="{{item.city}}"
data-country="{{item.county}}"
data-address="{{item.address}}"
>
<van-radio wx:if="{{order_prescription_id}}" right="leftcon" name="{{item.address_id}}" checked-color="#3CC7C0;"></van-radio>
<view class="radiowraper" style="width:100%">
<view class="namebox">
<view class="name">{{item.consignee_name}}</view>
<view class="phone">{{item.consignee_tel_mask}}</view>
<view class="moren" wx:if="{{item.is_default==1}}">默认</view>
<!-- 地址标签(1:家 2:公司 3:学校) -->
<view class="type" wx:if="{{item.tag==1}}">家</view>
<view class="type" wx:elif="{{item.tag==2}}">公司</view>
<view class="type" wx:elif="{{item.tag==3}}">学校</view>
<view class="type"wx:elif="{{item.tag==4}}">其他</view>
</view>
<view class="addbox">
<view class="address">{{item.province}}{{item.city}}{{item.county}} {{item.address}}</view>
<view class="editbox" catchtap="goEdit" data-id="{{item.address_id}}">
<image src="{{img_host+'/bianji-2.png'}}" class="edit" ></image></view>
</view>
</view>
</view>
</view>
</van-cell-group>
<view slot="right" class="van-swipe-cell__right" >删除</view>
</van-swipe-cell>
</van-radio-group>
</view>
<view class="nodata" wx:else>
<image src="{{img_host+'/address.png'}}" class="address"></image>
<view class="tips">暂无收货地址哦~</view>
</view>
</scroll-view>
<view class="btnbox">
<view class="btn" bindtap="addAddresss">添加地址</view>
</view>
</view>
<dialog bind:confirm="confirm" showDialog="{{show}}" message="{{message}}"></dialog>
+160
View File
@@ -0,0 +1,160 @@
/* pages/address/address.wxss */
.page{
display: flex;
flex-direction: column;
}
.nodata {
position: relative;
width: 100vw;
flex:1;
margin-bottom: 222rpx;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.nodata .address {
display: flex;
flex-wrap: wrap;
width:206rpx;
height: 138rpx;
}
.nodata .tips {
font-size: 24rpx;
color: #999999
}
.btnbox {
position: fixed;
bottom: 0px;
height: 130rpx;
width: 100%;
background: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
}
.btn {
height: 80rpx;
background: #3CC7C0;
border-radius: 8rpx;
display: flex;
color: #fff;
justify-content: center;
align-items: center;
width: 100%;
margin: 0 32rpx;
}
.hasdata {
flex:1;
margin-top: 192rpx;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
padding-bottom: 142rpx;
}
.nodata{
margin-top: 172rpx;
}
.namebox {
display: flex;
align-items: center;
}
.rightcon{
display: flex;
}
.label{
display: flex;
}
.addbox {
width:100%;
flex:1;
margin-top: 18rpx;
display: flex;
justify-content: space-between;
}
.list {
padding: 0rpx 32rpx;
background-color: #fff;
}
.list .cell {
width: 100%;
padding: 30rpx 0;
align-items: center;
display: flex;
border-bottom: 1rpx solid #E3E4E5;
}
.namebox .phone,
.namebox .name {
font-size: 34rpx;
display: flex;
align-items: center;
color: #666666;
}
.namebox .phone {
margin-left: 10rpx;
}
.namebox .moren {
width: 94rpx;
height: 50rpx;
align-items: center;
justify-content: center;
color: #FA541C;
font-size: 24rpx;
margin-left: 20rpx;
background: #FFF2E8;
display: flex;
border-radius: 10rpx;
}
.van-swipe-cell__right {
width:65px;
display: flex;
align-items: center;
justify-content: center;
background: #FA541C;
color: #fff;
}
.namebox .type {
width: 94rpx;
height: 50rpx;
background: #3CC7C0;
border-radius: 10rpx;
color: #FFFFFF;
margin-left: 20rpx;
align-items: center;
display: flex;
justify-content: center;
font-size: 24rpx;
}
.addbox .address {
word-break: break-all;
font-size: 36rpx;
color: #333333;
flex:1;
margin-right: 40rpx;
}
.editbox{
margin-top: 10rpx;
display: flex;
justify-content: flex-end;
width: 45rpx;
}
.edit {
width: 32rpx;
height: 32rpx;
flex-shrink: 0;
}