提交 2629d51c authored 作者: 刘旭's avatar 刘旭

优化

上级 9745141f
......@@ -182,8 +182,9 @@ const deleteCart = (index: number) => {
showModel.show = true;
};
// 批量删除
// 批量操作
const tapOptions = () => {
// 删除
if (delCircle.value) {
delIds.value = [];
_.each(checkedGoods.value, (id: any) => {
......@@ -195,6 +196,7 @@ const tapOptions = () => {
});
showModel.show = true;
} else {
// 结算
let storage: any = {
cartId: 0,
addressId: 0,
......
......@@ -162,6 +162,11 @@ const detailId = ref()
onLoad((options: any) => {
detailId.value = options.id
// 在结算中返回时使用
uni.setStorage({
key: 'detailId',
data: options.id
})
initDetails(options.id)
initParts(options.id)
});
......
......@@ -87,7 +87,6 @@ import { checkoutCart, orderSubmit } from '@/api/index';
import config from '@/utils/config';
let baseUrl = config.baseUrl;
const buyNowId = ref(uni.getStorageSync('buyNowId') || 0);
const buyNowData = ref();
const remarks = ref(); // 订单备注
......@@ -108,7 +107,6 @@ const tapAddresss = () => {
// 结算
const onsubmit = () => {
let types = 0;
console.log(type.value, 'type.value');
if (type.value === 'productline' || type.value === 'productLineCart') types = 2;
else types = 0;
let data: object = {
......@@ -191,6 +189,7 @@ onShow(() => {
break;
}
});
</script>
<style lang="scss" scoped>
......
......@@ -102,12 +102,11 @@
import { ref, computed } from 'vue';
import { onLoad, onBackPress } from '@dcloudio/uni-app';
import config from '@/utils/config';
import { useStore, useCurrentStore } from '@/store/useStore';
import { useCurrentStore } from '@/store/useStore';
// import { getOrderPdf } from '@/api/cart';
import { orderDetail, getTax } from '@/api/index';
let baseUrl = config.baseUrl;
let store = useStore();
let currentStore = useCurrentStore();
let enclosure = ref(''); // pdf key值
let detailData = ref();
......@@ -117,6 +116,7 @@ let tax = ref(0); // 税率
onLoad((options: any) => {
type.value = options.type;
console.log(type.value, 'type.value ');
orderDetail({
orderId: options.orderId,
}).then((res: any) => {
......@@ -224,17 +224,19 @@ let initTax = () => {
});
};
onBackPress(() => {
if (type.value === 'productline') {
store.$reset();
uni.reLaunch({
url: '../productLine/productLine',
});
} else if (type.value === 'profile') {
onBackPress((options: any) => {
if (options.from === 'navigateBack') {
return false;
}
if (type.value === 'profile') {
uni.redirectTo({
url: '../order/orderList?showType=' + currentStore.current,
});
} else {
} else if (type.value === 'cart') {
uni.reLaunch({
url: '../cart/index',
});
} else if (type.value === 'goods') {
uni.reLaunch({
url: '../index/index',
});
......
......@@ -426,6 +426,7 @@ let reload = () => {
url: '/' + currPage.route,
});
};
</script>
<style lang="scss" scoped>
......
......@@ -98,12 +98,14 @@
<script setup lang="ts">
import { ref, computed } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import config from '@/utils/config';
import { onLoad, onBackPress } from '@dcloudio/uni-app';
import { getTax, orderDetail } from '@/api/index';
import { quotationInit } from '@/api/cart';
import { getProductLineIndex } from '@/api/productLine';
import { useStore } from '@/store/useStore';
import config from '@/utils/config';
let store = useStore();
let baseUrl = config.baseUrl;
let enclosure = ref(''); // pdf key值
let detailData = ref([] as any);
......@@ -113,10 +115,9 @@ let tax = ref(0); // 税率
onLoad((options: any) => {
type.value = options.type;
orderId.value = options.orderId
orderId.value = options.orderId;
console.log(type.value, 'type.value');
initOrderData(options.orderId);
// initQuotationInit(options.orderId);
// initPdf(options.orderId); // 查询pdf详细资料
initTax(); // 查询税率
});
......@@ -124,6 +125,11 @@ onLoad((options: any) => {
let toIndex = () => {
uni.reLaunch({
url: '../index/index',
success() {
if (type.value === 'productline') {
store.$reset(); // 重置pinia数据
}
},
});
};
......@@ -239,6 +245,41 @@ let initProductLineIndex = (lineId: number) => {
}
});
};
onBackPress((options: any) => {
if (type.value === 'productline') {
if (options.from === 'navigateBack') {
return false;
}
uni.switchTab({
url: './productLine',
success() {
store.$reset(); // 重置pinia数据
let pages = getCurrentPages(); //获取所有页面的数组对象
let currPage: any = pages[pages.length - 1]; //当前页面
uni.reLaunch({
url: '/' + currPage.route,
});
},
});
return true;
} else if (type.value === 'productLineCart') {
if (options.from === 'navigateBack') {
return false;
}
uni.switchTab({
url: '../cart/index',
success() {
let pages = getCurrentPages(); //获取所有页面的数组对象
let currPage: any = pages[pages.length - 1]; //当前页面
uni.reLaunch({
url: '/' + currPage.route,
});
},
});
return true;
}
});
</script>
<style lang="scss" scoped>
......
......@@ -8,26 +8,27 @@ function request(url: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE', data?:
uni.showLoading({
title: '加载中...',
});
if (uni.getStorageSync('token') !== undefined && uni.getStorageSync('token') !== '') {
if (uni.getStorageSync('token')) {
header = {
'content-type': 'application/json',
Authorization: uni.getStorageSync('token'),
};
} else {
let pages = getCurrentPages();
let curRoute = pages[pages.length - 1].route;
if (curRoute != 'pages/login/login') {
uni.showToast({
icon: 'none',
title: '请重新登录',
success() {
uni.navigateTo({
url: '/pages/login/login',
});
},
});
}
}
// else {
// let pages = getCurrentPages();
// let curRoute = pages[pages.length - 1].route;
// if (curRoute != 'pages/login/login') {
// uni.showToast({
// icon: 'none',
// title: '请重新登录',
// success() {
// uni.navigateTo({
// url: '/pages/login/login',
// });
// },
// });
// }
// }
uni.request({
url: baseUrl + url,
method: method,
......@@ -59,7 +60,6 @@ function request(url: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE', data?:
}
},
fail(err: any) {
uni.clearStorage();
uni.hideLoading();
//申请失败
uni.showToast({
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论