Browse Source

上传

master
前端-胡立永 6 months ago
parent
commit
b72e5560d2
9 changed files with 406 additions and 51 deletions
  1. +18
    -13
      api/api.js
  2. +59
    -0
      components/list/h-list.vue
  3. +1
    -1
      manifest.json
  4. +4
    -1
      pages_order/components/product/productList.vue
  5. +20
    -14
      pages_order/components/product/submit.vue
  6. +117
    -14
      pages_order/components/product/submitUnitSelect.vue
  7. +174
    -6
      pages_order/mine/collect.vue
  8. +7
    -1
      pages_order/product/productDetail.vue
  9. +6
    -1
      pages_order/service/reservationDetail.vue

+ 18
- 13
api/api.js View File

@ -190,21 +190,15 @@ const config = {
method: 'POST',
showLoading: true,
},
// 获取收藏列表
queryCollectionList: {
url: '/user/queryCollectionList',
method: 'GET',
showLoading: true,
},
// 添加购物车
addShopcar: {
url: '/user/addShopcar',
// 取消收藏
deleteCollection: {
url: '/user/deleteCollection',
method: 'POST',
showLoading: true,
},
// 获取购物车列表
queryShopcarList: {
url: '/user/queryShopcarList',
// 获取收藏列表
queryCollectionList: {
url: '/user/queryCollectionList',
method: 'GET',
showLoading: true,
},
@ -239,7 +233,18 @@ const config = {
method: 'GET',
showLoading: true,
},
// 添加购物车
addShopcar: {
url: '/wares/addShopcar',
method: 'POST',
showLoading: true,
},
// 获取购物车列表
queryShopcarList: {
url: '/wares/queryShopcarList',
method: 'GET',
showLoading: true,
},
}


+ 59
- 0
components/list/h-list.vue View File

@ -0,0 +1,59 @@
<template>
<scroll-view
scroll-y="true"
:style="{height: height}"
@scrolltolower="$emit('loadMoreData')">
<uv-empty
v-if="!list || !list.length"
:text="emptyText"
textSize="30rpx"
iconSize="200rpx"
:icon="emptyImage"></uv-empty>
<template
v-else
v-for="(item, index) in list">
<slot
:index="index"
:item="item">
<view class="">
未定义内容
</view>
</slot>
</template>
</scroll-view>
</template>
<script>
export default {
props : {
height : {
default : 'auto'
},
list : {
default : [],
},
emptyImage : {
default : 'list'
},
emptyText : {
default : '空空如也!'
},
textColor : {
default : '#c0c4cc'
}
},
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

+ 1
- 1
manifest.json View File

@ -1,5 +1,5 @@
{
"name" : "unapp模板",
"name" : "遗产里的景徳镇",
"appid" : "__UNI__197A38F",
"description" : "",
"versionName" : "1.0.0",


+ 4
- 1
pages_order/components/product/productList.vue View File

@ -1,7 +1,10 @@
<template>
<view class="list">
<view class="item" v-for="(item, index) in list.records" @click="gotoProductDetail(item.id)" :key="index">
<image class="image" :src="item.waresImage" mode="aspectFill"></image>
<image class="image"
:src="item.waresImage &&
item.waresImage.split(',')[0]"
mode="aspectFill"></image>
<view class="info">
<view class="title">
{{item.waresTitle}}


+ 20
- 14
pages_order/components/product/submit.vue View File

@ -2,21 +2,27 @@
<view class="submit">
<view class=""
@click="$emit('share')">
<uv-icon
size="40rpx"
name="share-square"></uv-icon>
<view class="">
分享
</view>
<button open-type="share"
class="share">
<uv-icon
size="40rpx"
name="share-square"></uv-icon>
<view class="">
分享
</view>
</button>
</view>
<view class=""
@click="$utils.navigateTo('/index/cart')">
<uv-icon
size="40rpx"
name="shopping-cart"></uv-icon>
<view class="">
购物车
</view>
@click="$utils.navigateTo('/page_order/mine/cart')">
<button
class="share">
<uv-icon
size="40rpx"
name="shopping-cart"></uv-icon>
<view class="">
购物车
</view>
</button>
</view>
<view class="btn"
@click="$emit('submit')">
@ -30,7 +36,7 @@
name:"submit",
props : {
submiitTitle : {
default : '立即租赁',
default : '立即购买',
type : String,
}
},


+ 117
- 14
pages_order/components/product/submitUnitSelect.vue View File

@ -9,10 +9,10 @@
@click="openAddress">
<image src="../../static/address/selectIcon.png" mode=""></image>
<view class="">
{{ address.name }}
{{ address.userName }}
</view>
<view class="">
{{ address.addressDetail }}
{{ address.address }}
</view>
<view class="icon">
<uv-icon
@ -29,12 +29,13 @@
<view class="box">
<image
class="image"
src="https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg"
:src="detail.waresImage &&
detail.waresImage.split(',')[0]"
mode=""></image>
<view class="info">
<view class="price">
<text>299</text>
<text>{{ detail.waresPrice }}</text>
</view>
<view class="unit">
请选择规格
@ -47,35 +48,42 @@
</view>
<!-- 规格 -->
<view class="submit-unit">
<!-- <view class="submit-unit">
<view class="title">
规格选择
</view>
<view class="list">
<view :class="{act : unitIndex == index}"
v-for="(item, index) in 10"
v-for="(item, index) in detail.hotelGoodsSkuList"
@click="selectUnit(item, index)"
:key="index">
120*40*75桌子尺寸
{{ item.title }}
</view>
</view>
</view>
</view> -->
<!-- 费用明细 -->
<view class="expense-detail">
<!-- <view class="expense-detail">
<view class="title">
费用明细
</view>
<view class="detail">
押金200
押金{{ unit.depositPrice }}
</view>
</view>
</view> -->
<!-- 提交按钮 -->
<view class="submit-btn">
{{ submiitTitle }}
<view class="l"
@click="addCart">
加入租赁车
</view>
<view class="r"
@click="orderPay">
{{ submiitTitle }}
</view>
</view>
</view>
@ -94,12 +102,15 @@
import addressList from '../address/addressList.vue'
export default {
components : {
addressList
addressList,
},
props : {
submiitTitle : {
default : '立即租赁',
type : String,
},
detail : {
default : {}
}
},
data() {
@ -111,12 +122,21 @@
},
num : 1,
unit : {},
addressTotal : 0,
}
},
methods: {
//
open(){
this.$refs.popup.open('bottom')
//
this.$refs.addressList.getAddressList().then(res => {
this.addressTotal = res.total
if(this.addressTotal != 0){
this.address = res.records[0]
}
})
},
//
close(){
@ -124,6 +144,11 @@
},
//
openAddress(){
if (this.addressTotal == 0) {
return uni.navigateTo({
url: '/pages_order/mine/address'
})
}
this.$refs.addressPopup.open('bottom')
},
//
@ -136,6 +161,68 @@
this.unit = item
this.unitIndex = index
},
addCart(){
this.$api('addShopcar', {
id : this.detail.id,
skuId : this.unit.id,
}, res => {
if(res.code == 200){
uni.showToast({
title: '添加成功',
});
this.$refs.popup.close()
}
})
},
orderPay(){
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
}
this.$api('orderPay', data, res => {
if(res.code == 200){
uni.redirectTo({
url: '/pages/index/order'
})
// uni.requestPayment({
// provider: 'wxpay', //
// timeStamp: res.result.timeStamp, //
// nonceStr: res.result.nonceStr, //
// package: res.result.packageValue,
// signType: res.result.signType, //
// paySign: res.result.paySign, //
// success: function (res) {
// console.log('',res);
// uni.redirectTo({
// url: '/pages/index/order'
// })
// },
// fail: function (err) {
// console.log('',err);
// uni.showToast({
// icon:'none',
// title:""
// })
// }
// });
}
})
},
}
}
</script>
@ -246,7 +333,6 @@
}
}
.submit-btn{
background: $uni-color;
width: 600rpx;
height: 80rpx;
color: #fff;
@ -256,6 +342,23 @@
display: flex;
justify-content: center;
align-items: center;
border: 1rpx solid $uni-color;
overflow: hidden;
.l{
flex: 1;
display: flex;
justify-content: center;
align-items: center;
color: $uni-color;
}
.r{
background: $uni-color;
flex: 1;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
}
}
</style>

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

@ -1,6 +1,6 @@
<template>
<view>
<navbar title="我的收藏" leftClick @leftClick="$utils.navigateBack" />
<navbar title="我的收藏" leftClick @leftClick="leftClick" />
<view style="background-color: #fff;">
<uv-tabs :list="tabs"
@ -10,17 +10,68 @@
@click="clickTabs"></uv-tabs>
</view>
<hList :list="list">
<template
v-slot="{item,index}"
>
<view class="card"
@click="toUrl(item)"
>
<view class="card-img">
<image :src="item.roleHead" mode="aspectFill"></image>
</view>
<view class="iconx">
<uv-icon
name="close-circle-fill"
size="40rpx"
@click="delModel(item)"
color="#B12026"></uv-icon>
</view>
<view class="card-content">
<view style="display: flex; align-items: center;">
<view class="title text-ellipsis">{{ item.roleName }}</view>
</view>
<view class="card-content-tag"
v-if="item.preTime">
{{ item.preTime || '提前一周预约' }}
</view>
<view class="tips text-ellipsis-2"
v-if="item.preInfo">
{{ item.preInfo}}
</view>
<view class="card-content-bottom">
<view style="color: #FF280C;">
{{ item.price }}
</view>
<view class="card-content-bottom-one"
@click.stop="toPayUrl(item)">
线上预约
</view>
</view>
</view>
</view>
</template>
</hList>
</view>
</template>
<script>
import mixinsList from '@/mixins/list.js'
import hList from '@/components/list/h-list.vue'
export default {
components : {
hList
},
mixins : [mixinsList],
data() {
return {
tabs: [
{
name: '文化遗产'
},
// {
// name: ''
// },
{
name: '遗产讲述'
},
@ -43,14 +94,131 @@
name: '文创好物'
},
],
mixinsListApi : 'queryCollectionList',
options: [
{
text: '删除',
style: {
backgroundColor: '#FA5A0A'
}
},
],
}
},
onLoad() {
this.queryParams.collectionType = 0
},
onShow() {
this.getData()
},
methods: {
clickTabs(){},
leftClick(){
uni.navigateBack(-1)
},
clickTabs({ index }){
this.queryParams.collectionType = index
this.getData()
},
toUrl(item){
},
delModel(item){
let self = this
uni.showModal({
title: '确认删除吗?',
success() {
self.$api('deleteCollection', {
collectionId : item.id
}, res => {
self.getData()
})
}
})
},
}
}
</script>
<style>
<style scoped lang="scss">
.card {
display: flex;
width: 710rpx;
margin: 40rpx 20rpx;
align-items: center;
position: relative;
.iconx{
position: absolute;
top: 0rpx;
right: 20rpx;
}
.card-img {
height: 270rpx;
width: 240rpx;
flex-shrink: 0;
image {
height: 100%;
width: 100%;
border-radius: 20rpx;
}
}
.card-content {
margin-left: 3%;
font-size: 28rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
width: 97%;
.title{
max-width: 260rpx;
}
.card-content-img {
display: flex;
margin-left: 10rpx;
width: 130rpx;
height: 50rpx;
}
.card-content-tag {
display: inline-block;
font-size: 24rpx;
padding: 2rpx 20rpx;
border: 2rpx solid #FBA21E;
background-color: #FFF1D2;
color: #FBAF35;
border-radius: 20rpx;
width: fit-content;
}
.tips{
font-size: 24rpx;
color: #999;
}
.card-content-bottom {
display: flex;
justify-content: space-between;
align-items: center;
.card-content-bottom-one {
display: inline-block;
color: #FFFDF6;
background-color: #C83741;
margin-right: 4%;
padding: 12rpx 30rpx;
border-radius: 40rpx;
font-size: 24rpx;
}
}
view {
margin-top: 10rpx;
}
}
}
</style>

+ 7
- 1
pages_order/product/productDetail.vue View File

@ -58,7 +58,7 @@
<submit @submit="$refs.submitUnitSelect.open()" @share="share" />
<!-- 选择规格 -->
<submitUnitSelect ref="submitUnitSelect" />
<submitUnitSelect ref="submitUnitSelect" :detail="productDetail"/>
</view>
</template>
@ -80,6 +80,12 @@
this.productId = args.id
this.queryWaresById()
},
onShareAppMessage(res) {
return {
title: this.productDetail.waresTitle,
path: '/pages_order/product/productDetail?id=' + this.id
}
},
methods: {
//
share() {


+ 6
- 1
pages_order/service/reservationDetail.vue View File

@ -169,11 +169,16 @@
methods: {
addCollection(){
this.$api('addCollection', {
collectionItmeId : this.detail.id,
itemId : this.detail.id,
collectionType : this.collectType[this.type],
}, res => {
if(res.code == 200){
this.getData()
uni.showToast({
title: res.message,
icon:'none'
})
}
})
},


Loading…
Cancel
Save