提交 aef55182 authored 作者: 刘旭's avatar 刘旭

优化

上级 4d709ef9
...@@ -3,12 +3,18 @@ import { request } from '@/utils/request'; ...@@ -3,12 +3,18 @@ import { request } from '@/utils/request';
// 用户信息 // 用户信息
export const getAuthInfo = () => request('/wx/auth/info', 'GET'); export const getAuthInfo = () => request('/wx/auth/info', 'GET');
// 更新用户名、 手机号更新密码 // 更新用户名
export const resetNickName = (data: any) => request('/wx/auth/reset_nick_name', 'POST', data); export const resetNickName = (data: any) => request('/wx/auth/reset_nick_name', 'POST', data);
// 更新用户名、 手机号更新密码 // 更新手机号更新密码
export const resetByMobile = (data: any) => request('/wx/auth/reset_by_mobile', 'POST', data); export const resetByMobile = (data: any) => request('/wx/auth/reset_by_mobile', 'POST', data);
// 更新邮箱
export const resetEmail = (data: any) => request('/wx/auth/reset_mail', 'POST', data);
// 更新手机号更新密码
// export const resetByMobile = (data: any) => request('/wx/auth/reset_by_mobile', 'POST', data);
// 更新头像 // 更新头像
export const resetAvatar = (data: any) => request('/wx/auth/reset_avatar', 'POST', data); export const resetAvatar = (data: any) => request('/wx/auth/reset_avatar', 'POST', data);
......
...@@ -39,12 +39,12 @@ let partsIds = ref([] as any) ...@@ -39,12 +39,12 @@ let partsIds = ref([] as any)
let detailId = ref() let detailId = ref()
let selectedGoodsItem = ref('') let selectedGoodsItem = ref('')
let selectedGoodsSum = ref(1) let selectedGoodsSum = ref(1)
let emits = defineEmits(['selected', 'addProduct', 'close-sku']) let emits = defineEmits(['selected', 'addProduct', 'close-sku','partsClose'])
watch([selectedGoodsItem, selectedGoodsSum],(newVal)=> { watch([selectedGoodsItem, selectedGoodsSum],(newVal)=> {
// console.log(newVal); // console.log(newVal);
emits('selected', newVal) emits('selected', newVal)
},{immediate:true}) },{immediate:true})
let onChange = (e: any) => { let onChange = (e: any) => {
selectedGoodsItem.value = e.sku_name_arr selectedGoodsItem.value = e.sku_name_arr
...@@ -81,7 +81,7 @@ let selectParts = (data: any) => { ...@@ -81,7 +81,7 @@ let selectParts = (data: any) => {
} }
// 初始化 把请求数据变成组件需要的格式 // 初始化 把请求数据变成组件需要的格式
let init = (data: any, id: number, partsData: any) => { let init = (data: any, id: number, partsData?: any) => {
detailData.value = data detailData.value = data
detailId.value = id detailId.value = id
let productList: any = []; let productList: any = [];
...@@ -136,7 +136,6 @@ let custom = (selectShop: any) => { ...@@ -136,7 +136,6 @@ let custom = (selectShop: any) => {
let flag = false let flag = false
let customArr: any = [] // 存储选择的自定义的数组 let customArr: any = [] // 存储选择的自定义的数组
goodsInfo.value.spec_list.map((item: any, i: number) => { goodsInfo.value.spec_list.map((item: any, i: number) => {
console.log(item);
if(item.custom) { if(item.custom) {
selectShop.sku_name_arr[i] = item.custom selectShop.sku_name_arr[i] = item.custom
customArr.push(item.custom) customArr.push(item.custom)
...@@ -170,12 +169,14 @@ let addCartFn = (obj: any) => { ...@@ -170,12 +169,14 @@ let addCartFn = (obj: any) => {
partIds: partsIds.value partIds: partsIds.value
}).then((res: any) => { }).then((res: any) => {
if(res.data.code === 200) { if(res.data.code === 200) {
uni.showToast({ uni.showToast({
title: '已添加至购物车', title: '已添加至购物车',
icon: 'none', icon: 'none',
duration: 300, duration: 300,
success() { success() {
goodsInfo.value = {}
emits('partsClose') // 还原
skuPopupRef.value.handClose()
skuKey.value = false skuKey.value = false
} }
}); });
...@@ -241,7 +242,10 @@ let buyNow = (selectShop: any) => { ...@@ -241,7 +242,10 @@ let buyNow = (selectShop: any) => {
}) })
}); });
setTimeout(function() { setTimeout(function() {
skuKey.value = false; goodsInfo.value = {}
emits('partsClose') // 还原
skuPopupRef.value.handClose()
skuKey.value = false
}, 300); }, 300);
} }
}) })
...@@ -255,9 +259,19 @@ let buyNow = (selectShop: any) => { ...@@ -255,9 +259,19 @@ let buyNow = (selectShop: any) => {
const addProduct = (selectShop: any) => { const addProduct = (selectShop: any) => {
skuPopupRef.value.handClose() skuPopupRef.value.handClose()
let productId: any = getProductId(selectShop.sku_name_arr) let productId: any = getProductId(selectShop.sku_name_arr)
let shop = custom(selectShop)
let specifications: any = []
let specificationCustom: any = []
// 有自定义会走下面的逻辑
if(shop.flag) {
productId = 0
selectShop = shop.selectShop
specifications = shop.selectShop.sku_name_arr
specificationCustom = shop.customArr
}
// console.log(selectShop, '加入产品线'); // console.log(selectShop, '加入产品线');
emits('addProduct', selectShop, productId) emits('addProduct', selectShop, productId, specifications, specificationCustom)
emits('close-sku', '') // =在修改规格时使用 emits('close-sku', '') // 在修改规格时使用
goodsInfo.value = {} goodsInfo.value = {}
detailData.value = undefined detailData.value = undefined
detailId.value = undefined detailId.value = undefined
......
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
</u-popup> </u-popup>
</view> </view>
<goodsSku ref="goodsSkuRef" @selected="selected"></goodsSku> <goodsSku ref="goodsSkuRef" @selected="selected" @partsClose='partsClose'></goodsSku>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
...@@ -226,6 +226,14 @@ const buttonClick = () => { ...@@ -226,6 +226,14 @@ const buttonClick = () => {
goodsSkuRef.value.skuKey = true goodsSkuRef.value.skuKey = true
}; };
// 还原配件信息数据
const partsClose = () =>{
partsData.value.forEach((item: any) => {
item.show = false
})
}
// 选择选项卡 // 选择选项卡
const onClickItem = (e: any) => { const onClickItem = (e: any) => {
if (current.value != e.currentIndex) { if (current.value != e.currentIndex) {
......
<template></template> <template>
<view class="app-container">
<u-cell-group>
<block v-for="(item, index) in quotationList" :key="index">
<u-cell-item
icon=""
:title="item.title"
:value="item.value"
:arrow="false"
></u-cell-item>
</block>
</u-cell-group>
</view>
</template>
<script setup lang="ts"> <script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue'; import { ref } from 'vue';
import { quotationInitAgain } from '@/api/cart'; import { quotationInitAgain } from '@/api/cart';
let orderId = ref();
onLoad((options: any) => { onLoad((options: any) => {
orderId.value = options.orderId; orderId.value = options.orderId;
quotationInitAgain({ orderId: orderId.value }).then((res: any) => { quotationInitAgain({ orderId: orderId.value }).then((res: any) => {
if(res.data.code === 200) { if (res.data.code === 200) {
console.log(res); quotationData.value = res.data.data;
quotationList.value = [
{ title: '发货人', value: quotationData.value.quotation.attend },
{ title: '发货联系电话', value: quotationData.value.quotation.tel },
{ title: '发货email', value: quotationData.value.quotation.email },
{ title: '发货地址', value: quotationData.value.quotation.addr },
{ title: '收货公司名称', value: quotationData.value.quotation.toCust },
{ title: '收货人', value: quotationData.value.quotation.quotationAttend },
{ title: '收货email', value: quotationData.value.quotation.quotationEmail },
{ title: '收货联系电话', value: quotationData.value.quotation.quotationTel },
{ title: '交货日期', value: quotationData.value.quotation.deliveryDate },
{ title: '收货地址', value: quotationData.value.quotation.deliveryAddr },
{ title: '订单号', value: quotationData.value.quotation.noOrder },
{ title: '付款方式', value: quotationData.value.quotation.pay },
{ title: '保修', value: quotationData.value.quotation.guarantee },
{ title: '备注', value: quotationData.value.quotation.remarks },
];
console.log(quotationData.value);
console.log(quotationList.value);
} }
}) });
}); });
let orderId = ref();
let quotationData = ref();
let quotationList = ref();
</script> </script>
<style></style> <style lang="scss" scoped>
.app-container {
background-color: #fff;
padding: 20rpx;
}
</style>
...@@ -270,7 +270,7 @@ let orderDel = (orderId: number) => { ...@@ -270,7 +270,7 @@ let orderDel = (orderId: number) => {
orderIds.value = orderId orderIds.value = orderId
} }
// 生成报价 @tap="toDownPdf(res.id)" // 生成报价
let orderQuotation = (orderId: number) => { let orderQuotation = (orderId: number) => {
orderIds.value = orderId orderIds.value = orderId
quotationExist({ orderId }).then((res: any) => { quotationExist({ orderId }).then((res: any) => {
......
...@@ -146,7 +146,7 @@ let buttonGroup = ref([ ...@@ -146,7 +146,7 @@ let buttonGroup = ref([
]); ]);
let addTabs = () => { let addTabs = () => {
categoryRef.value.currentSubCategoryData = [] categoryRef.value.currentSubCategoryData = [];
showPopup.value = true; showPopup.value = true;
categoryRef.value.initIndex(); categoryRef.value.initIndex();
}; };
...@@ -364,7 +364,7 @@ let initCategory = (data: any) => { ...@@ -364,7 +364,7 @@ let initCategory = (data: any) => {
}; };
// 保存到产品线 // 保存到产品线
let addProduct = (data: any, productId: number) => { let addProduct = (data: any, productId: number, specifications: any, specificationCustom: any) => {
let index = lineList.value.length - 1; let index = lineList.value.length - 1;
lineList.value.splice(index, 0, { lineList.value.splice(index, 0, {
name: data.goods_name, name: data.goods_name,
...@@ -372,12 +372,15 @@ let addProduct = (data: any, productId: number) => { ...@@ -372,12 +372,15 @@ let addProduct = (data: any, productId: number) => {
goodsId: data.goods_id, goodsId: data.goods_id,
number: data.buy_num, number: data.buy_num,
productId: productId, productId: productId,
specifications,
specificationCustom,
show: false, show: false,
status: 1, status: 1,
}); });
store.$patch({ store.$patch({
lineData: lineList.value, lineData: lineList.value,
}); });
console.log(store.lineData, 'store.lineData');
goodsSkuRef.value.skuKey = false; goodsSkuRef.value.skuKey = false;
}; };
......
...@@ -27,16 +27,11 @@ ...@@ -27,16 +27,11 @@
</u-upload> </u-upload>
</template> </template>
</u-cell-item> </u-cell-item>
<u-cell-item <u-cell-item icon="" title="姓名" :value="userData.nickName" @click="setName"></u-cell-item>
icon=""
title="姓名"
:value="userData.nickName"
@click="setName"
></u-cell-item>
<u-cell-item icon="" title="密码设置" :value="userData.pwd" @click="setPwd"></u-cell-item> <u-cell-item icon="" title="密码设置" :value="userData.pwd" @click="setPwd"></u-cell-item>
<u-cell-item icon="" title="手机号" :value="userData.mobile"></u-cell-item> <u-cell-item icon="" title="手机号" :value="userData.mobile"></u-cell-item>
<u-cell-item icon="" title="昵称" value="七妹"></u-cell-item> <u-cell-item icon="" title="编码" value="七妹"></u-cell-item>
<u-cell-item icon="" title="邮箱" value="userData"></u-cell-item> <u-cell-item icon="" title="邮箱" :value="userData.email" @click="setEmail"></u-cell-item>
</u-cell-group> </u-cell-group>
<u-button style="margin-top: 100rpx;" @tap="openModel">退出当前用户</u-button> <u-button style="margin-top: 100rpx;" @tap="openModel">退出当前用户</u-button>
...@@ -51,17 +46,11 @@ ...@@ -51,17 +46,11 @@
<u-popup v-model="options.showPopup" mode="center" height="22%" width="80%"> <u-popup v-model="options.showPopup" mode="center" height="22%" width="80%">
<view style="padding: 30rpx; height: 100%; margin-top: 0%;"> <view style="padding: 30rpx; height: 100%; margin-top: 0%;">
<view style="font-size: 34rpx; width: 100%; text-align: center; margin-bottom: 20rpx;"> <view style="font-size: 34rpx; width: 100%; text-align: center; margin-bottom: 20rpx;">
设置用户名 {{ title }}
</view> </view>
<u-form label-width="110"> <u-form label-width="110">
<u-form-item label="用户名:"> <u-form-item :label="label">
<u-input <u-input v-model="nameValue" :border="true" clearable placeholder="请输入" />
v-model="nameValue"
:type="type"
:border="true"
clearable
placeholder="请输入用户名"
/>
</u-form-item> </u-form-item>
</u-form> </u-form>
<u-button :maxlength="11" type="error" style="margin-top: 8%;" @tap="nameSave"> <u-button :maxlength="11" type="error" style="margin-top: 8%;" @tap="nameSave">
...@@ -107,17 +96,19 @@ ...@@ -107,17 +96,19 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, getCurrentInstance } from 'vue'; import { ref, reactive, getCurrentInstance } from 'vue';
import { getAuthInfo, resetNickName, resetByMobile } from '@/api/profile'; import { getAuthInfo, resetNickName, resetByMobile, resetEmail } from '@/api/profile';
import config from '@/utils/config'; import config from '@/utils/config';
let ctx: any = getCurrentInstance(); let ctx: any = getCurrentInstance();
let $u = ctx.appContext.config.globalProperties.$u; let $u = ctx.appContext.config.globalProperties.$u;
let title = ref('')
let label = ref('')
let userData = ref({ let userData = ref({
avatar: '', avatar: '',
nickName: '', nickName: '',
mobile: '', mobile: '',
phone: '', phone: '',
email: ''
}); });
let uploadRef = ref() let uploadRef = ref()
let action = ref(config.baseUrl + '/wx/auth/reset_avatar'); let action = ref(config.baseUrl + '/wx/auth/reset_avatar');
...@@ -137,6 +128,15 @@ let openModel = () => { ...@@ -137,6 +128,15 @@ let openModel = () => {
options.show = true; options.show = true;
}; };
let setName = () => { let setName = () => {
label.value = '用户名:'
title.value = '设置用户名'
nameValue.value = userData.value.nickName
options.showPopup = true;
};
let setEmail = () => {
label.value = '邮箱:'
title.value = '设置邮箱'
nameValue.value = userData.value.email
options.showPopup = true; options.showPopup = true;
}; };
let setPwd = () => { let setPwd = () => {
...@@ -151,31 +151,53 @@ let success = (res: any) => { ...@@ -151,31 +151,53 @@ let success = (res: any) => {
}; };
let nameSave = () => { let nameSave = () => {
switch(label.value) {
case '邮箱:':
save(() => {
resetEmail({ email: nameValue.value }).then((res: any) => {
if (res.data.code === 200) {
nameValue.value = '';
options.showPopup = false;
init();
}
});
})
break;
case '用户名:':
save(() => {
resetNickName({ nickName: nameValue.value }).then((res: any) => {
if (res.data.code === 200) {
nameValue.value = '';
options.showPopup = false;
init();
}
});
})
break
}
};
let save = (func: Function) => {
if (nameValue.value) { if (nameValue.value) {
resetNickName({ nickName: nameValue.value }).then((res: any) => { func()
if (res.data.code === 200) {
nameValue.value = '';
options.showPopup = false;
init();
}
});
} else { } else {
uni.showToast({ uni.showToast({
title: '请输入用户名', title: '请输入' + label.value,
icon: 'none', icon: 'none',
}); });
} }
}; }
let pwdSave = () => { let pwdSave = () => {
if (!oldPwd.value) if (!oldPwd.value)
return uni.showToast({ return uni.showToast({
title: '请输入密码', title: '请输入密码',
icon: 'none', icon: 'none',
}); });
if (!newPwd.value) if (!newPwd.value)
return uni.showToast({ return uni.showToast({
title: '请输入密码', title: '请输入确认密码',
icon: 'none', icon: 'none',
}); });
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论