测试版

This commit is contained in:
liuyuan
2025-03-05 15:16:45 +08:00
parent 8dbdce6d3f
commit 9accfddbe5
3849 changed files with 365801 additions and 0 deletions

View File

@@ -0,0 +1,950 @@
<template>
<view class="">
<view class="common_address_box" style="background-color: #fff">
<z-nav-bar :title="`${addressId ? '编辑' : '添加'}收货地址`">
<template slot="right">
<text @click="handleClickDelete" v-if="addressId" style="padding-right: 20rpx; color: red">删除</text>
</template>
</z-nav-bar>
<view style="padding: 20rpx">
<view class="order_top common_radius_box color_shandow goods_box address_box">
<view class="title">
<text>地址信息</text>
<view class="agree">
<radio-group class="agree">
<view v-for="(item, index) in argee" :key="index">
<radio class="agreeRadio" :value="item.id" :checked="item.id == radioValue"
color="#7dc1f0" @click="radioCheck(index)"></radio>
默认收货地址
</view>
</radio-group>
</view>
</view>
<view class="form_box">
<uni-forms ref="form" :rules="rules" :modelValue="addForm" :label-width="80">
<uni-forms-item label="收件人" name="consigneeName" required>
<view class="inputBox"><uni-easyinput :maxlength="16" :style="{
borderColor: '#2979FF',
}" v-model="addForm.consigneeName" placeholder="请输入收件人姓名" /></view>
</uni-forms-item>
<uni-forms-item label="手机号" required name="consigneePhone">
<uni-easyinput v-model="addForm.consigneePhone" placeholder="请输入手机号" />
</uni-forms-item>
<uni-forms-item label="所在地区" required name="areaidpathtext">
<view class="inputBox select_address_box" @click="addreShow = true;">
<view class="addresss_info">
<text :style="`color:${addForm.areaidpathtext ? '' : '#999'};`">
{{
addForm.areaidpathtext
? addForm.areaidpathtext
: "请选择所在地区"
}}
</text>
</view>
<view class="addresss_icon">
<image src="@/static/icon/icon_right.png" class="rightArrow"
style="margin-right: 10rpx"></image>
</view>
</view>
</uni-forms-item>
<uni-forms-item label="详细地址" required name="detailAddress">
<uni-easyinput type="textarea" v-model="addForm.detailAddress" placeholder="请输入详细地址" />
</uni-forms-item>
</uni-forms>
</view>
<!-- </view> -->
</view>
</view>
<view class="goods_nav_box">
<uni-goods-nav :fill="true" :options="buyOptions" :button-group="customButtonGroup1"
@click="onHandleClickBuy" @buttonClick="onHandleClickBuy" />
</view>
</view>
<sx-address-picker ref="sxAddress" v-model="addressPopup" @confirm="addressConfirm($event, 'formData')" />
<u-modal :show="showModal" :title="modalInfo.title" :content="modalInfo.content" showCancelButton
@confirm="deleteAddress" @cancel="hancleModalCancel"></u-modal>
<u-picker @cancel="addcancel" :show="addreShow" ref="uPicker" :columns="columns" keyName="UName"
@confirm="addconfirm" @change="changeHandler"></u-picker>
</view>
</template>
<script>
import courseDescription from "@/pages/component/commonComponents/list";
import addressList1 from "@/static/address.json";
import $http from "@/config/requestConfig.js";
import {
mapState
} from "vuex";
export default {
components: {
courseDescription, //课程说明
},
data() {
return {
showModal: false,
addreShow: false, //是否显示
addressId: null,
columns: [], //省份数据显示,三级联动需要三维数组,展示初始数据
columnData: [], //市数据
columnDatas: [], //区地址
addressList: [],
modalInfo: {},
radioValue: "",
buyOptions: [],
customButtonGroup1: [{
with: 200,
text: "保存",
backgroundColor: "linear-gradient(90deg, #294a97 0%, #7dc1f0 80%)",
color: "#fff",
}, ],
addressPopup: false,
addressPopup2: false,
selectedAddress: [],
formData: {
country: "",
province: "",
city: "",
area: "",
street: "",
},
formData2: {
country: "埃及"
},
addForm: {
name: "uView UI",
sex: "",
},
actions: [{
name: "男",
},
{
name: "女",
},
{
name: "保密",
},
],
rules: {
// 对name字段进行必填验证
consigneeName: {
// name 字段的校验规则
rules: [
// 校验 name 不能为空
{
required: true,
errorMessage: "请输入收件人姓名",
}
],
// 当前表单域的字段中文名,可不填写
validateTrigger: "submit",
},
consigneePhone: {
// name 字段的校验规则
rules: [
// 校验 name 不能为空
{
required: true,
errorMessage: "请输入手机号",
},
{
validateFunction: (rule, value, data, callback) => {
// 异步需要返回 Promise 对象
return new Promise((resolve, reject) => {
if (!this.$base.phoneRegular.test(value)) {
reject(new Error("手机号格式不正确"));
} else {
resolve();
}
// setTimeout(() => {
// }, 500);
});
},
},
],
// 当前表单域的字段中文名,可不填写
validateTrigger: "submit",
},
areaidpathtext: {
// name 字段的校验规则
rules: [
{
validateFunction: (rule, value, data, callback) => {
// 异步需要返回 Promise 对象
return new Promise((resolve, reject) => {
console.log("value at line 251:", rule, value, data);
if (
this.addForm.areaidpathtext &&
this.addForm.areaidpathtext != ""
) {
resolve();
this.$refs.form.clearValidate(["areaidpathtext"]);
} else {
reject(new Error("请选择所在地区1"));
}
// setTimeout(() => {
// }, 500);
});
},
},
],
// 当前表单域的字段中文名,可不填写
validateTrigger: "submit",
},
detailAddress: {
// name 字段的校验规则
rules: [
// 校验 name 不能为空
{
required: true,
errorMessage: "请输入详细地址",
},
],
// 当前表单域的字段中文名,可不填写
validateTrigger: "submit",
},
},
addressData: {},
addressChanged: false, // 地址修改标记
argee: [{
value: false,
id: "1",
}, ], // 同意权限
show: false,
urlList: {
detailInfo: "common/userAddress/info",
add: "common/userAddress/save",
edit: "common/userAddress/update",
delete: "common/userAddress/delete",
},
customButton: [{
width: "340rpx",
text: "立即支付",
backgroundColor: "linear-gradient(90deg, #3AB3AE 0%, #117e4c 100%)",
color: "#fff",
}, ],
};
},
onLoad(options) {
this.options = options;
},
onHide() {
},
onShow() {
this.addForm = {}
this.selectPayIndex = 0;
this.open(this.options.id);
},
computed: {
...mapState(["userInfo"]),
},
onReady() {
// 需要在onReady中设置规则
this.$refs.form.setRules(this.rules);
},
methods: {
addcancel() {
//点击取消按钮
this.addreShow = false;
},
changeHandler(e) {
//城市选择时触发
// console.log(e,'变化了',this.columnData, this.columnDatas)
this.addressChanged = true;
const {
columnIndex, //当前选择的列,省 / 市 / 区
value, // 当前选择的数组内容
values, // values为当前变化列的数组内容
index, // 当前列的下标值
indexs, // 当前选择 省 市 区的下表值
picker = this.$refs.uPicker,
} = e;
// 当第一列值发生变化时,变化第二列和第三列的值(省份变更,市和区跟着变更)
if (columnIndex === 0) {
// 判断当前变更的是省还是市还是区
// picker为选择器this实例变化第二列对应的选项
picker.setColumnValues(1, this.columnData[
index]); //设置市为该省下面的所有市index是当前省在省份数组的下标对应市数组中的下表就是 该省下面的所有市 的数据
picker.setColumnValues(2, this.columnDatas[index][0]); // 设置区域为该省下面第一个市下面的所有区域
}
if (columnIndex === 1) {
// 当第二列发生变化 变化对应的第三列
picker.setColumnValues(2, this.columnDatas[indexs[0]][index]); //同上
}
},
addconfirm(e) {
//点击确定按钮
// console.log(e,'选中的值')
this.addressChanged = true;
this.addreShow = false;
this.addForm.areaidpathtext =
e.value[0].UName + "-" + e.value[1].UName + "-" + e.value[2].UName;
this.provId = e.value[0].provId;
this.cityId = e.value[1].cityId;
this.countyId = e.value[2].regionCode;
this.addForm.province = e.value[0].UName;
this.addForm.city = e.value[1].UName;
this.addForm.county = e.value[2].UName;
this.addForm.regionCode = e.value[2].regionCode;
this.$refs.form.clearValidate(["areaidpathtext"]);
},
// 三级联动
initDataPicker() {
//此处的province主要用作数据的初始化即刚打开就需要进行展示的数据这个跟第一条省份数据相关我的第一条是北京市所以需要columns中的三维数组第一维度是省份数据数组第二维度是市数据数组第三维度是区数据数组
let province = []; //初始数据需要展示的省份
let province1 = [{
cityId: this.addressList[0].cityList[0].cityId,
provId: this.addressList[0].cityList[0].provId,
cityName: this.addressList[0].cityList[0].cityName,
UName: this.addressList[0].cityList[0].cityName,
createDate: this.addressList[0].cityList[0].createDate,
regionCode: this.addressList[0].cityList[0].regionCode,
countyList: this.addressList[0].cityList[0].countyList,
}, ]; //因为第一个市北京市,所以就直接添加北京市下辖的直辖市了 也即初始数据需要展示的市,北京市只有一个市辖区
let province2 = []; //初始数据需要展示的区域数据,也即是 北京市市辖区内的区
for (let i = 0; i < this.addressList.length; i++) {
this.addressList[i].UName = this.addressList[i].provName;
if (this.addressList[i].cityList == null) {
// 如果没有cityList数据就添加一项用省份的信息
// console.log('存在单一',this.addressList[i].provId)
this.addressList[i].cityList = [{
cityId: this.addressList[i].provId,
provId: this.addressList[i].provId,
cityName: this.addressList[i].provName,
UName: this.addressList[i].provName,
createDate: this.addressList[i].createDate,
regionCode: this.addressList[i].regionCode,
countyList: [{
countyId: this.addressList[i].provId,
cityId: this.addressList[i].provId,
countyName: this.addressList[i].provName,
UName: this.addressList[i].provName,
createDate: this.addressList[i].createDate,
regionCode: this.addressList[i].regionCode,
}, ],
}, ];
} else {
for (let j = 0; j < this.addressList[i].cityList.length; j++) {
this.addressList[i].cityList[j].UName =
this.addressList[i].cityList[j].cityName;
for (
let k = 0; k < this.addressList[i].cityList[j].countyList.length; k++
) {
this.addressList[i].cityList[j].countyList[k].UName =
this.addressList[i].cityList[j].countyList[k].countyName;
}
}
}
province.push(this.addressList[i]);
}
this.addressList[0].cityList[0].countyList.map((item) => {
province2.push(item);
});
//省数据 因为要做数据初始化,所以是三维数组
// 数据格式 [ [所有的省份数据:{},{}] , [第一个省份下的所有的市:{},{},{}] , [第一个市下面所有的区:{},{},{}] ]
this.columns.push(province);
this.columns.push(province1);
this.columns.push(province2);
// console.log(6666666,this.columns)
// 市数据数组筛选address.json文件将全国所有省下面的市数据放入数组
// 格式[ [第一个省下面所有市,{},{},{}] , [第二个省下面所有市{},{},{}] , [第三个省下面所有市{},{},{}] ] 注意,以上的第一第二对应着 columns[0] 的数据
this.addressList.map((item) => {
let city = [];
item.cityList.map((item1) => {
city.push(item1);
});
this.columnData.push(city);
});
//区数据数组
//数据格式: [ 所有省下面所有市的所有区 [ 第一个省下面所有市的区:[ [第一个省下面第一个市的所有区] , [第一个省下面第二个市的所有区] ,] , [ 第二个省下面所有市的区:[ [第二个省下面第一个市的所有区] , [第二个省下面第二个市的所有区] ,] ]
let area = [];
this.addressList.map((item, index) => {
let area1 = []; //省下面所有市的初始化
item.cityList.map((item1) => {
area = []; //市下面的区初始化
item1.countyList.map((item2) => {
area.push(item2);
});
area1.push(area); // 每循环一个市,添加该市下面的所有区
});
this.columnDatas.push(area1); // 每循环一个省,添加该省下面的所有市
});
},
hancleModalCancel() {
this.showModal = false;
},
handleClickDelete(id) {
this.modalInfo = {
title: "提示信息",
content: "确定要删除该地址吗?"
};
this.showModal = true;
},
deleteAddress() {
var data = {};
$http
.request({
// url: "book/buyOrder/buySave",
url: `${this.urlList.delete}?id=${this.addressId}`,
method: "Get", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then((res) => {
console.log("res at line 252:", res);
this.showModal = false;
if (res.code == 0) {
uni.navigateBack({
delta: 1
});
} else {
this.$commonJS.showToast(res.message)
}
});
},
backClick() {
this.show = false;
this.$emit("fresh");
},
async onHandleClickBuy(e) {
console.log("e at line 387:", e);
var that = this;
var url;
var data = this.addForm;
console.log("data at line 355:", data);
this.$refs.form
.validate()
.then(async (res) => {
console.log("表单数据信息:", res);
data.isDefault = this.radioValue ? 1 : 0;
// data.regionCode = "110101";
data.userId = this.userInfo.id;
if (this.addForm.id) {
url = this.urlList.edit;
} else {
url = this.urlList.add;
}
await $http
.request({
// url: "book/buyOrder/buySave",
url: url,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then(async (res) => {
console.log("res at line 374:", res);
if (res && res.code == 0) {
uni.navigateBack({
delta: 1
});
this.$forceUpdate();
} else {
this.$commonJS.showToast(res.message)
}
});
})
.catch((err) => {
console.log("表单错误信息:", err);
});
},
addressConfirm(address, key) {
const [country, province, city, area, street] = address;
this.address = province ? address.filter((v, i) => i > 0) : address;
if (address.length === 5) {
this[key].country = country.name;
this[key].province = province.name;
this[key].city = city.name;
this[key].area = area.name;
this[key].street = street.name;
} else {
this[key].country = country.name;
this[key].province = undefined;
this[key].city = undefined;
this[key].area = undefined;
this[key].street = undefined;
}
this.addressChange();
},
addressChange() {
const {
country,
province,
city,
area,
street
} = this.formData;
this.selectedAddress = province ? [country, province, city, area, street] : [country];
// this.addressStr();
},
clearSelectAddress() {
this.addForm.areaidpathtext = "";
this.$forceUpdate();
},
openSelectAddress() {
this.addressPopup = true;
this.$forceUpdate();
},
handleClickEdit(data) {
console.log("data at line 145:", data);
},
getName(name) {
console.log("name at line 140:", name);
if (name) {
if (name.length <= 2) {
return name;
} else {
return name.substring(0, 1);
}
}
},
open(id) {
this.addressList = [];
this.columns = [];
this.columnData = [];
this.columnDatas = [];
this.addressList = addressList1;
this.initDataPicker(); //初始化省份列表
if (id) {
this.addressId = id;
this.getData(id);
} else {
this.addForm = {};
}
},
fnCopy(value, title) {
this.$commonJS.handleMakingPhoneCalls(value, title);
},
gotoPhone() {
this.$commonJS.handleMakingPhoneCalls("022-24142321");
},
radioChange(index) {
this.selectPayIndex = index;
console.log("this.selectPayIndex at line 315:", this.selectPayIndex);
this.$forceUpdate();
},
handleValChange(e) {
console.log("e at line 424:", e);
},
buttonClick(e) {
console.log(e);
this.options[2].info++;
},
hancleModalConfirm() {
var data = {
values: {
customerType: "D",
token: uni.getStorageSync("token"),
customerOid: uni.getStorageSync("customerOid"),
...this.taiHuClassInfo,
},
};
},
selectAddress(v) {
console.log("v at line 423:", v);
this.$emit("selectAddress", v);
this.show = false;
},
async getData(id) {
console.log("this.userInfo.id at line 368:", this.userInfo.id);
var data = {};
var that = this;
$http
.request({
url: `${this.urlList.detailInfo}/${id}`,
method: "POST",
data,
header: {
"Content-Type": "application/json",
},
})
.then(async (res) => {
console.log("res at line 374:", res);
if (res && res.code == 0) {
this.radioValue = res.result.isDefault;
this.addForm = res.result;
this.addForm.areaidpathtext =
res.result.province +
"-" +
res.result.city +
"-" +
res.result.county;
// this.addressChange();
}
this.show = true;
this.$forceUpdate();
// await that.getDetailInfo();
});
},
getPriceData() {
var that = this;
setTimeout(() => {
that.$nextTick(() => {
that.$refs.priceDetail.getData();
});
}, 100);
},
// 检查是有权限使用搜索功能
checkDisable() {
console.log("点击了");
},
// 获取用户详情
getUserInfo() {
// 用户详情
if (this.userInfo.id != undefined) {
this.$http.post("book/user/info/" + this.userInfo.id).then((res) => {
this.userMes = res.user;
this.getCateList();
console.log(this.userMes, "呼呼");
});
}
},
radioCheck(index) {
// 勾选用户协议
this.argee.forEach((item) => {
item.isCheck = false;
});
if (this.radioValue == this.argee[index].id) {
this.radioValue = null;
} else {
this.radioValue = this.argee[index].id;
}
this.$forceUpdate();
// console.log(this.radioValue)
},
async handleselectCate(item, index) {
this.dataList = [];
var data = [];
console.log(item, index, 99999);
var that = this;
// curriculumInfo
this.$http
.post(this.urlList.curriculumInfo, {
customerType: "D",
token: uni.getStorageSync("token"),
customerOid: uni.getStorageSync("customerOid"),
oid: item.coid,
})
.then(async (res) => {
that.curriculumInfo = res.obj;
that.dataList = res.obj.courseList;
// socket.init();
});
this.searchValue = "";
this.searchList = [];
this.showSearchList = false;
return data;
},
async getDetailInfo() {
var that = this;
// curriculumInfo
this.detailInfo = {
content: "<img src='http://oss.taihumed.com/other/null_20210528102528870.jpg' ></img> <img src='http://101.201.146.165:8088/curriculum/detailImg/curriculum_20170420143333621.png' ></img><p><p>没有中医基础想学中医难不难?中医学者治疗出现瓶颈怎么办?中西医究竟有什么不同呢?吴雄志教授将以全新的视角,完美整合中药学和西医学知识,让你领略当代中医生理学魅力。</p><p><br/><p></p><p><br/></p><p>【思考题】</p><p>1、简述中医的发展这些年出现了哪些变化</p><p>2、简述中西医学科的异同</p>",
};
this.searchValue = "";
this.searchList = [];
this.showSearchList = false;
return data;
},
async setOneCateIndex(item, index) {
this.allDataList = [];
console.log(index, 99999);
var that = this;
this.currentStatusIndex = index;
// this.currentCateIndex = 0
this.searchValue = "";
this.searchList = [];
this.showSearchList = false;
this.$nextTick(async () => {
await that.getData();
this.$forceUpdate();
});
},
transformData(inputData) {
const result = {};
inputData.forEach((item) => {
const {
letter
} = item;
if (!result[letter]) {
result[letter] = [];
}
result[letter].push(item);
});
// const finalResult = Object.keys(result).map(key => ({ [key]: result[key] }));
return result;
},
getCateList(id) {
id ? "" : (id = 0);
this.twoCateList = [];
this.curTwoCateIndex = 0;
},
// 放大图片
previewImage(url) {
console.log(url);
uni.previewImage({
urls: [url],
longPressActions: {
itemList: ["很抱歉,暂不支持保存图片到本地"],
success: function(res) {
// console.log(res,'+++++')
},
},
});
},
},
onBackPress() {
// #ifdef APP-PLUS
plus.key.hideSoftKeybord();
// #endif
},
};
</script>
<style lang="scss" scoped>
@import '@/static/mixin.scss';
.AC_List {
width: 100%;
overflow: hidden;
display: flex;
align-items: center;
// justify-content: space-between;
}
.curriulum_title {
width: 100%;
font-weight: 500;
font-size: 28rpx;
// line-height: 40rpx;
// display: flex;
// align-items: center;
margin-top: 10rpx;
float: left;
margin-bottom: 5rpx;
color: #b0b0b0;
// padding: 20rpx;
box-sizing: border-box;
text {
margin-right: 10rpx;
}
}
.right {
width: calc(100% - 100rpx);
display: flex;
align-items: center;
}
.user_info {
width: 100%;
float: left;
display: flex;
margin-top: 10rpx;
align-items: center;
font-size: 32rpx;
font-weight: 800;
.name {
color: #333;
margin-right: 10rpx;
}
.tel {
color: #000;
font-size: 28rpx;
font-weight: 600;
}
}
.common_address_box {
width: 100vw;
height: 100vh;
background-color: #fff;
}
.normal_box {
width: calc(100% - 60rpx);
height: auto;
float: left;
// overflow: hidden;
.normal_box_top {
width: 100%;
// display: flex;
height: auto;
margin-bottom: 40rpx;
}
.editIcon {
float: right;
}
}
.normal_logo {
width: 80rpx !important;
height: 80rpx !important;
border-radius: 80rpx;
background-color: $themeBgColor;
color: $themeColor;
font-size: 34rpx;
font-weight: bold;
text-align: center;
line-height: 80rpx;
float: left;
margin-right: 20rpx;
}
.isDefault {
color: $themeColor;
font-size: 22rpx;
font-weight: 600;
border: 1rpx solid $themeColor;
padding: 2rpx 10rpx;
border-radius: 6rpx;
line-height: 30rpx;
margin-left: 18rpx;
}
/deep/.sx-address-picker__list-tab {
padding-left: 0;
}
.inputBox {
width: 100%;
// padding: 20rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 10rpx;
}
/deep/.uni-easyinput__content {
background-color: #fff !important;
border-color: #fff !important;
}
.select_address_box {
min-height: 35px;
line-height: 1;
font-size: 14px;
height: auto;
padding-left: 20rpx;
background-color: #fff !important;
padding-top: 20rpx;
padding-bottom: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
.address_info {
width: calc(100% - 60rpx);
}
}
.address_box {
background-color: #eff5f8;
padding: 30rpx;
.title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 60rpx;
}
}
/deep/.is-input-error-border .uni-easyinput__placeholder-class {
color: #999 !important;
}
/deep/.uni-easyinput-error {
color: #333 !important;
}
/deep/.uni-forms-item .is-required {
margin-right: 10rpx !important;
padding-top: 10rpx !important;
}
.rightArrow {
margin-right: 40rpx;
width: 40rpx;
height: 40rpx;
// position: absolute;
// right: 30rpx;
}
</style>

View File

@@ -0,0 +1,515 @@
<template>
<view class="">
<view
class="common_address_box"
:style="`${
backState != 1000 ? 'padding-bottom: 180rpx' : 'padding-bottom: 100rpx'
}`"
>
<z-nav-bar
navFontAlign="left"
title="我的收货地址"
>
<template slot="right"></template>
</z-nav-bar>
<view
class=""
style="padding: 20rpx; background-color: #f9f9f9; height: 100%"
>
<common-list
isCondition="true"
:dataList="addressList"
isNoIcon="true"
@hancleClick="selectAddress"
label="name"
class="common_radius_box color_shandow"
style="background-color: #fff"
>
<template slot="labelSlot" slot-scope="slotProps">
<view class="label_content AC_List">
<view style="width: 100%">
<view class="normal_logo">
{{ getName(slotProps.row.consigneeName) }}
</view>
<view :class="`right`">
<view class="normal_box">
<view class="normal_box_top">
<view class="user_info">
<text class="name">
{{ slotProps.row.consigneeName }}
</text>
<text class="tel">
{{ slotProps.row.consigneePhone }}
</text>
<text
v-if="slotProps.row.isDefault == 1"
class="isDefault"
>默认</text
>
</view>
<view class="curriulum_title"
>{{ slotProps.row.province }}{{ slotProps.row.city
}}{{ slotProps.row.county
}}{{ slotProps.row.detailAddress }}
</view>
</view>
</view>
<!-- 018F89 -->
<u-icon
class="editIcon"
name="edit-pen-fill"
color="#7dc1f0"
size="20"
@click.native.stop="handleClickEdit(slotProps.row)"
style="display: inline-block; margin-left: 10rpx"
></u-icon>
<u-icon
class="editIcon"
name="trash-fill"
color="red"
size="20"
@click.native.stop="handleClickDelete(slotProps.row.id)"
style="display: inline-block; margin-left: 10rpx"
></u-icon>
</view>
</view>
<view> </view>
</view>
</template>
<template slot="rightSlot" slot-scope="slotProps">
<view> </view>
</template>
</common-list>
</view>
<view class="goods_nav_box">
<uni-goods-nav
:fill="true"
:options="buyOptions"
:button-group="customButtonGroup1"
@click="onHandleClickIcon"
@buttonClick="onHandleClickBuy"
/>
</view>
</view>
<u-modal
:show="showModal"
:title="modalInfo.title"
:content="modalInfo.content"
showCancelButton
@confirm="deleteAddress"
@cancel="hancleModalCancel"
></u-modal>
</view>
</template>
<script>
import courseDescription from "@/pages/component/commonComponents/list";
import editAddress from "./edit.vue";
import $http from "@/config/requestConfig.js";
import { mapState } from "vuex";
export default {
components: {
courseDescription, //课程说明
editAddress, //编辑收货地址
},
props: ["backState", "type"],
data() {
return {
isEdit: false,
showModal: false,
addressData: {},
buyOptions: [],
customButtonGroup1: [
{
with: 200,
text: "+ 添加收货地址",
backgroundColor: "linear-gradient(90deg, #294a97 0%, #7dc1f0 80%)",
color: "#fff",
},
],
show: false,
addressList: [],
urlList: {
list: "common/userAddress/getUserAddress",
curriculumInfo: "app/phone.do?getCourseInfo",
detailInfo: "app/phoneDoctor.do?getTaiHuClassInfo_new",
delete: "common/userAddress/delete",
},
customButton: [
{
width: "340rpx",
text: "立即支付",
backgroundColor: "linear-gradient(90deg, #3AB3AE 0%, #117e4c 100%)",
color: "#fff",
},
],
modalInfo: {},
};
},
onLoad(options) {
this.options = options;
this.getData();
// this.getUserInfo()
// this.getCateList()
},
onHide() {
// this.showSearchList = false
// this.searchList = []
},
onShow() {
this.selectPayIndex = 0;
this.getData();
},
computed: {
...mapState(["userInfo"]),
},
methods: {
hancleModalCancel() {
this.showModal = false;
},
backClick() {
this.$emit("fresh");
},
handleFresh() {
this.getData();
},
onHandleClickIcon() {
this.isEdit = true;
},
onHandleClickBuy() {
uni.navigateTo({
url: "/pages/component/commonComponents/address/edit",
});
},
handleClickEdit(data) {
console.log("data at line 145:", data);
uni.navigateTo({
url: "/pages/component/commonComponents/address/edit?id=" + data.id,
});
},
deleteAddress() {
var data = {};
$http
.request({
url: `${this.urlList.delete}?id=${this.selectAddressId}`,
method: "Get",
data,
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
console.log("res at line 252:", res);
this.showModal = false;
if (res.code == 0) {
this.getData();
}
});
},
handleClickDelete(id) {
this.modalInfo = { title: "提示信息", content: "确定要删除该地址吗?" };
this.selectAddressId = id;
this.showModal = true;
},
getName(name) {
console.log("name at line 140:", name);
if (name) {
if (name.length <= 2) {
return name;
} else {
return name.substring(0, 1);
}
}
},
open() {
this.getData();
},
fnCopy(value, title) {
this.$commonJS.handleMakingPhoneCalls(value, title);
},
gotoPhone() {
this.$commonJS.handleMakingPhoneCalls("022-24142321");
},
radioChange(index) {
this.selectPayIndex = index;
console.log("this.selectPayIndex at line 315:", this.selectPayIndex);
this.$forceUpdate();
},
handleValChange(e) {
console.log("e at line 424:", e);
},
buttonClick(e) {
console.log(e);
this.options[2].info++;
},
hancleModalConfirm() {
var data = {
values: {
customerType: "D",
token: uni.getStorageSync("token"),
customerOid: uni.getStorageSync("customerOid"),
...this.taiHuClassInfo,
},
};
},
selectAddress(v) {
// 当前页面
// 在源页面中使用 uni.navigateBack 返回上一页面并传递参数
if (this.options.type == "order") {
uni.$emit("returnData", v);
uni.navigateBack({
delta: 1, // 返回上一级页面
});
}
},
async getData() {
var data = {};
var that = this;
$http
.request({
url: `${this.urlList.list}?userId=${this.userInfo.id}`,
method: "POST",
data,
header: {
"Content-Type": "application/json",
},
})
.then(async (res) => {
console.log("res at line 374:", res);
if (res.code == 0) {
this.addressList = res.list;
}
this.$forceUpdate();
});
},
getPriceData() {
var that = this;
setTimeout(() => {
that.$nextTick(() => {
that.$refs.priceDetail.getData();
});
}, 100);
},
// 检查是有权限使用搜索功能
checkDisable() {
console.log("点击了");
},
// 获取用户详情
getUserInfo() {
// 用户详情
if (this.userInfo.id != undefined) {
this.$http.post("book/user/info/" + this.userInfo.id).then((res) => {
this.userMes = res.user;
this.getCateList();
console.log(this.userMes, "呼呼");
});
}
},
async handleselectCate(item, index) {
this.dataList = [];
var data = [];
console.log(item, index, 99999);
var that = this;
// curriculumInfo
this.$http
.post(this.urlList.curriculumInfo, {
customerType: "D",
token: uni.getStorageSync("token"),
customerOid: uni.getStorageSync("customerOid"),
oid: item.coid,
})
.then(async (res) => {
that.curriculumInfo = res.obj;
that.dataList = res.obj.courseList;
});
this.searchValue = "";
this.searchList = [];
this.showSearchList = false;
return data;
},
async getDetailInfo() {
var that = this;
this.searchValue = "";
this.searchList = [];
this.showSearchList = false;
return data;
},
async setOneCateIndex(item, index) {
this.allDataList = [];
console.log(index, 99999);
var that = this;
this.currentStatusIndex = index;
this.searchValue = "";
this.searchList = [];
this.showSearchList = false;
this.$nextTick(async () => {
await that.getData();
this.$forceUpdate();
});
},
transformData(inputData) {
const result = {};
inputData.forEach((item) => {
const { letter } = item;
if (!result[letter]) {
result[letter] = [];
}
result[letter].push(item);
});
return result;
},
getCateList(id) {
id ? "" : (id = 0);
this.twoCateList = [];
this.curTwoCateIndex = 0;
},
// 放大图片
previewImage(url) {
console.log(url);
uni.previewImage({
urls: [url],
longPressActions: {
itemList: ["很抱歉,暂不支持保存图片到本地"],
success: function (res) {
// console.log(res,'+++++')
},
},
});
},
},
onBackPress() {
// #ifdef APP-PLUS
plus.key.hideSoftKeybord();
// #endif
},
};
</script>
<style lang="scss" scoped>
@import '@/static/mixin.scss';
/deep/.list_item {
padding-left: 0 !important;
padding-right: 0 !important;
}
.AC_List {
width: 100%;
overflow: hidden;
display: flex;
align-items: center;
background-color: #fff;
}
.curriulum_title {
width: 100%;
font-weight: 500;
font-size: 28rpx;
white-space: wrap; /* 禁止文本换行 */
overflow: hidden;
margin-top: 10rpx;
float: left;
margin-bottom: 5rpx;
color: #b0b0b0;
// padding: 20rpx;
box-sizing: border-box;
text {
margin-right: 10rpx;
}
}
.right {
width: calc(100% - 100rpx);
display: flex;
align-items: center;
}
.user_info {
width: 100%;
float: left;
display: flex;
margin-top: 10rpx;
align-items: center;
font-size: 32rpx;
font-weight: 800;
.name {
max-width: calc(100% - 300rpx);
white-space: nowrap; /* 禁止文本换行 */
overflow: hidden; /* 隐藏超出容器的文本 */
text-overflow: ellipsis; /* 使用省略号代替隐藏的内容 */
display: inline-block;
color: #333;
margin-right: 10rpx;
}
.tel {
color: #000;
font-size: 28rpx;
font-weight: 600;
}
}
.common_address_box {
width: 100vw;
height: 100vh;
background-color: #fdfbfb;
}
.normal_box {
width: calc(100% - 60rpx);
height: auto;
float: left;
// overflow: hidden;
.normal_box_top {
width: 100%;
// display: flex;
height: auto;
margin-bottom: 40rpx;
}
.editIcon {
float: right;
}
}
.normal_logo {
width: 80rpx !important;
height: 80rpx !important;
border-radius: 80rpx;
background-color: $themeBgColor;
color: #7dc1f0;
font-size: 34rpx;
font-weight: bold;
text-align: center;
line-height: 80rpx;
float: left;
margin-right: 20rpx;
}
.isDefault {
color: #7dc1f0;
font-size: 22rpx;
font-weight: 600;
border: 1rpx solid $themeColor;
padding: 2rpx 10rpx;
border-radius: 6rpx;
line-height: 30rpx;
margin-left: 18rpx;
}
</style>