银花优选微信小程序修改后的最新版本代码

This commit is contained in:
ss001
2026-02-07 16:22:31 +08:00
commit c00caf5744
516 changed files with 41796 additions and 0 deletions

314
pages/myaddress/index.js Normal file
View File

@@ -0,0 +1,314 @@
var app = getApp()
var that=null
var sopenFrame=null
Page( {
data: {
loadingHidden:false,
weixinbutton:"一键获取微信收货地址",
myaddress:[]
},
onLoad: function() {
that = this
that.rdata(0)
sopenFrame=setInterval(function (){
if(app.globalData.IFRefreshmyaddress==1){
that.rdata()
app.globalData.IFRefreshmyaddress=0
}
}, 1000);
}, // 下拉刷新
onPullDownRefresh: function () {
//在当前页面显示导航条加载动画
wx.showNavigationBarLoading();
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
wx.showLoading({
title: '刷新中...',
})
that.clearCache();
that.rdata(1);//第一次加载数据
},rdata: function(t) {
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"getAddress",
userId:(!userId?"":userId),
LoginId:(!LoginId?"":LoginId)
},
method:"GET",
dataType:"json",
header: {
"content-type": "application/json" // 默认值
},
success (res) {
if(res.data.status==1){
var qygm = wx.getStorageSync("qygm")
if(qygm){
that.setData({
selectHidden:false
})
}else{
that.setData({
selectHidden:true
})
}
that.setData({
myaddress:res.data.data
})
if(res.data.data.length==0){
wx.removeStorageSync('editaddress')
wx.navigateTo({
url: "../myaddress_add/index"
})
}
that.setData({
loadingHidden:true
})
}
if(t==0){
//隐藏loading 提示框
wx.hideLoading();
//隐藏导航条加载动画
wx.hideNavigationBarLoading();
//停止下拉刷新
wx.stopPullDownRefresh();
}
}
})
},select:function(e) {
var index = e.currentTarget.dataset.id
var id=that.data.myaddress[index].addressId
var contact=that.data.myaddress[index].contact
var tel=that.data.myaddress[index].tel
var area=that.data.myaddress[index].area
var detail=that.data.myaddress[index].detail
var Province=that.data.myaddress[index].Province
var qygm = wx.getStorageSync("qygm")
if(qygm){
app.globalData.selladdress={id:id,contact:contact,tel:tel,address:area+detail,Province:Province}
app.globalData.IFRefreshsell=1
wx.removeStorageSync('qygm')
wx.navigateBack({})
}
},isDefault:function(e) {
var index = e.currentTarget.dataset.id
var id=that.data.myaddress[index].addressId
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"setDefaultAddress",
userId:(!userId?"":userId),
LoginId:(!LoginId?"":LoginId),
addressId:id
},
method:"POST",
dataType:"json",
header: {
"content-type": "application/x-www-form-urlencoded" // 默认值
},
success (res) {
if(res.data.status==1){
wx.showToast({
title: res.data.msg,
icon: "success",
duration: 2000
})
that.rdata()
}else{
wx.showToast({
title: res.data.msg,
icon: "none",
duration: 2000
})
}
}
})
},isDefaulted:function(e) {
var index = e.currentTarget.dataset.id
var id=that.data.myaddress[index].addressId
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"setDefaultAddress",
userId:(!userId?"":userId),
LoginId:(!LoginId?"":LoginId),
t:1,
addressId:id
},
method:"POST",
dataType:"json",
header: {
"content-type": "application/x-www-form-urlencoded" // 默认值
},
success (res) {
if(res.data.status==1){
wx.showToast({
title: res.data.msg,
icon: "success",
duration: 2000
})
that.rdata()
}else{
wx.showToast({
title: res.data.msg,
icon: "none",
duration: 2000
})
}
}
})
},getweixinaddress:function(e) {
that.setData({
weixinbutton:"请稍候..."
})
wx.getSetting({
success(res) {
if (!res.authSetting['scope.address']) {
wx.authorize({
scope: 'scope.address',
success () {
that.addweixinaddress()
}
})
}else{
that.addweixinaddress()
}
}
})
},addweixinaddress:function() {
wx.chooseAddress({
success (res) {
var userName=res.userName
var postalCode=res.postalCode
var provinceName=res.provinceName
var cityName=res.cityName
var countyName=res.countyName
var detailInfo=res.detailInfo
var nationalCode=res.nationalCode
var telNumber=res.telNumber
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
if(userName!=""&&provinceName!=""&&cityName!=""&&telNumber!=""){
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"addweixinaddress",
userId:(!userId?"":userId),
LoginId:(!LoginId?"":LoginId),
contact:userName,
tel:telNumber,
provinceName:provinceName,
cityName:cityName,
countyName:countyName,
detail:detailInfo,
IFIndex:1
},
method:"POST",
dataType:"json",
header: {
"content-type": "application/x-www-form-urlencoded" // 默认值
},
success (res) {
if(res.data.status==1){
wx.showToast({
title: res.data.msg,
icon: "success",
duration: 3000
})
app.globalData.IFRefreshmyaddress=1
that.setData({
weixinbutton:"一键获取微信收货地址"
})
}else{
wx.showToast({
title: res.data.msg,
icon: "none",
duration: 3000
})
that.setData({
weixinbutton:"一键获取微信收货地址"
})
}
}
})
}
},fail (res) {
wx.showToast({
title: JSON.stringify(res),
icon: "none",
duration: 3000
})
}
})
},showaddaddress:function(e) {
wx.removeStorageSync('editaddress')
wx.navigateTo({
url: "../myaddress_add/index"
})
},showedit:function(e) {
var index = e.currentTarget.dataset.id
wx.setStorageSync('editaddress', JSON.stringify(that.data.myaddress[index]))
wx.navigateTo({
url: "../myaddress_add/index"
})
},delete:function(e) {
wx.showModal({
title: '删除提示',
content: '此操作不可恢复!您确认要删除吗?',
success (res0) {
if (res0.confirm) {
var index = e.currentTarget.dataset.id
var addressId=that.data.myaddress[index].addressId
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"deleteAddress",
userId:(!userId?"":userId),
LoginId:(!LoginId?"":LoginId),
addressId:addressId
},
method:"POST",
dataType:"json",
header: {
"content-type": "application/x-www-form-urlencoded" // 默认值
},
success (res) {
if(res.data.status==1){
wx.showToast({
title: res.data.msg,
icon: "success",
duration: 3000
})
that.rdata()
that.setData({
weixinbutton:"一键获取微信收货地址"
})
}else{
wx.showToast({
title: res.data.msg,
icon: "none",
duration: 3000
})
that.setData({
weixinbutton:"一键获取微信收货地址"
})
}
}
})
}
}
})
}
})

View File

@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "收货地址"
}

View File

@@ -0,0 +1,31 @@
<view class="container">
<!--<view class="fromtitle" bindtap="getweixinaddress"><image src="../../images/weixin.png"></image><text>{{weixinbutton}}</text><image class="arrowdown" src="../../images/icon-arrowdown.png"></image></view>-->
<view class="myaddress-box" wx:for="{{myaddress}}" wx:for-index="index" >
<view class="myaddress-item">
<view class="myaddress-contact" bindtap="select" data-id="{{index}}">
<text>{{item.contact}} {{item.tel}}\n{{item.area}}{{item.detail}}</text>
</view>
<view class="myaddress-bottom">
<view class="myaddress-btn" style="float:left;padding-left:0;" wx:if="{{item.IFIndex==1}}" data-id="{{index}}"><image src="../../images/wuliu02.png" />默认地址</view>
<view class="myaddress-btn" style="padding-right:0;" bindtap="showedit" data-id="{{index}}"><image src="../../images/edit.png" />编辑</view>
<view class="myaddress-btn" bindtap="delete" data-id="{{index}}"><image src="../../images/Delete.png" />删除</view>
</view>
<view class="myaddress-IFIndex" bindtap="select" data-id="{{index}}" hidden="{{selectHidden}}">
使用
</view>
</view>
<view class="addaddress">
<button bindtap="showaddaddress">添加新地址</button>
</view>
</view>
</view>
<loading hidden="{{loadingHidden}}">
加载中...
</loading>

View File

@@ -0,0 +1,50 @@
page{
background: #ccc;
}
.container {
position: relative;
width: 100%;
height: 100%;
font-size: 14px;
color: #000;
}
.container .address-image {
width: 120px;
height: 120px;
}
.addaddress{position: fixed; bottom:1em; width:90%;}
.addaddress button{width:100%;height:2.5em; line-height: 2.5em; background:linear-gradient(to right,#00B050,#00B050); color:#fff; border-radius:0.5em;}
.myaddress-box{display: flex;flex-direction: column;align-items: center;justify-content: center;width:100%;padding:0.8em; box-sizing: border-box;}
.myaddress-item{float: left; position: relative; width:100%; margin-bottom:0em; padding:0.8em; box-sizing: border-box;border:1px solid #f1f1f1; background-color:#fff;border-radius:0.5em;}
.myaddress-contact{width:100%; line-height:1.5em;}
.myaddress-bottom{width:100%;margin:0;margin-top:1em;}
.myaddress-bottom .myaddress-btn{float: right; width:auto; margin: 0 0; padding: 0.5em; background-color:#fff; box-sizing: border-box; border-radius:0.5em;}
.myaddress-bottom .myaddress-btn image{width:1.2em;height:1.2em; vertical-align: middle;}
.myaddress-IFIndex{position: absolute;top:1.5em;right:0.5em;width:4em;height:2em; line-height: 2em; border:1px solid #c1c1c1;background-color:#fff; text-align: center; border-radius:0.5em; color:#000}
.myaddress-IFIndex image{width:100%;height:100%;}
.fromtitle{width:100%; background-color:#fff; padding:1em; box-sizing: border-box;}
.fromtitle text{float:left;}
.fromtitle image{float:left;width:1.2em; height:1.2em;}
.fromtitle image.arrowdown{float:right; }
.myaddress-box .frombody{margin-top: 1em; padding:0.5em 1em;width:100%; display: flex;flex-direction: column; align-items: center; background-color:#fff;box-sizing: border-box;}
.myaddress-box .frombody view{position: relative;float:left; width:100%;display: flex;flex-direction:row;border-bottom:1px solid #f1f1f1;padding:0.5em 0; box-sizing: border-box;}
.myaddress-box .frombody view text{padding:0;height:2.5em; line-height: 2.5em;}
.myaddress-box .frombody view input{width:14em;height:2.5em; line-height: 2.5em;}
.myaddress-box .frombody view.area input{width:12.8em;}
.myaddress-box .frombody view.area image{position: absolute; top:1.1em; right:0; width:1.2em;height:1.2em;}
.myaddress-box .frombody view.button{border: 0;}
.myaddress-box .frombody view.button button{width:100%;height:2.5em; line-height: 2.5em; background-color:#fd463e;color:#fff; border-radius:0.5em;}
.Hidden_box{ position: fixed;display: flex;align-items: center; justify-content: center; top:0; left:0; width:100%;height:100vh; background:rgba(0, 0, 0, 0.5);z-index: 2;}
.section{position: relative; bottom:0; width:90%; height:20em; padding: 0 1em; background-color: #fff; box-sizing: border-box; border-radius:0.5em;}
.section .close{position: absolute; right:0.5em; top:0.5em; width:1.5em; height:1.5em; padding:0.15em; background-color:#fff;border:1px solid #f1f1f1;border-radius:50%;box-sizing:border-box;}
.section .close image{width:100%;height:100%;}
.section-title{width:100%;height:2.5em; line-height: 2.5em; text-align: center; font-weight: 600;border-bottom:1px solid #f1f1f1;}
.section-body{width:100%;}
.section-body view{width:100%;display: flex;flex-direction: row; align-items: center;border-bottom:1px solid #f1f1f1;padding:0.5em 0; box-sizing: border-box; line-height:1.5em;}
.section-body view text{color:#000;}
.section-body view .picker_hx{color:#939393;line-height:2.5em;}
.section-body view .picker_hx view{ float:left; position: relative; display: block; border:0;min-width:10em; padding-left:1em; box-sizing: border-box;border:1px solid #dfdfdf;border-radius:0.3em;line-height:2em;}
.section-body view .picker_hx image{position: absolute; top:1em;right:0.6em; width:1.2em;height:1.2em;}