Browse Source

上传

master
前端-胡立永 4 months ago
parent
commit
701c522e56
18 changed files with 258 additions and 210 deletions
  1. +1
    -1
      api/http.js
  2. +19
    -0
      api/model/index.js
  3. +21
    -3
      api/model/info.js
  4. +7
    -3
      components/product/productItem.vue
  5. +1
    -1
      config.js
  6. +4
    -1
      pages.json
  7. +22
    -4
      pages/index/cart.vue
  8. +3
    -2
      pages/index/category.vue
  9. +9
    -6
      pages/index/center.vue
  10. +10
    -7
      pages/index/member.vue
  11. +7
    -5
      pages/index/order.vue
  12. +0
    -93
      pages_order/components/commodity/commoditySelect.vue
  13. +6
    -2
      pages_order/components/product/submit.vue
  14. +2
    -2
      pages_order/mine/address.vue
  15. +69
    -11
      pages_order/order/createOrder.vue
  16. +47
    -68
      pages_order/order/orderDetail.vue
  17. +3
    -1
      pages_order/product/productDetail.vue
  18. +27
    -0
      utils/index.js

+ 1
- 1
api/http.js View File

@ -17,7 +17,7 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
method: method,
header: {
'X-Access-Token': uni.getStorageSync('token'),
'Content-Type' : method == 'POST' ? 'application/x-www-form-urlencoded' : 'application/json'
'Content-Type' : 'application/x-www-form-urlencoded'
},
success: (res) => {


+ 19
- 0
api/model/index.js View File

@ -59,12 +59,31 @@ const api = {
method: 'GET',
auth : true,
},
// 删除购物车信息
deleteCart: {
url: '/rice_index/deleteCart',
method: 'DELETE',
auth : true,
},
// 修改购物车信息数量
updateCartNum: {
url: '/rice_index/updateCartNum',
method: 'POST',
auth : true,
debounce : 300,
},
// 创建订单
createOrder: {
url: '/rice_index/createOrder',
method: 'GET',
auth : true,
},
// 多商品创建订单
createSumOrder: {
url: '/rice_index/createSumOrder',
method: 'POST',
auth : true,
},
}
export default api

+ 21
- 3
api/model/info.js View File

@ -11,13 +11,20 @@ const api = {
// 增加或修改地址信息
addOrUpdateAddress: {
url: '/rice_info/addOrUpdateAddress',
method: 'POST',
limit : 500,
auth : true,
},
// 删除地址
deleteAddress: {
url: '/rice_info/deleteAddress',
method: 'GET',
limit : 500,
auth : true,
},
// 获取购物车信息列表带分页
getCartPageList: {
url: '/rice_info/getCartPageList',
// 修改默认地址
updateDefaultAddress: {
url: '/rice_info/updateDefaultAddress',
method: 'GET',
auth : true,
},
@ -45,6 +52,12 @@ const api = {
method: 'GET',
auth : true,
},
// 获取订单详情
getOrderDetail: {
url: '/rice_info/getOrderDetail',
method: 'GET',
auth : true,
},
// 获取流水记录带分页
getWaterPageList: {
url: '/rice_info/getWaterPageList',
@ -66,6 +79,11 @@ const api = {
url: '/rice_info/getRiceInfo',
method: 'GET',
},
// 获取购物车信息列表带分页
getCartPageList: {
url: '/rice_info/getCartPageList',
method: 'GET',
},
}
export default api

+ 7
- 3
components/product/productItem.vue View File

@ -14,7 +14,7 @@
{{ item.sku }}
</view>
<view class="price">
{{ item.price }}
<text>{{ item.price }}</text>
</view>
</view>
</view>
@ -46,6 +46,7 @@
display: flex;
width: 100%;
box-sizing: border-box;
border-bottom: 1rpx solid #00000012;
.item-image {
width: 140rpx;
@ -78,8 +79,11 @@
.price {
text-align: right;
color: #f40;
font-size: 30rpx;
font-weight: 900;
font-size: 26rpx;
text{
font-size: 30rpx;
font-weight: 900;
}
}
}
}

+ 1
- 1
config.js View File

@ -7,7 +7,7 @@ import uvUI from '@/uni_modules/uv-ui-tools'
Vue.use(uvUI);
// 当前环境
const type = 'prod'
const type = 'dev'
// 环境配置


+ 4
- 1
pages.json View File

@ -50,7 +50,10 @@
"root": "pages_order",
"pages": [
{
"path": "order/orderDetail"
"path": "order/orderDetail",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "mine/purse"


+ 22
- 4
pages/index/cart.vue View File

@ -10,9 +10,10 @@
<uv-swipe-action>
<view
v-for="(item, index) in list"
:key="index">
:key="item.id">
<view style="margin-top: 20rpx;"></view>
<uv-swipe-action-item
@click="e => deleteCart(e, item)"
:options="options">
<view class="item">
<view class="checkbox">
@ -51,7 +52,7 @@
<view class="">
<uv-number-box v-model="item.num"
@change="valChange"></uv-number-box>
@change="e => valChange(item, e)"></uv-number-box>
</view>
</view>
@ -62,6 +63,13 @@
</uv-swipe-action>
</uv-checkbox-group>
<uv-empty
v-if="list.length == 0"
text="空空如也"
textSize="30rpx"
iconSize="200rpx"
icon="list"></uv-empty>
<view class="action">
<view class="icon">
<image src="/static/image/cart/1.png" mode=""></image>
@ -129,8 +137,11 @@
},
},
methods: {
valChange(){
valChange(item, e) {
this.$api('updateCartNum', {
id: item.id,
num: e.value,
})
},
//
submit(){
@ -154,6 +165,13 @@
this.$utils.navigateTo('/pages_order/order/createOrder')
},
deleteCart(e, item){
this.$api('deleteCart', {
id : item.id
}, res => {
this.getData()
})
},
}
}
</script>


+ 3
- 2
pages/index/category.vue View File

@ -48,8 +48,9 @@
}
},
methods: {
change({index}) {
this.queryParams.classId = this.category[index].id
change(e) {
this.queryParams.classId = this.category[e].id
this.getData()
},
}
}


+ 9
- 6
pages/index/center.vue View File

@ -5,14 +5,14 @@
<view class="head">
<view class="headImage">
<image :src="userInfo.headImage" mode=""></image>
<image :src="userInfo.headImage" mode="aspectFill"></image>
</view>
<view class="info">
<view class="name">
<view class="one">{{ userInfo.nickName }}</view>
<!-- <view class="two">黄金会员</view> -->
<view class="two">
<image :src="configList[vipImage[userInfo.isPay]]" mode=""></image>
<image :src="configList[vipImage[userInfo.isPay]]" mode="widthFix"></image>
</view>
</view>
<view class="vip">
@ -239,28 +239,31 @@
.vip {
color: #909294;
font-size: 24rpx;
}
.name {
display: flex;
align-items: center;
.one {
color: #343140;
font-size: 32rpx;
font-weight: 600;
margin-right: 20rpx;
}
.two {
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
// font-size: 24rpx;
// margin-left: 10rpx;
// padding: 3rpx 16rpx;
// border-radius: 18rpx;
// background-color: rgb(252, 213, 157);
image{
width: 100rpx;
height: 50rpx;
width: 120rpx;
}
}
}


+ 10
- 7
pages/index/member.vue View File

@ -182,13 +182,16 @@
},
//
submitOpen(){
this.$api('applyRiceVip', res => {
if(res.code == 200){
uni.showToast({
title: '开通成功',
icon : 'none'
})
}
uni.showModal({
title: this.configList.vip_rloe,
confirmText: '去开通',
success : res => {
if(res.confirm){
uni.navigateTo({
url: '/pages/index/category'
})
}
},
})
},
}


+ 7
- 5
pages/index/order.vue View File

@ -31,21 +31,23 @@
</view>
</view>
<view class="content">
<view class="content"
:key="index"
v-for="(good, index) in item.commonOrderSkuList">
<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.title}}
商品{{good.title}}
</view>
<view class="text-hidden-1">
规格{{item.sku}}
规格{{good.sku}}
</view>
<view class="text-hidden-1">
数量{{item.num}}
数量{{good.num}}
</view>
<!-- <view class="text-hidden-1">
总计时间{{item.useTime}}分钟


+ 0
- 93
pages_order/components/commodity/commoditySelect.vue View File

@ -1,93 +0,0 @@
<template>
<view style="">
<view v-for="item in commodityList" :key="item.title" class="address-item">
<view class="itme1" @click="selectSp(item)">
<view class="left">
<img src="../../../static/image/center/1.png" alt="" style="width: 100%;height: 100%;">
</view>
<view class="center">
<view>{{ item.title }}</view>
<view>{{ item.smallTitle }}</view>
</view>
<view class="right">×{{item.total}}</view>
</view>
<uv-line></uv-line>
</view>
</view>
</template>
<script>
export default {
props: {
commodityList: {
default: [],
type: Array,
}
},
data() {
return {
selectAddress: 0,
}
},
methods: {
//
openCommodity() {
this.$emit('openSpPopup')
},
//
selectSp(e) {
console.log(this.commodityList,"this.csss")
console.log(e, '选择了商品')
this.$emit('selectSp', e)
}
}
}
</script>
<style scoped lang="scss">
.itme1 {
display: flex;
height: 150rpx;
width: 100vw;
background-color: #ffffff;
.left {
padding: 40rpx;
width: 20%;
border-radius: 10rpx;
background-color: #ffffff;
}
.center {
display: flex;
flex-direction: column;
justify-content: center;
gap: 20rpx;
width: 70%;
padding: 0rpx 0 0 20rpx;
background-color: #ffffff;
// view
> view:first-of-type {
font-size: 36rpx;
color: #333;
}
// view
> view:nth-of-type(2) {
font-size: 28rpx;
color: #666666;
}
}
.right {
display: flex;
justify-content: center;
align-items: center;
width: 10%;
color: #666666;
background-color: #ffffff;
}
}
</style>

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

@ -25,7 +25,8 @@
<view class="submit-btn"
>
<view class="l"
<view class="l"s
v-if="detail.type == 2"
@click="$emit('addCart')">
加入购物车
</view>
@ -44,7 +45,10 @@
submiitTitle : {
default : '立即购买',
type : String,
}
},
detail : {
default : {}
},
},
data() {
return {


+ 2
- 2
pages_order/mine/address.vue View File

@ -106,7 +106,7 @@
//
editDefault(id) {
this.$api('addressDefault', {
this.$api('updateDefaultAddress', {
id: id,
}, res => {
if (res.code == 200) {
@ -128,7 +128,7 @@
content: '确认删除此地址?删除后数据不可恢复',
success(e) {
if(e.confirm){
self.$api('addressDelete', {
self.$api('deleteAddress', {
id
}, res => {
if (res.code == 200) {


+ 69
- 11
pages_order/order/createOrder.vue View File

@ -157,22 +157,80 @@
this.$refs.addressPopup.close()
},
//
// submit(){
// this.$api('createOrder', {
// productId : this.productList[0].id,
// num : 1,
// }, res => {
// if(res.code == 200){
// uni.showToast({
// title: '',
// icon: 'none'
// })
// setInterval(uni.navigateTo, 1000, {
// url : '/pages/index/order'
// })
// }
// })
// },
submit(){
this.$api('createOrder', {
productId : this.productList[0].id,
num : 1,
}, res => {
if(res.code == 200){
uni.showToast({
title: '购买成功',
icon: 'none'
let addressId = this.address.id
if(!addressId){
uni.showToast({
title: '请选择地址',
icon: 'none'
})
return
}
let data = {}
let api = ''
if(this.productList[0].type == 2){//
let list = []
this.productList.forEach(n => {
list.push({
num : n.num,
shopId : n.shopId || n.id,
})
setInterval(uni.navigateTo, 1000, {
url : '/pages/index/order'
})
data = {
addressId,
list : JSON.stringify(list),
}
api = 'createSumOrder'
}else{//
data = {
addressId,
num : this.productList[0].num,
productId : this.productList[0].id,
}
api = 'createOrder'
}
this.$api(api, data, res => {
if(res.code == 200){
uni.requestPaymentWxPay(res)
.then(res => {
uni.showToast({
title: '下单成功',
icon: 'none'
})
setTimeout(uni.navigateTo, 700, {
url: '/pages_order/order/order'
})
}).catch(n => {
setTimeout(uni.navigateTo, 500, {
url: '/pages_order/order/order'
})
})
}
})
},
}
}


+ 47
- 68
pages_order/order/orderDetail.vue View File

@ -6,9 +6,7 @@
@leftClick="$utils.navigateBack"
/>
<!-- 水洗店 -->
<view class=""
v-if="userShop">
<!-- <view class="">
<view class="controls">
<view class="title">
<image src="../static/order/icon.png" mode=""></image>
@ -35,44 +33,47 @@
v-for="(item, index) in steps"></uv-steps-item>
</uv-steps>
</view>
</view>
</view> -->
<!-- 酒店和水洗店 -->
<view class="info">
<view class="flex"
style="display: flex;">
<view style="width: 8rpx;height: 30rpx;
background: #FD5100;border-radius: 6rpx;" />
<view class="head-title">服务项目</view>
background: #A3D250;border-radius: 6rpx;"
/>
<view class="head-title">产品</view>
</view>
<view class="flex">
<view class="server-item">
<view class="server-item"
:key="index"
v-for="(good, index) in order.commonOrderSkuList"
>
<view class="img-box">
<image :src="msgShop.image" mode="aspectFill"></image>
<image :src="good.image" mode="aspectFill"></image>
</view>
<view class="server-info">
<view class="server-title">
{{msgOrder.projectName}}
{{good.title}}
<!-- <view class="coupon">领券立减</view> -->
</view>
<view class="current-price">
<text class="unit"></text>{{msgOrder.money}}
<text class="unit"></text>{{good.price}}
</view>
<view class="sales-volume" style="margin-top: 5px;">
<view class="desc">规格{{msgOrder.unit}}</view>
<view class="desc">规格{{good.sku}}</view>
</view>
<view class="time-coupon">
<!-- <view class="flex">
<image src="@/static/home/time-icon.png"></image>
<view class="time">{{msgOrder.useTime}}分钟</view>
<view class="time">{{order.useTime}}分钟</view>
</view> -->
<!-- <view class="sales-volume">
@ -116,16 +117,16 @@
<view class="line address">
<view class="address-top">
<!-- <view class="">
服务地址
</view> -->
<view class="">
收货地址
</view>
<view class="copy">
<image @click="copy(msgOrder.name + ' ' + msgOrder.phone + ' ' + msgOrder.address)" src="/static/order/copy.png"></image>
<image @click="copy(order.name + ' ' + order.phone + ' ' + order.address + order.addressDetails)" src="/static/order/copy.png"></image>
</view>
</view>
<view class="addressDetail">
<view class="">{{msgOrder.name}} {{msgOrder.phone}}</view>
<view class="">{{msgOrder.address}}</view>
<view class="">{{order.name}} {{order.phone}}</view>
<view class="">{{order.address}} {{order.addressDetails}}</view>
</view>
</view>
@ -136,31 +137,7 @@
实付款
</view>
<view class="current-price">
{{ msgOrder.money }}
</view>
</view>
<view class="min_tips">
<view class="">
租赁费用
</view>
<view class="">
{{ msgOrder.price }}
</view>
</view>
<view class="min_tips">
<view class="">
水洗费用
</view>
<view class="">
{{ msgOrder.price}}
</view>
</view>
<view class="min_tips">
<view class="">
押金
</view>
<view class="">
{{ msgOrder.price }}
{{ order.price }}
</view>
</view>
</view>
@ -177,7 +154,7 @@
订单编号
</view>
<view class="">
{{msgOrder.id}}
{{order.id}}
</view>
</view>
<view class="min_tips">
@ -185,7 +162,7 @@
下单时间
</view>
<view class="">
{{msgOrder.createTime}}
{{order.createTime}}
</view>
</view>
</view>
@ -193,14 +170,14 @@
<!-- 下单须知 -->
<view class="line">
<view class="t min_tips">
<!-- <view class="t min_tips">
<view class="">
下单须知
</view>
</view>
<view class="min_tips" style="line-height: 40rpx;">
{{msgShop.projectExplain}}
</view>
</view> -->
<view class="btns">
<view @click="clickService" class="btn">
联系客服
@ -213,10 +190,9 @@
</template>
<script>
import { mapGetters } from 'vuex'
import { mapState } from 'vuex'
export default {
computed : {
...mapGetters(['userShop']),
},
data() {
return {
@ -227,27 +203,30 @@
'开始清洗',
'服务完成',
],
msgShop : {
money : 99.99,
image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
projectExplain : '1.xxxxxxxxxx xxxxxxxxxx。2.xxxxxx xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxx。3.。',
},
msgOrder : {
money : 99.99,
address : '广东省广州市越秀区城南故事C3栋2802',
name : '李**',
phone : '150*****091',
unit : '120*40*75【桌子尺寸】',
state_dictText : '已完成',
price : 199.99,
id : '020644568964457',
createTime : '2024-01-18 15:39',
projectName : '桌布租赁'
},
order : {},
id : 0,
}
},
onLoad(args) {
this.id = args.id
},
onShow() {
this.getOrderDetail()
},
onPullDownRefresh() {
this.getOrderDetail()
},
methods: {
getOrderDetail(){
this.$api('getOrderDetail', {
id : this.id
}, res => {
uni.stopPullDownRefresh()
if(res.code == 200){
this.order = res.result
}
})
},
}
}
</script>


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

@ -38,6 +38,7 @@
<submit
@addCart="addCart"
@submit="submit"
:detail="productDetail"
/>
<!-- <submit
@ -99,9 +100,10 @@
}
})
},
//
addCart(){
this.$api('addCart', {
productId : this.id,
shopId : this.id,
num : 1,
}, res => {
if(res.code == 200){


+ 27
- 0
utils/index.js View File

@ -44,4 +44,31 @@ Vue.prototype.openLocation = (latitude, longitude) => {
latitude : Number(latitude),
longitude : Number(longitude),
})
}
// 封装微信支付
uni.requestPaymentWxPay = function(res){
return new Promise((success, error) => {
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);
success(res)
},
fail: function (err) {
console.log('支付失败',err);
error(err)
uni.showToast({
icon:'none',
title:"支付失败"
})
}
});
})
}

Loading…
Cancel
Save