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

优化

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