Commit 3ef34930 authored by 陈宗胤(贵阳日报)'s avatar 陈宗胤(贵阳日报)
parents 18f4cb27 4cc1ea78
......@@ -9,7 +9,13 @@
<view class="full_list" v-else>
<wd-swipe-action>
<view class="additem" v-for="(item, index) in addressList" :key="index">
<view
@click.stop="selectAddress(item)"
:class="activeAdd === item ? 'acitve-additem' : 'additem'"
class="additem"
v-for="(item, index) in addressList"
:key="index"
>
<view class="additem_l">
<view class="address">{{ item.addr }}</view>
<view class="info">
......@@ -22,7 +28,7 @@
<view class="txt">默认</view>
</view>
<view v-else class="box" @click="deleteAdd(item.addrId)">
<view v-else class="box" @click.stop="deleteAdd(item.addrId)">
<wd-icon name="circle1" size="12px"></wd-icon>
<view class="txt">删除</view>
</view>
......@@ -47,12 +53,16 @@ import { getAddressList, deleteAddress } from '@/api/address';
const isAdressEmpty = ref(false);
const addressList = ref([]);
const activeAdd = ref(null);
const getAddressListData = async () => {
const { data: res } = await getAddressList();
console.log(res);
if (res) {
addressList.value = res;
activeAdd.value = res.filter((item) => {
return item.commonAddr === 1;
})[0];
res.length === 0 ? (isAdressEmpty.value = true) : (isAdressEmpty.value = false);
}
};
......@@ -65,6 +75,13 @@ onShow(() => {
const addNewAddress = () => {
xma.navigateTo({ url: '/pages/address/addressEdit?new=true' });
};
const selectAddress = (item) => {
activeAdd.value = item;
xma.setStorageSync('address', item);
xma.navigateBack({
delta: 1,
});
};
const editAddress = (col) => {
xma.navigateTo({
url: `/pages/address/addressEdit?content=${JSON.stringify(col)}`,
......@@ -104,6 +121,7 @@ page {
margin-top: 20rpx;
padding-bottom: 180rpx;
.acitve-additem,
.additem {
width: 710rpx;
padding: 20rpx;
......@@ -170,7 +188,9 @@ page {
}
}
}
.acitve-additem {
border: 2rpx solid #fa5151;
}
.addBtn {
width: 630rpx;
height: 72rpx;
......
......@@ -161,7 +161,6 @@ const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const textInputs = ref('');
const basketIds = ref([]);
const activeCouponId = ref('');
const changeAddress = ref(false);
const addressParams = ref({});
const showpopup = ref(false);
const outTradeNos = ref(null);
......@@ -177,12 +176,15 @@ onLoad((options) => {
skuIds.value = skuId;
types.value = type;
if (type === 'qg') {
console.log('1111111111111111111');
groupBuyConfirmFn(prodId, skuId).then((res) => {
useraddrDefaultUserAddrFn().then(() => {
groupBuyUpdateFnQg();
});
});
} else {
console.log('22222222222222222222222');
basketIds.value = ids.split(',');
sgyrddBasketConfirmFn(basketIds.value).then(() => {
useraddrDefaultUserAddrFn().then(() => {
......@@ -193,6 +195,7 @@ onLoad((options) => {
});
function groupBuyUpdateFnQg(couponUserId = '') {
const { receiverName, receiverMobile, receiverAddress } = addressParams.value;
groupBuyUpdate({
key: orderInfo.value.key,
couponUserId,
......@@ -206,21 +209,37 @@ function groupBuyUpdateFnQg(couponUserId = '') {
});
}
onShow(() => {
if (changeAddress.value) {
const storgeAddress = xma.getStorageSync('address') || null;
if (storgeAddress) {
addressInfo.value = storgeAddress;
addressParams.value.receiverName = storgeAddress.receiver;
addressParams.value.receiverMobile = storgeAddress.mobile;
addressParams.value.receiverAddress = storgeAddress.addr;
if (types.value === 'qg') {
groupBuyConfirmFn(prodIds.value, skuIds.value).then((res) => {
useraddrDefaultUserAddrFn().then(() => {
groupBuyUpdateFnQg();
});
groupBuyUpdateFnQg();
});
} else {
sgyrddBasketConfirmFn(basketIds.value).then(() => {
useraddrDefaultUserAddrFn().then(() => {
groupBuyUpdateFn();
});
groupBuyUpdateFn();
});
}
}
// else {
// if (types.value === 'qg') {
// groupBuyConfirmFn(prodIds.value, skuIds.value).then((res) => {
// useraddrDefaultUserAddrFn().then(() => {
// groupBuyUpdateFnQg();
// });
// });
// } else {
// sgyrddBasketConfirmFn(basketIds.value).then(() => {
// useraddrDefaultUserAddrFn().then(() => {
// groupBuyUpdateFn();
// });
// });
// }
// }
if (outTradeNos.value) {
// 查询订单状态决定是否支付
......@@ -306,7 +325,6 @@ function selectShopCoupon(item) {
}
}
const jumpToAddressList = () => {
changeAddress.value = true;
wx.navigateTo({
url: '/pages/address/addressList',
});
......@@ -377,6 +395,7 @@ const payNow = async (data) => {
groupBuyCreate(qgParams).then((res) => {
if (res.code === 0) {
openUrl(res.data.result);
xma.removeStorageSync('address');
} else {
groupBuyConfirmFn(prodIds.value, skuIds.value);
}
......@@ -385,6 +404,7 @@ const payNow = async (data) => {
znsgyOrderCreate(params.value).then((res) => {
if (res.code === 0) {
openUrl(res.data.result);
xma.removeStorageSync('address');
} else {
sgyrddBasketConfirmFn(basketIds.value);
}
......
......@@ -117,7 +117,7 @@ const getPresaleCategoryList = () => {
getPresaleCategory().then((res) => {
res.data.forEach((item) => {
item.img = import.meta.env.VITE_APP_IMG_URL + item.pic;
item.commodityList = item.prodSimples;
item.commodityList = item.prodSimples.splice(0, 3);
item.commodityList.forEach((item) => {
item.commodityImg = import.meta.env.VITE_APP_IMG_URL + item.pic;
});
......
......@@ -404,14 +404,14 @@ page {
width: 360rpx;
display: flex;
flex-direction: row;
height: 442rpx;
}
.wt-item {
border-radius: 8px 8px 8px 8px;
border-radius: 16rpx 16rpx 16rpx 16rpx;
margin-bottom: 15rpx;
background-color: #ffffff;
margin-left: 10rpx;
height: max-content;
}
.item-img image {
......
......@@ -289,7 +289,6 @@ onShow(() => {
onPullDownRefresh(() => {
initDataList().then(() => {
getList();
xma.stopPullDownRefresh();
});
});
......@@ -332,6 +331,7 @@ const getList = async () => {
mask: true,
});
const res = await getOrderList(catalog);
xma.stopPullDownRefresh();
if (res.data.records.length < catalog.size) {
isEnd.value = true;
}
......@@ -601,9 +601,15 @@ const handleAfterSales = (item) => {
};
/**
* 申请退款
* 申请退款 商品类型,0-普通商品,5-团购,6-套餐,7-预售,8-售券 9-景点,10-旅游路线
*/
const handleRefund = (item) => {
if (item.prodType === 7) {
xma.navigateTo({
url: `/pages/assistingAgriculture/order/refund?orderNumber=${item.orderNumber}`,
});
return;
}
xma.navigateTo({
url: `/pages/order/refund?orderNumber=${item.orderNumber}`,
});
......@@ -709,6 +715,7 @@ page {
padding: 0 30rpx;
gap: 14rpx;
}
.searchBoxs {
width: 420rpx;
height: 66rpx;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment