This commit is contained in:
zmj 2024-06-27 20:15:39 +08:00
parent ab6162d558
commit 3ecad90fd6
8 changed files with 155 additions and 54 deletions

View File

@ -146,3 +146,7 @@ export const getloginSms = (data) => {
export const getReportingSms = (data) => {
return request.post('/user/user/reporting_sms', data);
}
export const uploadImg = (data) => {
return request.post('/Upload/image', data);
}

View File

@ -5,14 +5,14 @@
<view class="content-modal">系统检测到您未绑定手机号, 为方便您继续使用, 请绑定手机号码</view>
<view class="btn-box-modal">
<view style="width: 130rpx;"><up-button @click="close" plain color="#999">取消绑定</up-button></view>
<view style="width: 350rpx;"><up-button @getphonenumber="change" open-type="getPhoneNumber" color="#20B128">立即绑定</up-button></view>
<view style="width: 350rpx;"><up-button @getphonenumber="change" open-type="getPhoneNumber"
color="#20B128">立即绑定</up-button></view>
</view>
</view>
</up-popup>
</template>
<script setup>
const props = defineProps({
show: {
type: Boolean,
@ -28,23 +28,25 @@
const change = (e) => {
emit('change', e);
}
</script>
<style scoped lang="scss">
.m-modal-popup {
width: 500rpx;
padding: 40rpx;
.head-title-modal {
font-size: 32rpx;
text-align: center;
}
.content-modal {
font-size: 26rpx;
color: #999;
text-align: center;
padding: 40rpx 0;
}
.btn-box-modal {
display: flex;
justify-content: space-between;

View File

@ -81,7 +81,6 @@
})
const valChange = () => {
console.log(4545)
uni.vibrateShort();
}

View File

@ -220,7 +220,7 @@
</view>
</view>
<view class="btn">
<up-button color="#20b128" :disabled="cartInfo.pay_price<=0" @click="settleAccounts"> 结算</up-button>
<up-button color="#20b128" :disabled="cartInfo.pay_price<=0" @click="settleAccounts"> 支付</up-button>
</view>
<view class="cart" @click="navTo(`/pages/cart/cart`)">
<image src="@/static/icon/cart.png"></image>
@ -237,11 +237,11 @@
温馨提示
</view>
<view class="rect-contetn">
只需再购买 {{500- cartInfo.pay_price}} 就能拥有10%的品牌礼品券若错过此次机会则无礼品券
只需再凑满 {{500- cartInfo.pay_price}} 即可享受采购金额10%的品牌礼品兑换券错过此次机会则无礼品券
</view>
<view class="rect-btn">
<view style="width: 236rpx;">
<up-button @click="abandActive">放弃优惠</up-button>
<up-button @click="abandActive">放弃礼品券</up-button>
</view>
<view style="width: 236rpx;">
<up-button color="#20b128" @click="showOverlay=false">继续采购</up-button>
@ -586,6 +586,9 @@
}
}
})
if (!url) return;
uni.navigateTo({
url: url
})
@ -596,6 +599,8 @@
const goodRef = ref(null);
const goodData = ref({});
const openGoodPopup = (item) => { // /
navTo(false)
if (!userStore.token || !userStore.userInfo.mobile) return;
goodData.value = item;
goodRef.value.setData(item);
showGoodPopup.value = true;

View File

@ -43,7 +43,7 @@
<image class="bg" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/e3a7b202404261113002322.webp"
mode="widthFix"></image>
<view class="u-card">
<view style="display: flex;">
<view style="display: flex;" @click="updataInfp">
<up-avatar :src="userInfo.avatar" size="56"></up-avatar>
<view class="content">
<view class="u-phone">{{userInfo.nickname}}</view>
@ -139,10 +139,38 @@
</up-cell-group>
</view>
</view>
<up-popup :show="showPop" @close="showPop=false" @open="showPop=true">
<view class="popContent">
<view style="text-align: center;font-size: 30rpx;font-weight: bold;">
修改个人信息
</view>
<up-form labelPosition="left">
<up-form-item label="呢称" prop="userInfo.name" borderBottom ref="item1">
<up-input v-model="formData.nick_name" border="none" placeholder="请输入个人呢称"></up-input>
</up-form-item>
<up-form-item label="头像" prop="userInfo.sex" borderBottom ref="item1">
<up-image :src="formData.avatar" width="80px" height="80px" @click="uploadAvatar"></up-image>
</up-form-item>
</up-form>
<view style="display: flex;margin-top: 40rpx;justify-content: space-around;">
<view style="width: 200rpx;">
<up-button color="#20b128" @click="updataFn">保存</up-button>
</view>
<view style="width: 200rpx;">
<up-button @click="showPop=false">取消</up-button>
</view>
</view>
<!-- <button></button> -->
</view>
</up-popup>
</template>
<script setup>
import {
reactive,
ref
} from "vue";
import useUserStore from "@/store/user";
@ -154,13 +182,21 @@
onPullDownRefresh
} from "@dcloudio/uni-app"
import {
userInfoApi
userInfoApi,
uploadImg,
loginUpdateUserApi
} from "@/api/user.js"
import {
config
} from "@/config/app.js"
console.log()
const userStore = useUserStore();
const userInfo = ref({});
let token = uni.getStorageSync('token') || ''
const orderCount = ref({
no_pay: 0,
receiving: 0,
@ -197,7 +233,56 @@
}
const showPop = ref(false)
const updataInfp = () => {
console.log(5454)
showPop.value = true
}
const formData = reactive({
nick_name: "",
avatar: ""
})
const updataFn = () => {
loginUpdateUserApi({
nickname: formData.nick_name,
avatar: formData.avatar
}).then(res => {
uni.$u.toast('修改成功');
showPop.value = false
userInfoApi().then(res => {
userInfo.value = res.data;
})
})
}
const uploadAvatar = () => {
uni.chooseImage({
success: (chooseImageRes) => {
uni.showLoading({
title: '上传中...'
});
const tempFilePaths = chooseImageRes.tempFilePaths;
uni.uploadFile({
url: config.HTTP_REQUEST_URL + '/api/Upload/image', //
filePath: tempFilePaths[0],
name: 'file',
header: {
token: token,
},
success: (uploadFileRes) => {
let data = JSON.parse(uploadFileRes.data)
formData.avatar = data.data.uri
uni.hideLoading()
}
});
}
});
}
const logout = () => {
@ -213,6 +298,9 @@
onShow(() => {
userInfoApi().then(res => {
userInfo.value = res.data;
formData.avatar = res.data.avatar
formData.nick_name = res.data.nickname
})
getOrderCount();
})
@ -429,6 +517,9 @@
overflow: hidden;
}
.popContent {
padding: 30rpx 20rpx 50rpx 20rpx;
}
.gift {
width: 710rpx;

View File

@ -81,7 +81,7 @@
const type = ref(1) // 1 2
const onKetDown = (e) => {
uni.vibrateLong();
uni.vibrateShort();
if (type.value == 1) {
form.password.length < 6 ?
form.password += e :

View File

@ -149,7 +149,7 @@
<view class="submit-row">
<view class="tips">
<view style="margin-right: 20rpx;"> {{ cartList.length }} </view>
<view style="margin-right: 20rpx;transform: translateY(5rpx);"> {{ cartList.length }} </view>
<view class="all">
<text style="color: #000;">合计: </text>
<text></text>
@ -161,8 +161,7 @@
</view>
</view>
<view style="width: 200rpx;">
<up-button color="#20B128" shape="circle" @click="submitOrder"
:throttleTime="1000">预付款提交</up-button>
<up-button color="#20B128" shape="circle" @click="submitOrder" :throttleTime="1000">支付</up-button>
</view>
</view>
@ -559,6 +558,7 @@
justify-content: space-between;
font-size: 24rpx;
margin-top: 10rpx;
align-items: center;
}
.time {

View File

@ -43,7 +43,7 @@
}
break;
}
uni.vibrateLong();
uni.vibrateShort();
if (refValue.value.length === props.num) {
emits('complete', refValue.value.join(''));
}