Browse Source

上传跳转预约订单

master
前端-胡立永 8 months ago
parent
commit
0909e424bd
10 changed files with 173 additions and 56 deletions
  1. +13
    -1
      api/api.js
  2. +13
    -1
      pages/index/center.vue
  3. +1
    -1
      pages_order/components/product/cartAction.vue
  4. +16
    -2
      pages_order/components/product/submit.vue
  5. +6
    -8
      pages_order/components/product/submitUnitSelect.vue
  6. +33
    -9
      pages_order/mine/cart.vue
  7. +28
    -6
      pages_order/mine/collect.vue
  8. +33
    -12
      pages_order/product/productDetail.vue
  9. +1
    -0
      pages_order/product/productList.vue
  10. +29
    -16
      store/store.js

+ 13
- 1
api/api.js View File

@ -236,7 +236,7 @@ const config = {
// 添加购物车 // 添加购物车
addShopcar: { addShopcar: {
url: '/wares/addShopcar', url: '/wares/addShopcar',
method: 'POST',
method: 'GET',
showLoading: true, showLoading: true,
}, },
// 获取购物车列表 // 获取购物车列表
@ -245,6 +245,18 @@ const config = {
method: 'GET', method: 'GET',
showLoading: true, showLoading: true,
}, },
// 取消购物车
deleteShopcar: {
url: '/wares/deleteShopcar',
method: 'GET',
showLoading: true,
},
// 修改购物车信息
updateShopcar: {
url: '/wares/updateShopcar',
method: 'GET',
showLoading: true,
},
} }


+ 13
- 1
pages/index/center.vue View File

@ -64,7 +64,7 @@
</uv-cell> </uv-cell>
<!-- 购物车 --> <!-- 购物车 -->
<uv-cell icon="setting-fill" title="购物车"
<uv-cell icon="setting-fill" title="我的购物车"
@click="$utils.navigateTo('/pages_order/mine/cart')" @click="$utils.navigateTo('/pages_order/mine/cart')"
isLink> isLink>
<template #icon> <template #icon>
@ -81,6 +81,15 @@
class="uv-cell-icon"></image> class="uv-cell-icon"></image>
</template> </template>
</uv-cell> </uv-cell>
<!-- 退出登录 -->
<uv-cell icon="setting-fill" title="退出登录"
isLink @click="$store.commit('logout')">
<template #icon>
<image src="/static/image/center/4.png"
class="uv-cell-icon"></image>
</template>
</uv-cell>
</uv-cell-group> </uv-cell-group>
</view> </view>
@ -98,6 +107,9 @@
show: false, show: false,
} }
}, },
onShow() {
this.$store.commit('getUserInfo')
},
methods: { methods: {
} }


+ 1
- 1
pages_order/components/product/cartAction.vue View File

@ -38,7 +38,7 @@
let price = 0 let price = 0
this.cartList.forEach(n => { this.cartList.forEach(n => {
if (this.cartCheckboxValue.includes(n.id)) { if (this.cartCheckboxValue.includes(n.id)) {
price += n.price * n.num
price += n.waresPrice * (n.num || 1)
} }
}) })
return price return price


+ 16
- 2
pages_order/components/product/submit.vue View File

@ -13,6 +13,18 @@
</button> </button>
</view> </view>
<view class="" <view class=""
@click="$emit('collect')">
<button
class="share">
<uv-icon
size="40rpx"
name="star"></uv-icon>
<view class="">
收藏
</view>
</button>
</view>
<view class=""
@click="$utils.navigateTo('/page_order/mine/cart')"> @click="$utils.navigateTo('/page_order/mine/cart')">
<button <button
class="share"> class="share">
@ -38,6 +50,9 @@
submiitTitle : { submiitTitle : {
default : '立即购买', default : '立即购买',
type : String, type : String,
},
detail : {
default : {}
} }
}, },
data() { data() {
@ -46,7 +61,6 @@
} }
}, },
methods: { methods: {
} }
} }
</script> </script>
@ -65,7 +79,7 @@
font-size: 24rpx; font-size: 24rpx;
.btn{ .btn{
background: $uni-color; background: $uni-color;
width: 600rpx;
width: 340rpx;
height: 80rpx; height: 80rpx;
color: #fff; color: #fff;
border-radius: 40rpx; border-radius: 40rpx;


+ 6
- 8
pages_order/components/product/submitUnitSelect.vue View File

@ -117,8 +117,8 @@
return { return {
unitIndex : 0, unitIndex : 0,
address : { address : {
name : '请选择联系人',
addressDetail : '',
userName : '请选择联系人',
address : '',
}, },
num : 1, num : 1,
unit : {}, unit : {},
@ -163,12 +163,13 @@
}, },
addCart(){ addCart(){
this.$api('addShopcar', { this.$api('addShopcar', {
id : this.detail.id,
skuId : this.unit.id,
waresId : this.detail.id,
shopcarNumber : this.num,
}, res => { }, res => {
if(res.code == 200){ if(res.code == 200){
uni.showToast({ uni.showToast({
title: '添加成功',
title: res.message,
icon: 'none'
}); });
this.$refs.popup.close() this.$refs.popup.close()
} }
@ -178,15 +179,12 @@
let data = { let data = {
id : this.detail.id,//id id : this.detail.id,//id
skuId : this.unit.id,//id
addressId : this.address.id,//id addressId : this.address.id,//id
sku : this.unit.title,//
num : this.num, num : this.num,
} }
if(this.$utils.verificationAll(data, { if(this.$utils.verificationAll(data, {
skuId : '请选择规格',
addressId : '请选择地址', addressId : '请选择地址',
})){ })){
return return


+ 33
- 9
pages_order/mine/cart.vue View File

@ -13,7 +13,8 @@
:key="index"> :key="index">
<view style="margin-top: 20rpx;"></view> <view style="margin-top: 20rpx;"></view>
<uv-swipe-action-item <uv-swipe-action-item
:options="options">
:options="options"
@click="delCart(item, index)">
<view class="item"> <view class="item">
<view class="checkbox"> <view class="checkbox">
<uv-checkbox <uv-checkbox
@ -26,25 +27,25 @@
<image <image
class="image" class="image"
src="https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg"
:src="item.waresImage"
mode=""></image> mode=""></image>
<view class="info"> <view class="info">
<view class="title"> <view class="title">
<view class=""> <view class="">
{{ item.title }}
{{ item.waresTitle }}
</view> </view>
<view class=""> <view class="">
<uv-number-box v-model="item.num" <uv-number-box v-model="item.num"
@change="valChange"></uv-number-box>
@change="e => valChange(item, e)"></uv-number-box>
</view> </view>
</view> </view>
<view class="unit">
<!-- <view class="unit">
规格{{ item.unit }} 规格{{ item.unit }}
<uv-icon name="arrow-down"></uv-icon> <uv-icon name="arrow-down"></uv-icon>
</view>
</view> -->
<view class="price"> <view class="price">
<text>{{ item.price }}</text>
<text>{{ item.waresPrice }}</text>
</view> </view>
</view> </view>
</view> </view>
@ -82,9 +83,29 @@
computed: { computed: {
...mapState(['cartList', 'cartCheckboxValue']), ...mapState(['cartList', 'cartCheckboxValue']),
}, },
onShow() {
this.$store.commit('getCartList')
},
methods: { methods: {
valChange(){
valChange(item, e){
console.log(e.value);
// this.$api('updateShopcar', {
// id : item.id,
// shopcarNumber : e.value,
// })
},
//
delCart(item, index){
this.$api('deleteShopcar', {
shopcarId : item.id
}, res => {
if(res.code == 200){
this.getData()
uni.showToast({
title: '删除成功',
});
}
})
}, },
} }
} }
@ -93,6 +114,9 @@
<style scoped lang="scss"> <style scoped lang="scss">
.page { .page {
padding-bottom: 200rpx; padding-bottom: 200rpx;
/deep/ .uv-swipe-action{
width: 100%;
}
} }
.user { .user {


+ 28
- 6
pages_order/mine/collect.vue View File

@ -18,7 +18,10 @@
@click="toUrl(item)" @click="toUrl(item)"
> >
<view class="card-img"> <view class="card-img">
<image :src="item.roleHead" mode="aspectFill"></image>
<image :src="item.roleHead
|| item.amusementImage
|| item.experienceImage
|| item.waresImage" mode="aspectFill"></image>
</view> </view>
<view class="iconx"> <view class="iconx">
@ -31,11 +34,16 @@
<view class="card-content"> <view class="card-content">
<view style="display: flex; align-items: center;"> <view style="display: flex; align-items: center;">
<view class="title text-ellipsis">{{ item.roleName }}</view>
<view class="title text-ellipsis">{{ item.roleName
|| item.amusementTitle
|| item.experienceTitle
|| item.waresTitle }}</view>
</view> </view>
<view class="card-content-tag" <view class="card-content-tag"
v-if="item.preTime">
{{ item.preTime || '提前一周预约' }}
v-if="item.preTime || item.experienceOpentime">
{{ item.preTime
|| item.experienceOpentime
|| '提前一周预约' }}
</view> </view>
<view class="tips text-ellipsis-2" <view class="tips text-ellipsis-2"
v-if="item.preInfo"> v-if="item.preInfo">
@ -43,7 +51,10 @@
</view> </view>
<view class="card-content-bottom"> <view class="card-content-bottom">
<view style="color: #FF280C;"> <view style="color: #FF280C;">
{{ item.price }}
{{ item.price
|| item.amusementPrice
|| item.experiencePrice
|| item.waresPrice}}
</view> </view>
<view class="card-content-bottom-one" <view class="card-content-bottom-one"
@click.stop="toPayUrl(item)"> @click.stop="toPayUrl(item)">
@ -110,6 +121,9 @@
}, },
onShow() { onShow() {
this.getData() this.getData()
},
computed : {
}, },
methods: { methods: {
leftClick(){ leftClick(){
@ -130,7 +144,6 @@
if(!r.confirm){ if(!r.confirm){
return return
} }
console.log(r);
self.$api('deleteCollection', { self.$api('deleteCollection', {
collectionId : item.id collectionId : item.id
}, res => { }, res => {
@ -139,6 +152,15 @@
} }
}) })
}, },
getData(){
this.$api(this.mixinsListApi, this.queryParams,
res => {
uni.stopPullDownRefresh()
if(res.code == 200){
this.list = res.result
}
})
},
} }
} }
</script> </script>


+ 33
- 12
pages_order/product/productDetail.vue View File

@ -55,7 +55,10 @@
</view> </view>
<!-- 分享和租赁按钮 --> <!-- 分享和租赁按钮 -->
<submit @submit="$refs.submitUnitSelect.open()" @share="share" />
<submit
:detail="productDetail"
@collect="addCollection"
@submit="$refs.submitUnitSelect.open()" @share="share" />
<!-- 选择规格 --> <!-- 选择规格 -->
<submitUnitSelect ref="submitUnitSelect" :detail="productDetail"/> <submitUnitSelect ref="submitUnitSelect" :detail="productDetail"/>
@ -78,7 +81,9 @@
}, },
onLoad(args) { onLoad(args) {
this.productId = args.id this.productId = args.id
this.queryWaresById()
},
onShow() {
this.getData()
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
return { return {
@ -95,17 +100,33 @@
submit() { submit() {
}, },
queryWaresById() {
getData() {
this.$api('queryWaresById', { this.$api('queryWaresById', {
waresId: this.productId
},
res => {
if (res.code == 200) {
console.log(res);
this.productDetail = res.result
}
})
}
waresId: this.productId
},
res => {
if (res.code == 200) {
console.log(res);
this.productDetail = res.result
}
})
},
//
addCollection(){
this.$api('addCollection', {
itemId : this.productDetail.id,
collectionType : 6,
}, res => {
if(res.code == 200){
this.getData()
uni.showToast({
title: res.message,
icon:'none'
})
}
})
},
} }
} }
</script> </script>


+ 1
- 0
pages_order/product/productList.vue View File

@ -48,6 +48,7 @@
}, },
onShow() { onShow() {
this.getData() this.getData()
this.$store.commit('getCartList')
}, },
onLoad() { onLoad() {
this.queryParams.state = 0 this.queryParams.state = 0


+ 29
- 16
store/store.js View File

@ -15,22 +15,7 @@ const store = new Vuex.Store({
longitude : 0, longitude : 0,
}, },
userInfo : {},//用户信息 userInfo : {},//用户信息
cartList : [//购物车列表
{
id : 1,
title : '桌布租赁',
num : 1,
price : 299,
unit : '120*40*75【桌子尺寸】',
},
{
id : 2,
title : '桌布租赁',
num : 1,
price : 299,
unit : '120*40*75【桌子尺寸】',
},//购物车列表
],
cartList : [],//购物车列表
banner : {}, banner : {},
cartCheckboxValue : [],//选中的购物车 cartCheckboxValue : [],//选中的购物车
spotList : [],//所有的地点 spotList : [],//所有的地点
@ -168,6 +153,21 @@ const store = new Vuex.Store({
} }
}, },
// 查询购物车
getCartList(state){
api('queryShopcarList', {
pageNo : 1,
pageSize : 999999999,
}, res => {
if(res.code == 200){
state.cartCheckboxValue = []
res.result.forEach(n => {
state.cartCheckboxValue.push(n.id)
})
state.cartList = res.result
}
})
},
login(state){ login(state){
uni.showLoading({ uni.showLoading({
title: '登录中...' title: '登录中...'
@ -212,6 +212,19 @@ const store = new Vuex.Store({
} }
}) })
}, },
logout(state){
uni.showModal({
title: '确认退出登录吗',
success(r) {
if(r.confirm){
uni.removeStorageSync('token')
uni.redirectTo({
url: '/pages/index/index'
})
}
}
})
},
getPosition(state){ getPosition(state){
Position.getLocation(res => { Position.getLocation(res => {
state.position = res state.position = res


Loading…
Cancel
Save