Browse Source

上传

master
前端-胡立永 4 months ago
parent
commit
309e3b2737
4 changed files with 246 additions and 11 deletions
  1. +1
    -0
      api/api.js
  2. +16
    -11
      pages/index/cart.vue
  3. +6
    -0
      pages/index/index.vue
  4. +223
    -0
      pages_order/mine/updateUserInfo.vue

+ 1
- 0
api/api.js View File

@ -41,6 +41,7 @@ const config = {
url: '/goods/page',
method: 'GET',
showLoading: true,
debounce : 300,
},
// 商品详情
goodsOne: {


+ 16
- 11
pages/index/cart.vue View File

@ -247,18 +247,11 @@
id: res.result.id
}
//
self.$api('cartDel', {
id: deleteCartIds
}, res => {
if (res.code == 200) {
self.getData()
}
})
this.$api('orderPay', form, res => {
if (res.code == 200) {
uni.requestPayment({
provider: 'wxpay', //
timeStamp: res.result.timeStamp, //
@ -268,13 +261,14 @@
paySign: res.result.paySign, //
success: function(res) {
console.log('支付成功', res);
self.delsCart(deleteCartIds)
uni.redirectTo({
url: '/pages/index/order'
})
},
fail: function(err) {
self.delsCart(deleteCartIds)
console.log('支付失败', err);
// self.$refs.confirmationPopup.close()
uni.showToast({
@ -340,6 +334,17 @@
}
})
},
//
delsCart(deleteCartIds){
//
this.$api('cartDel', {
id: deleteCartIds
}, res => {
if (res.code == 200) {
this.getData()
}
})
},
}
}
</script>


+ 6
- 0
pages/index/index.vue View File

@ -30,6 +30,7 @@
bgColor="#fff"
@search="getGoodsPage"
@custom="getGoodsPage"
@change="searchChange"
placeholder="请输入搜索关键字..."
v-model="queryParams.name"></uv-search>
@ -213,6 +214,11 @@
}
})
},
searchChange(value){
if(!value){
this.getGoodsPage()
}
},
//
getGoodsPage(){
this.$api('goodsPage', this.queryParams, res => {


+ 223
- 0
pages_order/mine/updateUserInfo.vue View File

@ -0,0 +1,223 @@
<template>
<view class='updateUserInfo'>
<!--顶部导航栏-->
<navbar leftClick @leftClick="$utils.navigateBack" title="修改个人信息" />
<!--主页面-->
<view class="frame">
<view class="headImage">
<view style="" class="key">头像</view>
<button style="" class="value" @chooseavatar="onChooseAvatar" open-type="chooseAvatar">
<image :src="form.headImage" v-if="form.headImage" style="width: 150%;height: 100%" mode="">
</image>
<image src="/static/image/tabbar/6.png" v-else style="width: 100%;height: 100%" mode="">
</image>
</button>
</view>
<view class="item">
<view class="label">昵称</view>
<view class="value">
<input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName"
v-model="form.nickName" />
</view>
</view>
<!-- <view class="item" @click="sexChange">
<view class="label">性别</view>
<view>{{form.sex}}</view>
</view> -->
<view class="item">
<view class="label">联系方式</view>
<view class="value">
<uv-input v-model="form.phone" placeholder="联系方式" border="bottom" clearable></uv-input>
</view>
</view>
</view>
<!-- ActionSheet 操作菜单 -->
<uv-action-sheet ref="actionSheet" :actions="sexList" title="性别" @select="select" @close="close">
</uv-action-sheet>
<!--确认修改个人信息按钮-->
<button @click="confirmEditUserInfo" class="bottomBtn">
确认修改
</button>
</view>
</template>
<script>
import '../../common.css'; // CSS
import {
mapState,
mapGetters
} from 'vuex'
export default {
computed: {
...mapState(['userInfo']),
...mapGetters(['isVedio']),
},
data() {
return {
form: {
sex: '',
nickName: '1',
phone: '',
headImage: '',
},
// itemUserImage: userInfo.headImage,
fileList: [],
sexList: [{
name: '男',
value: 1
},
{
name: '女',
value: 0
},
],
}
},
mounted() {
this.form.phone = this.userInfo.phone
this.form.headImage = this.userInfo.headImage
this.form.nickName = this.userInfo.nickName
this.form.sex = this.userInfo.sex
if (this.userInfo.sex == '' || this.userInfo.sex == null) {
this.form.sex = '未知'
}
},
methods: {
onChooseAvatar(res) {
let self = this
console.log(res.target.avatarUrl, "res.target.avatarUrl");
self.$Oss.ossUpload(res.target.avatarUrl)
.then(url => {
console.log(url, "url");
self.form.headImage = url
})
},
//
confirmEditUserInfo() {
let self = this
uni.createSelectorQuery().in(this)
.select("#nickName")
.fields({
properties: ["value"],
})
.exec((res) => {
const nickName = res?.[0]?.value
self.form.nickName = nickName
if (self.$utils.verificationAll(self.form, {
headImage: '请选择头像',
nickName: '请填写昵称'
})) {
return
}
self.$api('infoUpdateInfo', self.form, res => {
if (res.code == 200) {
uni.navigateTo({
url: '/pages/index/index'
})
}
})
})
this.$api('infoUpdateInfo', this.form, res => {
if (res.code == 200) {
uni.navigateTo({
url: '/pages/index/index'
})
}
})
},
sexChange() {
this.$refs.actionSheet.open() //ActionSheet
},
// ActionSheet
select(e) {
console.log('选中该项:', e);
this.form.sex = e.name
this.$refs.actionSheet.close() //
},
// ActionSheet
close() {
this.$refs.actionSheet.close() //
},
}
}
</script>
<style lang="scss" scoped>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.updateUserInfo {
.frame {
padding: 28rpx 28rpx 0 28rpx;
.headImage {
display: flex;
// width: 100vw;
padding: 20rpx;
.key {
width: 500rpx;
display: flex;
align-items: center;
}
.value {
border-radius: 50rpx;
border: 1px solid red;
box-sizing: border-box;
overflow: hidden;
width: 100rpx;
height: 100rpx;
}
}
.item {
display: flex;
justify-content: space-between;
// border-bottom: 1px solid #c9c9c9;
margin-top: 20rpx;
padding: 20rpx;
.label {
width: 50%;
}
.value {
width: 50%;
text-align: right;
}
}
}
}
/deep/ .input__content {
/deep/.uv-input__content__field-wrapper {
border: 1px solid red;
input {
text-align: right;
}
}
}
/deep/ .uv-input__content__field-wrapper__field {
text-align: right;
}
</style>

Loading…
Cancel
Save