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

优化

上级 4d709ef9
......@@ -3,12 +3,18 @@ import { request } from '@/utils/request';
// 用户信息
export const getAuthInfo = () => request('/wx/auth/info', 'GET');
// 更新用户名、 手机号更新密码
// 更新用户名
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 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);
......
......@@ -39,12 +39,12 @@ let partsIds = ref([] as any)
let detailId = ref()
let selectedGoodsItem = ref('')
let selectedGoodsSum = ref(1)
let emits = defineEmits(['selected', 'addProduct', 'close-sku'])
let emits = defineEmits(['selected', 'addProduct', 'close-sku','partsClose'])
watch([selectedGoodsItem, selectedGoodsSum],(newVal)=> {
// console.log(newVal);
emits('selected', newVal)
},{immediate:true})
},{immediate:true})
let onChange = (e: any) => {
selectedGoodsItem.value = e.sku_name_arr
......@@ -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
detailId.value = id
let productList: any = [];
......@@ -136,7 +136,6 @@ let custom = (selectShop: any) => {
let flag = false
let customArr: any = [] // 存储选择的自定义的数组
goodsInfo.value.spec_list.map((item: any, i: number) => {
console.log(item);
if(item.custom) {
selectShop.sku_name_arr[i] = item.custom
customArr.push(item.custom)
......@@ -170,12 +169,14 @@ let addCartFn = (obj: any) => {
partIds: partsIds.value
}).then((res: any) => {
if(res.data.code === 200) {
uni.showToast({
title: '已添加至购物车',
icon: 'none',
duration: 300,
success() {
goodsInfo.value = {}
emits('partsClose') // 还原
skuPopupRef.value.handClose()
skuKey.value = false
}
});
......@@ -241,7 +242,10 @@ let buyNow = (selectShop: any) => {
})
});
setTimeout(function() {
skuKey.value = false;
goodsInfo.value = {}
emits('partsClose') // 还原
skuPopupRef.value.handClose()
skuKey.value = false
}, 300);
}
})
......@@ -255,9 +259,19 @@ let buyNow = (selectShop: any) => {
const addProduct = (selectShop: any) => {
skuPopupRef.value.handClose()
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, '加入产品线');
emits('addProduct', selectShop, productId)
emits('close-sku', '') // =在修改规格时使用
emits('addProduct', selectShop, productId, specifications, specificationCustom)
emits('close-sku', '') // 在修改规格时使用
goodsInfo.value = {}
detailData.value = undefined
detailId.value = undefined
......
......@@ -118,7 +118,7 @@
</u-popup>
</view>
<goodsSku ref="goodsSkuRef" @selected="selected"></goodsSku>
<goodsSku ref="goodsSkuRef" @selected="selected" @partsClose='partsClose'></goodsSku>
</template>
<script lang="ts" setup>
......@@ -226,6 +226,14 @@ const buttonClick = () => {
goodsSkuRef.value.skuKey = true
};
// 还原配件信息数据
const partsClose = () =>{
partsData.value.forEach((item: any) => {
item.show = false
})
}
// 选择选项卡
const onClickItem = (e: any) => {
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">
import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue';
import { quotationInitAgain } from '@/api/cart';
let orderId = ref();
onLoad((options: any) => {
orderId.value = options.orderId;
quotationInitAgain({ orderId: orderId.value }).then((res: any) => {
if(res.data.code === 200) {
console.log(res);
if (res.data.code === 200) {
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>
<style></style>
<style lang="scss" scoped>
.app-container {
background-color: #fff;
padding: 20rpx;
}
</style>
......@@ -270,7 +270,7 @@ let orderDel = (orderId: number) => {
orderIds.value = orderId
}
// 生成报价 @tap="toDownPdf(res.id)"
// 生成报价
let orderQuotation = (orderId: number) => {
orderIds.value = orderId
quotationExist({ orderId }).then((res: any) => {
......
......@@ -146,7 +146,7 @@ let buttonGroup = ref([
]);
let addTabs = () => {
categoryRef.value.currentSubCategoryData = []
categoryRef.value.currentSubCategoryData = [];
showPopup.value = true;
categoryRef.value.initIndex();
};
......@@ -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;
lineList.value.splice(index, 0, {
name: data.goods_name,
......@@ -372,12 +372,15 @@ let addProduct = (data: any, productId: number) => {
goodsId: data.goods_id,
number: data.buy_num,
productId: productId,
specifications,
specificationCustom,
show: false,
status: 1,
});
store.$patch({
lineData: lineList.value,
});
console.log(store.lineData, 'store.lineData');
goodsSkuRef.value.skuKey = false;
};
......
......@@ -27,16 +27,11 @@
</u-upload>
</template>
</u-cell-item>
<u-cell-item
icon=""
title="姓名"
:value="userData.nickName"
@click="setName"
></u-cell-item>
<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.mobile"></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="七妹"></u-cell-item>
<u-cell-item icon="" title="邮箱" :value="userData.email" @click="setEmail"></u-cell-item>
</u-cell-group>
<u-button style="margin-top: 100rpx;" @tap="openModel">退出当前用户</u-button>
......@@ -51,17 +46,11 @@
<u-popup v-model="options.showPopup" mode="center" height="22%" width="80%">
<view style="padding: 30rpx; height: 100%; margin-top: 0%;">
<view style="font-size: 34rpx; width: 100%; text-align: center; margin-bottom: 20rpx;">
设置用户名
{{ title }}
</view>
<u-form label-width="110">
<u-form-item label="用户名:">
<u-input
v-model="nameValue"
:type="type"
:border="true"
clearable
placeholder="请输入用户名"
/>
<u-form-item :label="label">
<u-input v-model="nameValue" :border="true" clearable placeholder="请输入" />
</u-form-item>
</u-form>
<u-button :maxlength="11" type="error" style="margin-top: 8%;" @tap="nameSave">
......@@ -107,17 +96,19 @@
<script setup lang="ts">
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';
let ctx: any = getCurrentInstance();
let $u = ctx.appContext.config.globalProperties.$u;
let title = ref('')
let label = ref('')
let userData = ref({
avatar: '',
nickName: '',
mobile: '',
phone: '',
email: ''
});
let uploadRef = ref()
let action = ref(config.baseUrl + '/wx/auth/reset_avatar');
......@@ -137,6 +128,15 @@ let openModel = () => {
options.show = true;
};
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;
};
let setPwd = () => {
......@@ -151,31 +151,53 @@ let success = (res: any) => {
};
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) {
resetNickName({ nickName: nameValue.value }).then((res: any) => {
if (res.data.code === 200) {
nameValue.value = '';
options.showPopup = false;
init();
}
});
func()
} else {
uni.showToast({
title: '请输入用户名',
title: '请输入' + label.value,
icon: 'none',
});
}
};
}
let pwdSave = () => {
if (!oldPwd.value)
return uni.showToast({
title: '请输入密码',
title: '请输入密码',
icon: 'none',
});
if (!newPwd.value)
return uni.showToast({
title: '请输入密码',
title: '请输入确认密码',
icon: 'none',
});
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论