Browse Source

到第二阶段 客户体验了

hfll
hflllll 3 weeks ago
parent
commit
716abc5c76
6 changed files with 233 additions and 123 deletions
  1. +24
    -1
      api/model/order.js
  2. +17
    -4
      pages/index/cart.vue
  3. +63
    -12
      pages/index/center.vue
  4. +48
    -54
      pages/index/order.vue
  5. +80
    -51
      pages_order/mine/team.vue
  6. +1
    -1
      pages_order/order/newOrderDetail.vue

+ 24
- 1
api/model/order.js View File

@ -42,6 +42,13 @@ const api = {
limit: 500
},
// 订单-购物车-删除购物车
deleteShopcar: {
url: '/teambuy/shopcar/deleteShopcar',
method: 'POST',
limit: 500
},
// 订单-支付订单
payOrder: {
url: '/teambuy/order/payOrder',
@ -117,7 +124,23 @@ const api = {
url: '/teambuy/afterservice/addAfterService',
method: 'POST',
limit: 500
}
},
// 订单-取消团员订单
deleteMemberOrderById: {
url: '/teambuy/order/deleteMemberOrderById',
method: 'POST',
limit: 500
},
// 订单-团员完成取餐
finishMemberOrderById: {
url: '/teambuy/order/finishMemberOrderById',
method: 'POST',
limit: 500
},
}
export default api

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

@ -102,6 +102,9 @@ export default {
}
return total
}, 0)
},
deleteCartIds(){
return this.checkboxValue.join(';')
}
},
methods: {
@ -115,11 +118,11 @@ export default {
})
},
//
modifyCart(item){
modifyCart(item, type){
this.$api('addShopcar', {
goodsId: item.goodsId,
id: item.id,
num: item.num
num: type,
}, res => {
console.log(res);
})
@ -134,13 +137,13 @@ export default {
},
increaseQuantity(item) {
item.num += 1;
this.modifyCart(item)
this.modifyCart(item, 1)
// this.updateCart();
},
decreaseQuantity(item) {
if (item.num > 1) {
item.num -= 1;
this.modifyCart(item)
this.modifyCart(item, -1)
}
},
//
@ -180,6 +183,16 @@ export default {
})
//
}, 800)
},
//
deleteCart(){
this.$api('deleteShopcar', {
shopcarId: this.deleteCartIds,
}, res => {
if (res.code == 200){
this.getCartData()
}
})
}
},
onShow(){


+ 63
- 12
pages/index/center.vue View File

@ -182,9 +182,6 @@
<script>
import tabber from '@/components/base/tabbar.vue'
// import { mockUserInfo } from '@/static/js/mockUserInfo.js'
// import { unix } from 'dayjs'
export default {
components: {
@ -192,7 +189,6 @@ export default {
},
data() {
return {
// userInfo: mockUserInfo,
identity: uni.getStorageSync('identity') || 0
}
},
@ -207,23 +203,78 @@ export default {
title: '提示',
content: `确定要切换为${this.identity ? '团员' : '团长'}吗?`,
confirmColor: '#019245',
// cancelColor: '#FF2A2A',
success: (res) => {
if (res.confirm){
//
uni.showLoading({
title: '切换中...'
})
setTimeout(() => {
uni.hideLoading();
this.identity = this.identity ? 0 : 1;
if (this.identity == 0){
this.$api('queryLeaderInfo', {}, res => {
if (res.code == 200){
if (res.result == null){
//
uni.showModal({
title: '提示',
content: '您还没有提交过团长申请,请先提交申请',
confirmColor: '#019245',
confirmText: '提交申请',
showCancel: false,
success: (res) => {
if (res.confirm) {
this.$utils.navigateTo({
url: '/pages_order/mine/team'
})
}
}
})
}else if (res.result.status == '1'){
this.identity = 1
uni.setStorageSync('identity', this.identity)
uni.showToast({
title: '切换成功',
icon: 'success',
duration: 2000
})
}else if (res.result.status == '2'){
uni.showModal({
title: '提示',
content: '团长申请失败,请重新申请',
confirmColor: '#019245',
confirmText: '重新申请',
showCancel: false,
success: (res) => {
if (res.confirm){
this.$utils.navigateTo({
url: '/pages_order/mine/team'
})
}
}
})
}else if (res.result.status == '0'){
uni.showModal({
title: '提示',
content: '团长申请审核中,请耐心等待',
confirmColor: '#019245',
confirmText: '重新申请',
cancelText: '等待申请',
success: (res) => {
if (res.confirm){
this.$utils.navigateTo({
url: '/pages_order/mine/team'
})
}
}
})
}
}
})
}else if (this.identity == 1){
this.identity = 0
uni.setStorageSync('identity', this.identity)
uni.showToast({
title: '切换成功',
icon: 'success',
duration: 2000
})
}, 500);
}
}
}
})


+ 48
- 54
pages/index/order.vue View File

@ -34,8 +34,8 @@
<!-- 订单列表 -->
<view class="order-list" v-else>
<OrderItem v-for="(order, index) in orderList" :key="order.id" :order="order" @cancel="handleCancelOrder"
@pick="handlePickOrder" @pay="handlePayOrder" @click="goToOrderDetail(order)" />
<OrderItem v-for="(order, index) in orderList" :key="order.id" :order="order" @cancel="handleCancelOrder(order.id)"
@pick="handlePickOrder(order.id)" @pay="handlePayOrder" @click="goToOrderDetail(order)" />
<view style="margin-top: 200rpx; min-width: 700rpx;">
<uv-empty mode="order" v-if="orderList.length == 0" />
</view>
@ -247,35 +247,30 @@
// }
// },
// //
// handleCancelOrder(orderId) {
// uni.showModal({
// title: '',
// content: '',
// confirmColor: '#019245',
// success: (res) => {
// if (res.confirm) {
// // API
handleCancelOrder(orderId) {
uni.showModal({
title: '提示',
content: '确定要取消订单吗?',
confirmColor: '#019245',
success: (res) => {
if (res.confirm) {
// API
this.$api('deleteMemberOrderById', {
memberOrderId: orderId,
}, res => {
if (res.code == 200){
uni.showToast({
title: '订单已取消',
icon: 'success'
})
this.getData()
}
})
// uni.showToast({
// title: '',
// icon: 'success'
// })
// //
// const orderIndex = this.orderList.findIndex(item => item.id === orderId)
// if (orderIndex !== -1) {
// this.orderList[orderIndex].status = 'canceled'
// //
// if (this.current !== 0 && this.current !== 5) {
// this.orderList.splice(orderIndex, 1)
// }
// }
// }
// }
// })
// },
}
}
})
},
//
// handlePayOrder(orderId) {
// uni.showToast({
@ -312,30 +307,29 @@
// }, 1500)
// },
//
// handlePickOrder(order) {
// uni.showModal( {
// title: '',
// content: '',
// confirmColor: '#019245',
// success: (res) => {
// if (res.confirm) {
// // order.status_dictText = '',
// this.$api('updateMemberOrderStatus', { id: order.id, status: 3 }, res => {
// if (res.code === 200) {
// this.clickTabs({
// index: 3
// })
// }
// })
// uni.showToast({
// title: '',
// icon: 'success',
// duration: 2000
// })
// }
// }
// })
// }
handlePickOrder(orderId) {
uni.showModal( {
title: '提示',
content: '确定取餐完成?',
confirmColor: '#019245',
success: (res) => {
if (res.confirm) {
this.$api('finishMemberOrderById', {
memberOrderId: orderId
}, res => {
if (res.code === 200) {
uni.showToast({
title: '取餐完成',
icon: 'success',
duration: 2000
})
this.getData()
}
})
}
}
})
}
}
}
</script>


+ 80
- 51
pages_order/mine/team.vue View File

@ -5,21 +5,23 @@
color="#fff" />
<!-- 顶部图片区域 -->
<view class="banner" v-if="!identity">
<view class="banner" v-if="!identity">s
<image src="/static/image/红烧肉.webp" mode="aspectFill" class="banner-image"></image>
</view>
<view class="content-area">
<uv-alert v-if="status != '-1'" fontSize="28rpx" :title="toastTitle" :show-icon="true" closable :type="toastType"
:description="remark" />
<!-- 送餐点照片上传区域 -->
<view class="section-title">送餐点照片</view>
<view class="section-title">送餐点照片 </view>
<view class="section-block">
<view class="upload-container">
<view class="upload-area" @tap="chooseImage" v-if="!formData.spotImage">
<view class="plus">+</view>
<view class="upload-text">添加图片</view>
</view>
<image v-else :src="formData.spotImage" mode="aspectFill" class="upload-area"
@tap="chooseImage" />
<image v-else :src="formData.spotImage" mode="aspectFill" class="upload-area" @tap="chooseImage" />
</view>
</view>
@ -46,8 +48,9 @@
<view class="form-item region-item" @click="regionSelect">
<text class="label">所在地区</text>
<text>{{ formData.area }}</text>
<uv-icon name="arrow-right" color="#000" style="margin-left: 2rpx;"/>
<uv-icon name="arrow-right" color="#000" style="margin-left: 2rpx;" />
</view>
<view class="address-item">
<text class="label">详细地址</text>
<view class="address-box">
@ -57,12 +60,8 @@
</view>
</view>
<!-- 提交按钮 -->
<view v-if="!this.beModify" class="submit-btn" @tap="submitApplication">
{{ !identity ? '提交申请' : '提交保存' }}
</view>
<view v-else class="submit-btn-container">
<view class="submit-btn-modify" @tap="submitApplication">修改</view>
<view class="submit-btn-save" @tap="submitApplication">保存</view>
<view class="submit-btn" v-if="status != '1' || identity != 0" @tap="submitApplication">
{{ buttonText }}
</view>
</view>
</view>
@ -91,20 +90,28 @@ export default {
longitude: '' //
},
identity: uni.getStorageSync('identity'),
beModify: false //
status: '-1', // -1 0 1 2
remark: '' //
}
},
methods: {
//
chooseImage() {
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
this.$Oss.ossUploadImage({
key: '',
folder: '',
compressed: true,
success: (res) => {
//
//
this.formData.spotImage = res.tempFilePaths[0]
console.log('上传成功',res);
this.formData.spotImage = ''
this.formData.spotImage = res
},
fail: (res) => {
console.log('上传失败',res);
uni.showToast({
title: `上传失败,${res.errMsg}`,
icon: 'error'
})
}
})
},
@ -114,6 +121,8 @@ export default {
// this.formData.area = e.detail.value[1] + e.detail.value[2]
position.selectAddress(0, 0, res => {
delete res.errMsg
res.area = res.name
delete res.name
this.formData = {
...this.formData,
...res
@ -127,28 +136,28 @@ export default {
if (!this.formData.spotImage) {
return uni.showToast({
title: '请上传送餐点照片',
icon: 'none'
icon: 'error'
})
}
if (!this.formData.spotName) {
return uni.showToast({
title: '请输入送餐点名称',
icon: 'none'
icon: 'error'
})
}
if (!this.formData.name) {
return uni.showToast({
title: '请输入您的姓名',
icon: 'none'
icon: 'error'
})
}
if (!this.formData.phone) {
return uni.showToast({
title: '请输入联系手机号',
icon: 'none'
icon: 'error'
})
}
@ -162,14 +171,14 @@ export default {
if (!this.formData.area) {
return uni.showToast({
title: '请选择所在地区',
icon: 'none'
icon: 'error'
})
}
if (!this.formData.address) {
return uni.showToast({
title: '请输入详细地址',
icon: 'none'
icon: 'error'
})
}
@ -178,6 +187,8 @@ export default {
title: '提交中...'
})
console.log(this.formData);
//
this.$api('updateLeaderInfo', {
...this.formData,
@ -201,7 +212,7 @@ export default {
},
//
//
assign(data) {
this.formData.address = data.address
this.formData.area = data.area
@ -210,34 +221,52 @@ export default {
this.formData.spotImage = data.spotImage
this.formData.spotName = data.spotName
this.formData.id = data.id
},
},
computed: {
buttonText() {
switch (this.status) {
case '-1':
return '提交申请'
case '0':
return '修改申请'
case '1':
return '修改信息'
case '2':
return '重新申请'
default:
return '提交申请'
}
},
toastTitle() {
if (this.status == '2') {
return '审核不通过!'
} else if (this.status == '1') {
return '审核已通过!请前往个人页面右上角切换团长身份'
} else if (this.status == '0') {
return '审核中...'
}
},
toastType() {
if (this.status == '2') {
return 'error'
} else if (this.status == '1') {
return 'success'
} else if (this.status == '0') {
return 'warning'
} else {
return 'info'
}
}
},
onLoad() {
if (!this.identity) {
this.$api('queryLeaderInfo', {}, res => {
if (res.code == 200){
this.assign(res.result)
if (this.formData.remark){
if (this.formData.status != 0){
uni.showModal({
title: `${ this.formData.status == 1 ? '审核通过' : '审核不通过' }`,
content: this.formData.remark,
showCancel: false,
confirmColor: '#019245',
})
}else {
uni.showModal({
title: `还在审核中 请稍等`,
content: this.formData.remark,
showCancel: false,
confirmColor: '#019245',
})
}
}
}
})
}
this.$api('queryLeaderInfo', { }, res => {
if (res.code == 200){
this.assign(res.result)
this.status = res.result.status
this.remark = res.result.remark
}
})
}
}
</script>


+ 1
- 1
pages_order/order/newOrderDetail.vue View File

@ -155,7 +155,7 @@
// goodId,goodNum;goodId2,goodsNum
goodss() {
return this.orderDetail.goodsList.map(item => {
return `${item.id},${item.num}`
return `${item.id},${item.num},${item.goods.price * item.num}`
}).join(';')
}


Loading…
Cancel
Save