Browse Source

上传

master
前端-胡立永 3 months ago
parent
commit
bb5f574f2e
12 changed files with 626 additions and 31 deletions
  1. +14
    -0
      api/model/order.js
  2. +1
    -0
      config.js
  3. +220
    -3
      pages_order/components/list/gourmet/productSelectList.vue
  4. +334
    -0
      pages_order/components/list/gourmet/productSubmit.vue
  5. +11
    -3
      pages_order/components/product/submit.vue
  6. +1
    -1
      pages_order/components/product/submitUnitSelect.vue
  7. +1
    -1
      pages_order/gourmet/gourmetDetail.vue
  8. +12
    -9
      pages_order/order/order.vue
  9. +24
    -9
      pages_order/order/orderDetail.vue
  10. BIN
      static/image/address/icon.png
  11. BIN
      static/image/address/selectIcon.png
  12. +8
    -5
      store/store.js

+ 14
- 0
api/model/order.js View File

@ -3,6 +3,12 @@
// 商城接口
const api = {
// 商品-获取各项提示费用
getOrderPrice : {
url : '/order/getPrice',
method : 'GET',
limit : 500,
},
// 商城-立即兑换商品
createPointsOrder : {
@ -21,6 +27,14 @@ const api = {
showLoading : true,
limit : 1000,
},
// 商城-立即兑换商品,微信支付购买商品
createSumOrder : {
url: '/order/createSumOrder',
method: 'POST',
auth : true,
showLoading : true,
limit : 1000,
},
// 商城-订单列表
getOrderList : {


+ 1
- 0
config.js View File

@ -21,6 +21,7 @@ const config = {
}
// 默认配置
const defaultConfig = {
mapKey : 'JYTBZ-DOY3Q-UCM5O-4FWQR-LCI7S-ZIBD3',//已修改


+ 220
- 3
pages_order/components/list/gourmet/productSelectList.vue View File

@ -39,28 +39,153 @@
</view>
</view>
<view class="unit">
<uv-number-box v-model="item.selectNum" :max="item.num">
<uv-number-box
v-model="selectNumMap[item.id]"
:max="item.num"
>
</uv-number-box>
</view>
</view>
</view>
</uv-checkbox-group>
</view>
<view class="action">
<view class="icon">
<image src="/static/image/cart/2.png" mode=""></image>
<view class="num">{{ checkboxValue.length }}</view>
</view>
<view class="price">
<view class="count">
合计
<view>
<text>{{ totalPrice }}</text>
</view>
</view>
<view class="text">
{{ checkboxValue.length }}已享受最高优惠
</view>
</view>
<view class="btn2" @click="toSubmit">结算</view>
</view>
<productSubmit
ref="productSubmit"
:totalPrice="totalPrice"
:priceList="priceList"
@submit="submit"
/>
</view>
</template>
<script>
import productSubmit from './productSubmit'
import { mapState } from 'vuex'
export default {
components : {
productSubmit,
},
props : {
list : {
default : []
},
},
computed : {
...mapState(['priceMap']),
totalPrice(){//
if(this.checkboxValue.length == 0){
return 0
}
let price = Number(this.priceMap.pei_money) || 0
this.list.forEach(n => {
if(this.checkboxValue.includes(n.id)){
price += (n.price || 0)
* (this.selectNumMap[n.id] || 1)
}
})
return Number(price).toFixed(2)
},
priceList(){
if (this.checkboxValue.length == 0) {
return []
}
let list = []
this.list.forEach(n => {
if (this.checkboxValue.includes(n.id)) {
list.push({
price : n.price,
num : this.selectNumMap[n.id] || 1,
title : n.name,
shopId : n.id,
})
}
})
return list
},
},
data() {
return {
checkboxValue : [],
selectNumMap : {},
};
}
},
methods : {
getDataThen(list){
list.forEach(n => {
if(!this.selectNumMap[n.id]){
this.selectNumMap[n.id] = 1
}
})
},
toSubmit(){
if (this.checkboxValue.length == 0) {
uni.showToast({
title: '请选择商品',
icon: 'none'
})
return
}
this.$refs.productSubmit.open()
},
submit({addressId}){
if(!addressId){
uni.showToast({
title: '请选择地址',
icon: 'none'
})
return
}
this.$api('createSumOrder', {
addressId,
list : JSON.stringify(this.priceList)
}, res => {
if(res.code == 200){
uni.requestPaymentWxPay(res)
.then(res => {
uni.showToast({
title: '下单成功',
icon: 'none'
})
setTimeout(uni.navigateTo, 700, {
url: '/pages_order/order/order'
})
})
}
})
},
},
}
</script>
@ -139,5 +264,97 @@
}
}
}
.action {
width: 700rpx;
position: fixed;
bottom: 60rpx;
left: 25rpx;
background-color: #fff;
height: 130rpx;
border-radius: 65rpx;
box-shadow: 0 0 6rpx 6rpx #00000010;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
z-index: 99;
.icon {
position: relative;
width: 80rpx;
height: 80rpx;
margin: 0 20rpx;
image {
width: 80rpx;
height: 80rpx;
}
.num {
position: absolute;
right: 10rpx;
top: 0rpx;
background-color: $uni-color;
color: #fff;
font-size: 18rpx;
border-radius: 50%;
height: 30rpx;
width: 30rpx;
display: flex;
justify-content: center;
align-items: center;
}
}
.price {
.count {
display: flex;
font-size: 26rpx;
align-items: center;
view {
color: $uni-color;
margin-left: 10rpx;
text {
font-size: 32rpx;
font-weight: 900;
}
}
}
.text {
font-size: 22rpx;
color: #717171;
}
}
.btn2 {
margin-left: auto;
background-color: $uni-color;
height: 100%;
padding: 0 50rpx;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
}
}
.plus-create{
position: fixed;
right: 50rpx;
bottom: 30vh;
background-color: $uni-color;
color: #FFF;
width: 100rpx;
height: 100rpx;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-size: 20rpx;
}
}
</style>

+ 334
- 0
pages_order/components/list/gourmet/productSubmit.vue View File

@ -0,0 +1,334 @@
<template>
<uv-popup ref="popup"
:round="30"
bgColor="#f7f7f7">
<view class="content">
<!-- 地址 -->
<view class="address" @click="openAddress">
<image src="/static/image/address/selectIcon.png" mode=""></image>
<view>
{{ address.name }}
</view>
<view class="">
{{ address.addressDetail }}
</view>
<view class="icon">
<uv-icon size="30rpx" name="arrow-right"></uv-icon>
</view>
</view>
<!-- 优惠劵 -->
<!-- <view style="padding: 0 20rpx;
background-color: #fff;">
<uv-cell
icon="coupon"
title="优惠劵"
iconStyle="font-size: 34rpx;"
rightIconStyle="font-size: 34rpx;"
:value="couponText"
@click="$refs.couponPopup.open('bottom')"
isLink>
</uv-cell>
</view> -->
<!-- <view class="payInfoMessage">
<view style="font-weight: 900;">
下单说明
</view>
<view class="">
租金从物品确认收货开始计算{{ configList.depositPrice }}/
</view>
<view class="">
押金将按照面积计算每平方厘米1
</view>
</view> -->
<!-- 费用明细 -->
<view class="expense-detail">
<view class="title">
费用明细
</view>
<view class="detail" v-if="totalPrice">
<view>
应付款{{ totalPrice }}
</view>
<view>
<view class="">
配送费
</view>
<view class="">
</view>
<view class="">
{{ priceMap.pei_money }}
</view>
</view>
<view
:key="index"
v-for="(item, index) in priceList">
<view class="">
{{ item.title }}
</view>
<view class="">
{{ item.price }}
</view>
<view class="">
x{{ item.num }}
</view>
</view>
</view>
</view>
<!-- 提交按钮 -->
<view class="submit-btn">
<view class="r" @click="orderPay">
{{ submiitTitle }}
</view>
</view>
</view>
<!-- <uv-popup ref="couponPopup"
:round="30">
<couponList
ref="couponList"
height="60vh"
:depositPrice="depositPrice"
:washPrice="washPrice"
:rentPrice="rentPrice"
:useType="0"
@select="selectCoupon" />
</uv-popup> -->
<uv-popup ref="addressPopup" :round="30">
<addressList ref="addressList" height="60vh" @select="selectAddress" />
</uv-popup>
</uv-popup>
</template>
<script>
import addressList from '../../address/addressList.vue'
// import couponList from './couponList.vue'
import { mapState } from 'vuex'
export default {
components: {
addressList,
// couponList,
},
props: {
submiitTitle: {
default: '立即下单',
type: String,
},
totalPrice : {//
default : 0
},
priceList : {//
default : []
},
},
computed : {
...mapState(['configList', 'priceMap']),
},
data() {
return {
address: {
name: '请选择联系人',
addressDetail: '',
},
addressTotal: 0,
coupon : {
// price : 0,
},
couponText : '请选择',
}
},
methods: {
//
open() {
this.$refs.popup.open('bottom')
// this.$refs.couponList.getData()
// this.$refs.couponPopup.close()
//
this.$refs.addressList.getAddressList().then(res => {
this.addressTotal = res.total
if (this.addressTotal != 0) {
this.address = res.records[0]
}
})
},
//
getPrice(){
//
if(this.coupon.couponFlag &&
this.coupon.couponCondition <= this.depositPrice){
return {
coupon : this.coupon.couponPrice,
price : (this.price - this.coupon.couponPrice).toFixed(2),
}
}
//
if(this.coupon.leaseCouponFlag &&
this.coupon.leaseCouponCondition <= this.rentPrice){
return {
coupon : this.coupon.leaseCouponPrice,
price : (this.price - this.coupon.leaseCouponPrice).toFixed(2),
}
}
return {}
},
//
selectCoupon(e){
this.couponText = e.couponName
this.coupon = e
this.$refs.couponPopup.close()
},
//
close() {
this.$refs.popup.close()
},
//
openAddress() {
if (this.addressTotal == 0) {
this.$refs.popup.close()
return uni.navigateTo({
url: '/pages_order/mine/address?type=back'
})
}
this.$refs.addressPopup.open('bottom')
},
//
selectAddress(e) {
this.address = e
this.$refs.addressPopup.close()
},
orderPay() {
this.$emit('submit', {
addressId : this.address.id,
couponId : this.coupon.id
})
},
}
}
</script>
<style scoped lang="scss">
.content {
max-height: 80vh;
overflow: hidden;
overflow-y: auto;
padding-top: 30rpx;
.address {
display: flex;
padding: 20rpx;
background-color: #fff;
margin-bottom: 20rpx;
image {
width: 30rpx;
height: 30rpx;
margin: 20rpx;
}
view {
margin: 20rpx;
overflow: hidden; //
text-overflow: ellipsis; //
white-space: nowrap; //
}
.icon {
margin-left: auto;
}
}
.payInfoMessage{
line-height: 50rpx;
padding: 20rpx;
background-color: #fff;
font-size: 28rpx;
}
.expense-detail {
padding: 30rpx;
background-color: #fff;
font-size: 28rpx;
.title {
font-weight: 600;
}
.detail {
background-color: #F6F6F6;
color: #717171;
margin: 10rpx 0;
padding: 10rpx 20rpx;
line-height: 50rpx;
&>view{
display: flex;
justify-content: space-between;
&>view{
&:nth-child(1){
flex: 4;
overflow:hidden; //
text-overflow:ellipsis; //
white-space:nowrap; //
}
&:nth-child(2){
flex: 2;
text-align: right;
}
&:nth-child(3){
text-align: right;
flex: 1;
}
}
}
}
.coupon{
text-align: center;
color: #5c5;
}
}
.submit-btn {
width: 600rpx;
height: 80rpx;
color: #fff;
border-radius: 40rpx;
font-size: 28rpx;
margin: 20rpx auto;
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>

+ 11
- 3
pages_order/components/product/submit.vue View File

@ -28,8 +28,8 @@
</view> -->
<view class="submit-btn"
@click="$emit('submit')">
<view class="l"
@click="submit">
<view class="r"
v-if="isProductPoint(detail)">
立即兑换
</view>
@ -62,7 +62,15 @@
}
},
methods: {
submit(){
if(this.detail.className == 0){
uni.navigateTo({
url: '/pages_order/gourmet/gourmetDetail?id=' + this.detail.shopId
})
return
}
this.$emit('submit')
},
}
}
</script>


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

@ -85,7 +85,7 @@
<!-- 提交按钮 -->
<view class="submit-btn">
<view class="l"
<view class="r"
v-if="isProductPoint(detail)"
@click="exchange">
立即兑换


+ 1
- 1
pages_order/gourmet/gourmetDetail.vue View File

@ -229,7 +229,7 @@
<style lang="scss" scoped>
.postDetail {
padding-bottom: env(safe-area-inset-bottom);
padding-bottom: calc(env(safe-area-inset-bottom) + 100rpx);
.box {
display: flex;
align-items: center;


+ 12
- 9
pages_order/order/order.vue View File

@ -22,32 +22,33 @@
<view class="top">
<view class="service">
<text>{{item.projectId_dictText}}</text>
<text>{{ item.projectId_dictText }}</text>
<text>{{item.createTime}}</text>
</view>
<view class="status">
<text> {{ tabs[item.state + 1].name }}</text>
</view>
</view>
<view class="content">
<view class="content"
:key="index"
v-for="(good, index) in item.cityOrderSkuList">
<view class="left">
<image mode="aspectFill" :src="item.image"></image>
<image mode="aspectFill" :src="good.image"></image>
</view>
<view class="right">
<view class="text-hidden-1">
客户姓名{{ item.addressName }}
客户姓名{{ good.addressName }}
</view>
<view class="text-hidden-1">
商品名称{{ item.name }}
商品名称{{ good.name }}
</view>
<view class="text-hidden-1">
收货地址{{ item.addressCity + item.addressDetails }}
收货地址{{ good.addressCity + good.addressDetails }}
</view>
<view class="text-hidden-1">
购买数量{{ item.num }}
购买数量{{ good.num }}
</view>
</view>
@ -158,7 +159,9 @@
align-items: center;
font-size: 30rpx;
.service {}
.service {
font-size: 26rpx;
}
.status {
font-size: 26rpx;


+ 24
- 9
pages_order/order/orderDetail.vue View File

@ -45,25 +45,28 @@
<view class="head-title">服务项目</view>
</view>
<view class="flex">
<view class="flex"
v-for="(good, index) in order.cityOrderSkuList">
<view class="server-item">
<view class="img-box">
<image :src="order.image" mode="aspectFill"></image>
<image :src="good.image" mode="aspectFill"></image>
</view>
<view class="server-info">
<view class="server-title">
{{order.name}}
{{good.name}}
<!-- <view class="coupon">领券立减</view> -->
</view>
<view class="current-price">
价格<text class="unit"></text>{{order.price}}
<view class="current-price"
v-if="good.price">
价格<text class="unit"></text>{{good.price}}
</view>
<view class="current-price">
积分{{order.points}}
<view class="current-price"
v-if="good.points">
积分{{good.points}}
</view>
@ -117,6 +120,15 @@
{{ order.price }}
</view>
</view>
<view class="min_tips">
<view class="">
配送费
</view>
<view class="current-price"
v-if="order.peiMoney">
{{ order.peiMoney }}
</view>
</view>
<view class="min_tips">
<view class="">
支付方式
@ -326,6 +338,7 @@
width: calc(100% - 40px);
border-radius: 10px;
.head-title {
font-family: PingFang SC, PingFang SC-Bold;
color: #2f2e2e;
@ -343,7 +356,9 @@
box-sizing: border-box;
margin: 20rpx 0rpx;
width: 100%;
.current-price {
font-size: 24rpx;
}
.img-box {
width: 150rpx;
height: 150rpx;
@ -464,7 +479,7 @@
}
.current-price {
font-size: 30rpx;
font-size: 28rpx;
color: #FD5100;
}


BIN
static/image/address/icon.png View File

Before After
Width: 96  |  Height: 96  |  Size: 4.5 KiB

BIN
static/image/address/selectIcon.png View File

Before After
Width: 28  |  Height: 36  |  Size: 1.3 KiB

+ 8
- 5
store/store.js View File

@ -9,6 +9,7 @@ import api from '@/api/api.js'
const store = new Vuex.Store({
state: {
configList: {}, //配置列表
priceMap : {},//各项费用配置
shop : false,
userInfo : {}, //用户信息
city : {},//当前城市
@ -26,11 +27,13 @@ const store = new Vuex.Store({
mutations: {
// 初始化配置
initConfig(state){
// api('getConfig', res => {
// if(res.code == 200){
// state.configList = res.result
// }
// })
api('getOrderPrice', res => {
if(res.code == 200){
res.result.forEach(n => {
state.priceMap[n.keyValue] = n.price
})
}
})
let config = ['getPrivacyPolicy', 'getUserAgreement']
config.forEach(k => {


Loading…
Cancel
Save