Browse Source

上传跳转预约订单

master
前端-胡立永 6 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: {
url: '/wares/addShopcar',
method: 'POST',
method: 'GET',
showLoading: true,
},
// 获取购物车列表
@ -245,6 +245,18 @@ const config = {
method: 'GET',
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 icon="setting-fill" title="购物车"
<uv-cell icon="setting-fill" title="我的购物车"
@click="$utils.navigateTo('/pages_order/mine/cart')"
isLink>
<template #icon>
@ -81,6 +81,15 @@
class="uv-cell-icon"></image>
</template>
</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>
</view>
@ -98,6 +107,9 @@
show: false,
}
},
onShow() {
this.$store.commit('getUserInfo')
},
methods: {
}


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

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


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

@ -13,6 +13,18 @@
</button>
</view>
<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')">
<button
class="share">
@ -38,6 +50,9 @@
submiitTitle : {
default : '立即购买',
type : String,
},
detail : {
default : {}
}
},
data() {
@ -46,7 +61,6 @@
}
},
methods: {
}
}
</script>
@ -65,7 +79,7 @@
font-size: 24rpx;
.btn{
background: $uni-color;
width: 600rpx;
width: 340rpx;
height: 80rpx;
color: #fff;
border-radius: 40rpx;


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

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


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

@ -13,7 +13,8 @@
:key="index">
<view style="margin-top: 20rpx;"></view>
<uv-swipe-action-item
:options="options">
:options="options"
@click="delCart(item, index)">
<view class="item">
<view class="checkbox">
<uv-checkbox
@ -26,25 +27,25 @@
<image
class="image"
src="https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg"
:src="item.waresImage"
mode=""></image>
<view class="info">
<view class="title">
<view class="">
{{ item.title }}
{{ item.waresTitle }}
</view>
<view class="">
<uv-number-box v-model="item.num"
@change="valChange"></uv-number-box>
@change="e => valChange(item, e)"></uv-number-box>
</view>
</view>
<view class="unit">
<!-- <view class="unit">
规格{{ item.unit }}
<uv-icon name="arrow-down"></uv-icon>
</view>
</view> -->
<view class="price">
<text>{{ item.price }}</text>
<text>{{ item.waresPrice }}</text>
</view>
</view>
</view>
@ -82,9 +83,29 @@
computed: {
...mapState(['cartList', 'cartCheckboxValue']),
},
onShow() {
this.$store.commit('getCartList')
},
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">
.page {
padding-bottom: 200rpx;
/deep/ .uv-swipe-action{
width: 100%;
}
}
.user {


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

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


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

@ -55,7 +55,10 @@
</view>
<!-- 分享和租赁按钮 -->
<submit @submit="$refs.submitUnitSelect.open()" @share="share" />
<submit
:detail="productDetail"
@collect="addCollection"
@submit="$refs.submitUnitSelect.open()" @share="share" />
<!-- 选择规格 -->
<submitUnitSelect ref="submitUnitSelect" :detail="productDetail"/>
@ -78,7 +81,9 @@
},
onLoad(args) {
this.productId = args.id
this.queryWaresById()
},
onShow() {
this.getData()
},
onShareAppMessage(res) {
return {
@ -95,17 +100,33 @@
submit() {
},
queryWaresById() {
getData() {
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>


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

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


+ 29
- 16
store/store.js View File

@ -15,22 +15,7 @@ const store = new Vuex.Store({
longitude : 0,
},
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 : {},
cartCheckboxValue : [],//选中的购物车
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){
uni.showLoading({
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){
Position.getLocation(res => {
state.position = res


Loading…
Cancel
Save