第一次提交

This commit is contained in:
gxwebsoft
2023-08-04 13:14:48 +08:00
commit 1b923e5cff
1030 changed files with 128016 additions and 0 deletions

319
sub_pages/order/delivery.vue Executable file
View File

@@ -0,0 +1,319 @@
<template>
<view class="container">
<view class="reject" v-if="form.apply_status == 10">
<u-alert type="error" title="申请已提交:" description="请耐心等待工作人员的审核"></u-alert>
</view>
<view class="reject" v-else-if="form.apply_status == 30">
<u-alert type="error" title="您的申请已被驳回:" :description="form.reject_reason"></u-alert>
</view>
<u-form :model="form" ref="uForm" label-width="140rpx">
<!-- 标题 -->
<view class="page-title">身份证信息</view>
<view class="form-wrapper">
<u-form-item label="正面" prop="img1">
<image :src="orderSourceData[0]" v-if="orderSourceData[0]" mode="aspectFill" style="width: 300rpx;height: 200rpx"></image>
<image src="../../static/not-dealer.png" v-else mode="aspectFill" style="width: 300rpx;height: 200rpx" @click="chooseImage(1)"></image>
</u-form-item>
<u-form-item label="反面" prop="img2">
<image :src="orderSourceData[1]" v-if="orderSourceData[1]" mode="aspectFill" style="width: 300rpx;height: 200rpx"></image>
<image src="../../static/not-dealer.png" v-else mode="aspectFill" style="width: 300rpx;height: 200rpx" @click="chooseImage(2)"></image>
</u-form-item>
</view>
<!-- 标题 -->
<view class="page-title">其他</view>
<!-- 表单组件 -->
<view class="form-wrapper">
<u-form-item label="人车合照" prop="img3">
<image :src="orderSourceData[2]" v-if="orderSourceData[2]" mode="aspectFill" style="width: 300rpx;height: 200rpx"></image>
<image src="../../static/not-dealer.png" v-else mode="aspectFill" style="width: 300rpx;height: 200rpx" @click="chooseImage(3)"></image>
</u-form-item>
<u-form-item label="车子照片" prop="img4">
<image :src="orderSourceData[3]" v-if="orderSourceData[3]" mode="aspectFill" style="width: 300rpx;height: 200rpx"></image>
<image src="../../static/not-dealer.png" v-else mode="aspectFill" style="width: 300rpx;height: 200rpx" @click="chooseImage(4)"></image>
</u-form-item>
<u-form-item label="安装照片" prop="img5">
<image :src="orderSourceData[4]" v-if="orderSourceData[4]" mode="aspectFill" style="width: 300rpx;height: 200rpx"></image>
<image src="../../static/not-dealer.png" v-else mode="aspectFill" style="width: 300rpx;height: 200rpx" @click="chooseImage(5)"></image>
</u-form-item>
</view>
</u-form>
<view class="btn">
<u-button type="primary" shape="circle" @click="handleSubmit()">
{{ submitText }}
</u-button>
</view>
<view class="btn">
<u-button shape="circle" @click="resetting">
重置
</u-button>
</view>
<view class="btn"></view>
</view>
</template>
<script>
import {
uploadFile
} from '@/api/upload.js'
import {
pageOrder,
removeOrder,
receiptOrder,
getOrder
} from '@/api/order.js'
import { fileUrl } from '@/config.js';
export default {
data() {
return {
order: {},
orderSourceData: [],
// 按钮禁用
disabled: false,
submitText: '证件已上传并确认收货',
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const app = this
app.orderId = options.orderId
this.getData()
},
methods: {
// 加载订单
getData(){
const app = this
const { orderId } = this
getOrder(orderId).then(res => {
console.log("res: ",res);
app.order = res.data
if(res.data.orderSourceData.length > 0){
app.orderSourceData = JSON.parse(res.data.orderSourceData)
}
})
},
// 重置
resetting(){
const { orderId } = this
receiptOrder({
orderId,
orderSourceData: ''
}).then(result => {
this.$success("重置成功")
// 刷新订单列表
this.getData()
})
},
// 表单提交
handleSubmit() {
const app = this
this.$navTo('pages/order/index')
},
// 上传图片
chooseImage(id) {
const app = this
const { orderId } = this
const type = 'photo' + id
// 选择图片
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success(chooseImageRes) {
const tempFilePaths = chooseImageRes.tempFilePaths;
uploadFile({
filePath: tempFilePaths[0],
fileType: 'image',
name: 'file'
}).then(res => {
console.log("res: ", res);
app.orderSourceData.push(fileUrl + res.data.path)
receiptOrder({
orderId,
orderSourceData: JSON.stringify(app.orderSourceData)
}).then(result => {
app.$success("上传成功")
// 刷新订单列表
app.getData()
})
})
}
});
},
}
}
</script>
<style>
page {
background: #f7f8fa;
}
</style>
<style lang="scss" scoped>
.page-title {
width: 94%;
margin: 0 auto;
padding-top: 40rpx;
font-size: 28rpx;
color: rgba(69, 90, 100, 0.6);
}
.form-wrapper {
margin: 20rpx auto 20rpx auto;
padding: 0 40rpx;
width: 94%;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
background: #fff;
}
/* 底部操作栏 */
.footer {
margin-top: 80rpx;
.btn-wrapper {
height: 100%;
// display: flex;
// align-items: center;
padding: 0 20rpx;
}
.btn-item {
flex: 1;
font-size: 28rpx;
height: 86rpx;
color: #fff;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
}
.btn-item-wechat {
background: #0ba90b;
margin-bottom: 26rpx;
}
.btn-item-main {
background: linear-gradient(to right, $main-bg, $main-bg2);
// 禁用按钮
&.disabled {
opacity: 0.6;
}
}
}
// 上传凭证
.row-voucher {
padding: 24rpx 20rpx;
.image-list {
padding: 0 20rpx;
margin-top: 20rpx;
margin-bottom: -20rpx;
&:after {
clear: both;
content: " ";
display: table;
}
.image {
display: block;
width: 100%;
height: 100%;
}
.image-picker,
.image-preview {
width: 184rpx;
height: 184rpx;
margin-right: 30rpx;
margin-bottom: 30rpx;
float: left;
&:nth-child(3n+0) {
margin-right: 0;
}
}
.image-picker {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border: 1rpx dashed #ccc;
color: #ccc;
.choose-icon {
font-size: 48rpx;
margin-bottom: 6rpx;
}
.choose-text {
font-size: 24rpx;
}
}
.image-preview {
position: relative;
.image-delete {
position: absolute;
top: -15rpx;
right: -15rpx;
height: 42rpx;
width: 42rpx;
background: rgba(0, 0, 0, 0.64);
border-radius: 50%;
color: #fff;
font-weight: bolder;
font-size: 22rpx;
z-index: 10;
display: flex;
justify-content: center;
align-items: center;
}
}
}
}
.form-license {
padding: 20rpx;
}
.pops-content {
padding: 20rpx;
}
.sfz,
.sfz1,
.sfz2,
.yyzz {
width: 140rpx;
padding-top: 20rpx;
padding-right: 10rpx;
}
.btn {
width: 700rpx;
margin: 20rpx auto;
height: 100rpx;
}
.reject {
width: 700rpx;
margin: 20rpx auto;
}
</style>

View File

@@ -0,0 +1,103 @@
<template>
<view>
<view class="user-list">
<u-list @scrolltolower="scrolltolower">
<u-list-item v-for="(item, index) in list" :key="index">
<u-cell :title="`${item.nickname}`" value="移除" isLink>
<u-avatar slot="icon" shape="square" size="45" :src="item.avatar"
customStyle="margin: -3px 5px -3px 0"></u-avatar>
</u-cell>
</u-list-item>
</u-list>
<view class="bottom"></view>
</view>
<empty v-if="!list.length" tips="暂无数据" />
</view>
</template>
<script>
import * as Api from '@/api/user-referee.js'
import Empty from '@/components/empty'
export default {
components: {
// Search,
Empty
},
data() {
return {
list: []
}
},
onLoad(option) {
this.getUserReferee()
},
onShow(){},
methods: {
getUserReferee(){
const userId = uni.getStorageSync('userId')
Api.listUserReferee({userId}).then(res => {
this.list = res.data
})
},
onRemove(id){
Api.removeUserReferee(id).then(()=>{
this.$toast('移除成功')
this.getUserReferee()
})
}
}
}
</script>
<style lang="scss" scoped>
.user-list{
width: 750rpx;
margin: auto;
display: flex;
flex-direction: column;
background-color: #ffffff;
.item{
border-bottom: 1rpx solid #eeeeee;
display: flex;
justify-content: space-between;
align-items: center;
padding: 10rpx 0;
.info{
.food{
color: #ff0000;
.goods-name{
padding-right: 10rpx;
}
}
.is-buy{
color: #ff0000;
}
.no-buy{
color: #0000ff;
}
.order-ok{
color: #51b2aa;
}
}
.time{
color: #c2c2c2;
}
.remove{
padding: 0 30rpx;
}
}
.bottom{
height: 50rpx;
}
.custom-style {
margin: 10rpx 0;
width: 220rpx;
}
.custom-active-style {
margin: 10rpx 0;
width: 220rpx;
color: #ffffff;
background-color: #51b2aa;
}
}
</style>

View File

@@ -0,0 +1,81 @@
<template>
<view class="container">
<view class="main" style="padding-top: 150rpx;">
<u-grid :border="false" col="2" align="center" @click="onGrid">
<u-grid-item v-for="(item,index) in list" :key="index">
<view class="demo-layout bg-purple-light" :style="`background-color: ${item.background};`">
<image class="icon" :src="item.icon"></image>
<text>{{ item.title }}</text>
</view>
</u-grid-item>
</u-grid>
</view>
</view>
</template>
<script>
const list = [{
name: 'lock',
title: '代他人取餐',
path: 'pages/order/delivery/others',
background: 'abd5f8',
icon: '../../../static/icon/05.svg'
}, {
name: 'lock',
title: '取消代餐',
path: 'pages/order/delivery/cancel',
background: '#bee9d3',
icon: '../../../static/icon/04.svg'
}];
export default {
data() {
return {
list,
isLogin: false
}
},
onLoad() {},
onShow() {},
methods: {
onGrid(index) {
this.$navTo(this.list[index].path)
}
}
}
</script>
<style lang="scss" scoped>
.container {
height: calc(100vh - var(--window-top) - 9vh);
// background: #fff;
background: url('https://file.wsdns.cn/20230417/3d70ff20e2044977a872f867cfe7e570.png');
background-position: bottom;
}
.main {
width: 600rpx;
margin: auto;
.demo-layout {
background-color: #ffffff;
margin: 15rpx auto;
width: 220rpx;
color: #4c4c4c;
padding: 27rpx;
border-radius: 15rpx;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 36rpx;
.icon {
width: 80rpx;
height: 80rpx;
margin-bottom: 15rpx;
}
}
}
</style>

View File

@@ -0,0 +1,355 @@
<template>
<view>
<!-- <view class="select-date">
<text @click="openCalendar">{{ deliveryTime }}<u-icon class="icon" name="calendar"></u-icon></text>
<u-calendar v-model="show" mode="date" :min-date="minDate" :max-date="maxDate" @change="changeDate"></u-calendar>
</view> -->
<view class="order">
<block>
<view class="title">
<text>我的取餐码</text>
<text class="desc">将此取餐码分享给微信好友即可帮你取餐<br>仅当日有效</text>
</view>
<view class="qrcode">
<image :src="qrcode"></image>
</view>
</block>
</view>
<!-- <view class="order">
<block>
<view class="title">
<text>物品档口</text>
</view>
<view class="fenqi">
<block v-for="(item,index) in entityGoods" :key="index">
<view class="item" v-if="item.totalNum > 0">
<image class="image" :src="item.imageUrl" mode="aspectFill"></image>
<view class="goods-info">
<view class="goods-name">
<text class="name">{{ item.goodsName }}</text>
<text class="selling-point">{{ item.comments }}</text>
</view>
<view class="goods-price">
<text class="price">{{ item.goodsPrice }}</text>
<text class="num"> x {{ item.totalNum }}</text>
</view>
</view>
</view>
</block>
</view>
</block>
</view> -->
<!-- <view class="submit">
<u-button type="warning" @click="generateQrCode">生成核销码</u-button>
</view> -->
<!-- <u-button @click="verificationQrCode">生成核销码</u-button> -->
<!-- <u-modal v-model="showQrCode" confirmText="取消" title="核销码">
<view><image :src="qrcode" class="qrcode"></image></view>
</u-modal> -->
</view>
</template>
<script>
import { getUser } from '@/api/user.js'
import { dateFormat } from '@/utils/util.js'
import store from '@/store'
import * as Config from '@/config.js'
import * as UserApi from '@/api/user.js'
export default {
components: {
// Search
},
data() {
return {
totalPrice: 0,
list: [],
form: {},
userId: 0,
canteenGoods: [],
entityGoods: [],
orderId: null,
orderNo: null,
deliveryTime: null,
record: {},
minDate: dateFormat('YYYY-mm-dd',new Date()),
maxDate: '2030-01-01',
deliveryTime: dateFormat('YYYY-mm-dd',new Date()), // var startDate= new Date(new Date().toLocaleDateString());
show: false,
// 正在加载中
isLoading: true,
// 当前选择的设备ID
goodsId: null,
mode: 'range',
month: 6,
agree: true,
price: {
batteryRent: 300,
batteryDeposit: 300,
batteryInsurance: 0
},
customStyle: {
marginTop: '20px', // 注意驼峰命名,并且值必须用引号包括,因为这是对象
backgroundColor: '#51b2aa'
},
showQrCode: false,
qrcode: ''
}
},
onLoad(option) {
this.getUserInfo()
},
onShow(){
this.getMyQrCode()
},
methods: {
getUserInfo() {
const { form } = this
const app = this
getUser().then(res => {
if( res.code == 0 && res.data.username != 'www') {
console.log("获取用户信息: ",res.data);
app.form = res.data
app.userInfo = res.data
app.userId = res.data.userId
store.dispatch('setUserInfo',res.data)
app.isLogin = true
}else{
app.isLogin = false
app.handleLogout()
}
})
},
getMyQrCode(){
const app = this
const userId = uni.getStorageSync('userId')
UserApi.getMyQrCode({
codeContent: 'http://apps.gxwebsoft.com/baocan/#/pages/order/delivery/others?userId=' + userId,
}).then(res => {
app.showQrCode = true
app.qrcode = res.data
})
},
onClose(){
this.showQrCode = false
},
onChangeStepper({ value }) {
this.month = value
},
change(e) {
console.log(e);
},
openCalendar(){
this.show = true
},
changeDate(date){
this.deliveryTime = date.result
this.getMyOrder()
},
onInput(month) {
this.month = month
},
onAgree(){
this.agree = !this.agree
},
showXieyi(){
this.$navTo('pages/help/xieyi')
},
copyCode(text){
// #ifndef H5
console.log("text: ",text);
uni.setClipboardData({
text: text,
success: (result) => {
this.$success("复制成功")
}
})
// #endif
// #ifdef H5
let textarea = document.createElement("textarea")
textarea.value = text
textarea.readOnly = "readOnly"
document.body.appendChild(textarea)
textarea.select() // 选中文本内容
textarea.setSelectionRange(0, info.length)
uni.showToast({ //提示
title: '复制成功'
})
result = document.execCommand("copy")
textarea.remove()
// #endif
}
}
}
</script>
<style lang="scss" scoped>
// .goods-info {
// background-color: #ffffff;
// border-radius: 12rpx;
// width: 700rpx;
// margin: 20rpx auto;
// .goods {
// padding: 20rpx;
// display: flex;
// image {
// width: 220rpx;
// height: 220rpx;
// margin: 20rpx;
// }
// .info {
// display: flex;
// flex-direction: column;
// padding: 20rpx;
// .goods-name {
// font-size: 34rpx;
// margin-bottom: 10rpx;
// }
// .goods-desc {
// font-size: 28rpx;
// color: #999999;
// }
// .selling-point{
// padding: 5px 0;
// color: #e6760e;
// }
// }
// }
// .between-time {
// width: 500rpx;
// margin: auto;
// padding-bottom: 20rpx;
// text-align: center;
// .select-slider {
// line-height: 2em;
// color: #e6760e;
// }
// }
// }
.order {
background-color: #ffffff;
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
.title {
text-align: center;
font-size: 38rpx;
padding: 20rpx;
display: flex;
flex-direction: column;
justify-content: center;
.desc{
font-weight: normal;
color: #999999;
font-size: 28rpx;
}
}
.xieyi {
padding: 20rpx;
font-size: 26rpx;
}
}
.submit {
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
}
.xieyi-text{
color: #0000ff;
}
.fenqi{
padding: 30rpx;
border-top: 1px solid #eee;
.item{
display: flex;
padding: 20rpx 0;
.image{
width: 160rpx;
height: 120rpx;
}
.goods-info{
width: 460rpx;
margin-left: 10rpx;
display: flex;
justify-content: space-between;
.goods-name{
text-align: left;
display: flex;
flex-direction: column;
.name{
font-weight: 500;
max-width: 300rpx;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //溢出内容隐藏
text-overflow: ellipsis; //文本溢出部分用省略号表示
display: -webkit-box; //特别显示模式
-webkit-line-clamp: 2; //行数
line-clamp: 2;
-webkit-box-orient: vertical; //盒子中内容竖直排列
}
.selling-point{
max-width: 300rpx;
color: #999999;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //溢出内容隐藏
text-overflow: ellipsis; //文本溢出部分用省略号表示
display: -webkit-box; //特别显示模式
-webkit-line-clamp: 1; //行数
line-clamp: 1;
-webkit-box-orient: vertical; //盒子中内容竖直排列
}
}
.goods-price{
display: flex;
flex-direction: column;
.price{
color: #999999;
}
.num{
text-align: right;
color: #cccccc;
}
}
}
}
}
.select-date {
text-align: center;
line-height: 2.4rem;
background-color: #ffffff;
.icon {
margin-left: 10rpx;
}
}
.on-buy{
background-color: #804002;
}
.qrcode{
padding-bottom: 40rpx;
margin: auto;
display: flex;
justify-content: center;
image{
width: 360rpx;
height: 360rpx;
}
}
</style>

View File

@@ -0,0 +1,311 @@
<template>
<view class="bg">
<view class="qrcode-box">
<block>
<view class="title line-align">
<view :class="qrcodeType == 0 ? 'active' : ''" @click="onChange(0)">取餐码</view>
<view :class="qrcodeType == 1 ? 'active' : ''" @click="onChange(1)">邀请码</view>
</view>
<view class="qrcode">
<image :src="qrcode"></image>
</view>
<text v-if="qrcodeType == 0" class="desc line-align">将此取餐码分享给微信好友即可帮你取餐<br>仅当日有效</text>
<text v-if="qrcodeType == 1" class="desc line-align">长按分享此码收集代取餐人员</text>
</block>
<block>
<view class="title"> {{ userRefereeList.length }} </view>
<view class="user-list" v-if="qrcodeType == 1">
<view class="item" v-for="(item,index) in userRefereeList" :key="index">
<view class="info">
<view class="nick-name">{{ item.nickname }}</view>
<view class="time">{{ item.createTime }}</view>
</view>
<view class="action">
<u-button shape="circle" type="error" size="mini" plain @click="onRemove(item.id)">移除</u-button>
</view>
</view>
<view class="bottom"></view>
</view>
<view class="user-list" v-if="qrcodeType == 0">
<view class="title line-align" style="padding-top: 10rpx;">
<button :type="tongjiType == 0 ? 'primary' : ''" size="mini" @click="onChange2(0)">按人员统计</button>
<button :type="tongjiType == 1? 'primary' : ''" size="mini" @click="onChange2(1)">按菜品统计</button>
<!-- <u-button size="medium" plain @click="onChange2(1)" class="custom-style" :class="tongjiType == 1 ? 'custom-active-style' : ''">按菜品统计</u-button> -->
</view>
<view class="item" v-for="(item,index) in userOrderList" :key="index">
<view class="info">
<view class="nick-name">{{ item.nickname }}</view>
<!-- 按人员统计 -->
<block v-if="tongjiType == 0">
<span class="no-buy" v-if="item.order.length == 0">未报餐</span>
<span class="order-ok" v-else-if="item.order[0].orderStatus == 30">已取餐</span>
<span class="is-buy" v-else>已报餐</span>
</block>
<!-- 按菜品统计 -->
<block v-if="tongjiType == 1 && item.order.length > 0">
<block v-for="(goods,index) in item.order[0].goodsList">
<span class="food">{{ index > 0 ? '、': '' }}</span>
<span class="food" v-if="goods.deliveryStatus == 10">{{ goods.goodsName }}x{{ goods.totalNum }}</span>
<span class="line-through" v-else>{{ goods.goodsName }}x{{ goods.totalNum }}</span>
</block>
</block>
</view>
</view>
<view class="bottom"></view>
</view>
</block>
</view>
</view>
</template>
<script>
import store from '@/store/index.js'
import storage from '@/utils/storage'
import { ACCESS_TOKEN, USER_ID } from '@/store/mutation-types'
import { pageAgentUser } from '@/api/apps-bc-agent.js'
import { getSetting } from '@/api/setting.js'
import { checkLogin } from '@/core/app.js'
import * as UserRefereeApi from '@/api/user-referee.js'
import * as OrderApi from '@/api/order.js'
import * as UserApi from '@/api/user.js'
import Empty from '@/components/empty'
import { userId } from '@/config'
export default {
components: {
// Search,
Empty
},
data() {
return {
options: null,
title: '代他人取餐',
// 正在加载中
isLoading: false,
// 是否授权了定位权限
isAuthor: true,
// 当前选择的门店ID
selectedId: null,
// 订单列表数据
list: [],
userRefereeList: [],
userOrderList: [],
qrcodeType: 0, // 0邀请码 1取餐码
tongjiType: 0, // 统计类型 0按人员统计 1按菜品统计
qrcode: ''
}
},
onLoad(options) {
this.options = options
this.listUserReferee()
this.addUserByQrCode()
this.getOthersOrder()
this.getMyQrCode()
},
onShow() {
this.getUserInfo()
},
methods: {
navTo(merchantId) {
const navTo = uni.$u.route()
navTo('pages/merchant/detail', {
merchantId
})
},
getUserInfo(){
if(!uni.setStorageSync('userId')){
this.$error('请先登录',() => {
this.$navTo('pages/login/index')
})
}
},
getMyQrCode(){
const app = this
const { qrcodeType } = this
const userId = uni.getStorageSync('userId')
// 取餐码 二维码内容 dqc:代取餐人ID
if(qrcodeType == 0){
UserApi.getMyQrCode({
codeContent: 'dqc:' + userId
}).then(res => {
app.qrcode = res.data
})
}
// 邀请码 二维码内容 跳转到带有推荐人ID的网址完成绑定关系
if(qrcodeType == 1){
UserApi.getMyQrCode({
codeContent: 'http://apps.gxwebsoft.com/baocan/#/pages/order/delivery/others?userId=' + userId,
}).then(res => {
app.qrcode = res.data
})
}
},
// 切换类型
onChange(index){
this.qrcodeType = index
this.getMyQrCode()
this.getOthersOrder()
},
// 切换类型
onChange2(index){
this.tongjiType = index
this.getOthersOrder()
},
// 查询推荐关系列表
listUserReferee(){
const app = this
const dealerId = uni.getStorageSync('userId')
UserRefereeApi.listUserReferee({dealerId}).then(res => {
app.userRefereeList = res.data
})
},
// 查询代取餐人员的订单信息
getOthersOrder(){
OrderApi.getOthersOrder().then(resp => {
console.log("resp: ",resp);
this.userOrderList = resp.data
})
},
addUserByQrCode(){
const app = this
const { userId } = app.options
const dealerId = uni.getStorageSync('userId')
if(userId && userId != Number(dealerId)){
app.qrcodeType = 1
UserRefereeApi.addUserReferee({
dealerId,
userId
}).then(res => {
app.$toast(res.message)
app.listUserReferee()
})
}
},
onRemove(id){
const app = this
UserRefereeApi.removeUserReferee(id).then(()=>{
app.$toast('移除成功')
app.listUserReferee()
})
}
// onAgentBaocan(user){
// console.log("user收拾收拾: ",user);
// uni.setStorageSync('catererUser',user)
// this.$navTo('pages/order/get-food/get-food')
// },
// clearAgentBaocan(){
// uni.removeStorageSync('catererUser')
// this.$navTo('pages/order/get-food/get-food')
// }
}
}
</script>
<style lang="scss" scoped>
page{
background-color: #67e7dd;
}
.bg {
background-image: linear-gradient(#51b2aa, #67e7dd);
height: calc(100vh - var(--window-top));
padding: 70rpx 0;
}
.qrcode-box{
width: 660rpx;
margin: auto;
background-color: #ffffff;
border-radius: 20rpx;
.title{
padding: 12rpx 0;
display: flex;
justify-content: space-around;
line-height: 80rpx;
font-size: 34rpx;
color: #999999;
.active{
color: #51b2aa;
}
}
.line-align{
width: 580rpx;
margin: auto;
border-bottom: 1rpx solid #eeeeee;
}
.qrcode{
padding-bottom: 0rpx;
margin: auto;
display: flex;
justify-content: center;
image{
width: 360rpx;
height: 360rpx;
}
}
.desc{
color: blue;
display: flex;
text-align: center;
justify-content: center;
padding-bottom: 24rpx;
}
.user-list{
width: 580rpx;
margin: auto;
display: flex;
flex-direction: column;
.item{
border-bottom: 1rpx solid #eeeeee;
display: flex;
justify-content: space-between;
align-items: center;
padding: 10rpx 0;
.info{
.food{
color: #ff0000;
.goods-name{
padding-right: 10rpx;
}
}
.line-through{
text-decoration: line-through;
color: #666666;
.goods-name{
padding-right: 10rpx;
}
}
.is-buy{
color: #ff0000;
}
.no-buy{
color: #0000ff;
}
.order-ok{
color: #51b2aa;
}
}
.time{
color: #c2c2c2;
}
.remove{
padding: 0 30rpx;
}
}
.bottom{
height: 50rpx;
}
.custom-style {
margin: 10rpx 0;
width: 220rpx;
}
.custom-active-style {
margin: 10rpx 0;
width: 220rpx;
color: #ffffff;
background-color: #51b2aa;
}
}
}
</style>

View File

@@ -0,0 +1,451 @@
<template>
<view>
<view class="select-date">
<view class="caterer-user" v-if="order">取餐人{{ order.nickname }}</view>
<text>{{ deliveryTime }}</text>
</view>
<view class="order" v-if="canteenGoods.length > 0">
<block>
<view class="title">
<text>食堂档口</text>
</view>
<view class="fenqi">
<block v-for="(item,index) in canteenGoods" :key="index">
<view class="item" v-if="item.totalNum > 0">
<image class="image" :src="item.imageUrl" mode="aspectFill"></image>
<view class="goods-info">
<view class="goods-name">
<text class="name">{{ item.goodsName }}</text>
<text class="selling-point">{{ item.comments }}</text>
</view>
<view class="goods-price">
<text class="price">{{ item.goodsPrice }}</text>
<text class="num"> x {{ item.totalNum }}</text>
</view>
</view>
</view>
</block>
</view>
</block>
</view>
<view class="order" v-if="entityGoods.length > 0">
<block>
<view class="title">
<text>物品档口</text>
</view>
<view class="fenqi">
<block v-for="(item,index) in entityGoods" :key="index">
<view class="item" v-if="item.totalNum > 0">
<image class="image" :src="item.imageUrl" mode="aspectFill"></image>
<view class="goods-info">
<view class="goods-name">
<text class="name">{{ item.goodsName }}</text>
<text class="selling-point">{{ item.comments }}</text>
</view>
<view class="goods-price">
<text class="price">{{ item.goodsPrice }}</text>
<text class="num"> x {{ item.totalNum }}</text>
</view>
</view>
</view>
</block>
</view>
</block>
</view>
<!-- <empty v-if="canteenGoods.length == 0 && entityGoods.length == 0" tips="暂无信息" /> -->
<view class="submit" v-if="canteenGoods.length > 0 || entityGoods.length > 0">
<u-button type="success" :disabled="showQrCode" @click="verificationQrCode">确认核销</u-button>
</view>
<u-modal v-model="showQrCode" confirmText="取消" title="核销码">
<view>
<image :src="qrcode" class="qrcode"></image>
</view>
</u-modal>
<u-calendar v-model="show" mode="date" :min-date="minDate" :max-date="maxDate" @change="changeDate">
</u-calendar>
</view>
</template>
<script>
import {
dateFormat
} from '@/utils/util.js'
import store from '@/store';
// import Empty from '@/components/empty'
import * as UserApi from '@/api/user.js'
import * as OrderApi from '@/api/order.js'
import * as OrderGoodsApi from '@/api/order-goods.js'
export default {
components: {
// Empty
// Search
},
data() {
return {
totalPrice: 0,
list: [],
canteenGoods: [],
entityGoods: [],
order: null,
orderId: null,
orderNo: null,
deliveryTime: null,
record: {},
minDate: dateFormat('YYYY-mm-dd', new Date()),
maxDate: '2030-01-01',
deliveryTime: dateFormat('YYYY-mm-dd',new Date()), // var startDate= new Date(new Date().toLocaleDateString());
show: false,
// 正在加载中
isLoading: true,
verification: false,
// 当前选择的设备ID
goodsId: null,
agentUserId: null,
catererUserId: null,
catererUser: null,
mode: 'range',
month: 6,
agree: true,
price: {
batteryRent: 300,
batteryDeposit: 300,
batteryInsurance: 0
},
customStyle: {
marginTop: '20px', // 注意驼峰命名,并且值必须用引号包括,因为这是对象
backgroundColor: '#51b2aa'
},
showQrCode: false,
qrcode: ''
}
},
onLoad(options) {
this.options = options
this.userId = options.userId
this.dealerId = options.dealerId
this.getUserInfo()
this.getOrder()
},
onShow() {
// this.getCatererUser()
},
methods: {
// 跳转页面
navTo(url) {
uni.$u.route(url);
},
getUserInfo() {
const { form } = this
const app = this
UserApi.getUser().then(res => {
if( res.code == 0 && res.data.username != 'www') {
app.userInfo = res.data
res.data.roles.map(d => {
if(d.roleCode == 'verification'){
app.verification = true
}
})
}
})
},
getOrder() {
const app = this
const {
deliveryTime,
userId
} = this
// 核销订单查询
OrderApi.getReceiptOrder({
deliveryTime: dateFormat('YYYY-mm-dd', new Date()),
orderStatus: 10,
userId
}).then(res => {
if (res.data) {
if(res.code == 0 && res.data.length > 0){
const goodsList = res.data[0].goodsList
app.order = res.data[0]
app.orderId = res.data[0].orderId
app.orderNo = res.data[0].orderNo
app.canteenGoods = []
app.entityGoods = []
app.list = goodsList.map(d => {
if (d.gear == 10) {
app.canteenGoods.push(d)
}
if (d.gear == 20) {
app.entityGoods.push(d)
}
})
}
}
})
},
// 核销
verificationQrCode() {
const app = this
const { orderId, verification } = this
console.log("verification: ",verification);
if(verification == false){
app.$error("没有核销权限")
return false
}
OrderApi.verificationQrCode({
orderId
}).then(result => {
app.$success(result.message)
app.getOrder()
})
},
// getCatererUser() {
// const app = this
// const catererUser = uni.getStorageSync('catererUser')
// if (catererUser) {
// app.catererUser = catererUser
// app.catererUserId = catererUser.userId
// app.agentUserId = catererUser.userId
// app.getMyOrder()
// }
// },
onClose() {
this.showQrCode = false
},
onChangeStepper({
value
}) {
this.month = value
},
change(e) {
console.log(e);
},
openCalendar() {
this.show = true
},
changeDate(date) {
this.deliveryTime = date.result
this.getMyOrder()
},
onInput(month) {
this.month = month
},
onAgree() {
this.agree = !this.agree
},
showXieyi() {
this.$navTo('pages/help/xieyi')
},
copyCode(text) {
// #ifndef H5
console.log("text: ", text);
uni.setClipboardData({
text: text,
success: (result) => {
this.$success("复制成功")
}
})
// #endif
// #ifdef H5
let textarea = document.createElement("textarea")
textarea.value = text
textarea.readOnly = "readOnly"
document.body.appendChild(textarea)
textarea.select() // 选中文本内容
textarea.setSelectionRange(0, info.length)
uni.showToast({ //提示
title: '复制成功'
})
result = document.execCommand("copy")
textarea.remove()
// #endif
}
}
}
</script>
<style lang="scss" scoped>
// .goods-info {
// background-color: #ffffff;
// border-radius: 12rpx;
// width: 700rpx;
// margin: 20rpx auto;
// .goods {
// padding: 20rpx;
// display: flex;
// image {
// width: 220rpx;
// height: 220rpx;
// margin: 20rpx;
// }
// .info {
// display: flex;
// flex-direction: column;
// padding: 20rpx;
// .goods-name {
// font-size: 34rpx;
// margin-bottom: 10rpx;
// }
// .goods-desc {
// font-size: 28rpx;
// color: #999999;
// }
// .selling-point{
// padding: 5px 0;
// color: #e6760e;
// }
// }
// }
// .between-time {
// width: 500rpx;
// margin: auto;
// padding-bottom: 20rpx;
// text-align: center;
// .select-slider {
// line-height: 2em;
// color: #e6760e;
// }
// }
// }
.order {
background-color: #ffffff;
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
.title {
font-weight: bold;
font-size: 30rpx;
padding: 20rpx;
display: flex;
justify-content: space-between;
}
.xieyi {
padding: 20rpx;
font-size: 26rpx;
}
}
.submit {
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
}
.xieyi-text {
color: #0000ff;
}
.fenqi {
padding: 30rpx;
border-top: 1px solid #eee;
.item {
display: flex;
padding: 20rpx 0;
.image {
width: 160rpx;
height: 120rpx;
}
.goods-info {
width: 460rpx;
margin-left: 10rpx;
display: flex;
justify-content: space-between;
.goods-name {
text-align: left;
display: flex;
flex-direction: column;
.name {
font-weight: 500;
max-width: 300rpx;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //溢出内容隐藏
text-overflow: ellipsis; //文本溢出部分用省略号表示
display: -webkit-box; //特别显示模式
-webkit-line-clamp: 2; //行数
line-clamp: 2;
-webkit-box-orient: vertical; //盒子中内容竖直排列
}
.selling-point {
max-width: 300rpx;
color: #999999;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //溢出内容隐藏
text-overflow: ellipsis; //文本溢出部分用省略号表示
display: -webkit-box; //特别显示模式
-webkit-line-clamp: 1; //行数
line-clamp: 1;
-webkit-box-orient: vertical; //盒子中内容竖直排列
}
}
.goods-price {
display: flex;
flex-direction: column;
.price {
color: #ff0000;
}
.num {
text-align: right;
color: #cccccc;
}
}
}
}
}
.select-date {
text-align: center;
line-height: 2.4rem;
background-color: #ffffff;
border-bottom: 15rpx solid #f3f3f3;
display: flex;
justify-content: space-around;
.caterer-user {
color: #ff0000;
}
.icon {
margin-left: 10rpx;
}
}
.on-buy {
background-color: #804002;
}
.qrcode {
margin: auto;
display: flex;
justify-content: center;
width: 360rpx;
height: 360rpx;
}
</style>

637
sub_pages/order/detail.vue Executable file
View File

@@ -0,0 +1,637 @@
<template>
<view class="container">
<view class="select-date">
<view class="arrow-left" @click="previous">
<u-icon class="icon" name="arrow-left"></u-icon>
<text>前一天</text>
</view>
<view class="agent-user" v-if="agentUser" @click="navTo('pages/menu/select-user/select-user')">
<span>{{ agentUser.nickname }}</span>
<u-icon class="icon" name="arrow-down-fill"></u-icon>
</view>
<view class="delivery-time" @click="openCalendar">
<span>{{ deliveryTime }}</span>
<u-icon class="calendar" name="calendar"></u-icon>
</view>
<view class="arrow-right" @click="next">
<text>后一天</text>
<u-icon class="icon" name="arrow-right"></u-icon>
</view>
<u-calendar v-model="show" mode="date" :default-date="minDate" :min-date="minDate" :max-date="maxDate"
@change="changeDate"></u-calendar>
</view>
<block v-for="(item,index) in list" :key="index">
<!-- {{ new Date(deliveryTime).getTime() }} == {{ now }} -->
<view class="order">
<view class="title" v-if="item.categoryId == 25">
<text>早餐</text>
<view>
<u-button type="warning" v-if="new Date(deliveryTime).getTime() > now" size="mini"
@click="onCancel(item)">取消</u-button>
</view>
</view>
<view class="title" v-if="item.categoryId == 26">
<text>午餐</text>
<view>
<u-button type="warning" v-if="new Date(deliveryTime).getTime() > now" size="mini"
@click="onCancel(item)">取消</u-button>
</view>
</view>
<view class="title" v-if="item.categoryId == 27">
<text>晚餐</text>
<view>
<u-button type="warning" v-if="new Date(deliveryTime).getTime() > now" size="mini"
@click="onCancel(item)">取消</u-button>
</view>
</view>
<view class="fenqi">
<block>
<view class="item">
<image class="image" :src="item.imageUrl" mode="aspectFill"></image>
<view class="goods-info">
<view class="goods-name">
<text class="name">{{ item.goodsName }}</text>
<text class="selling-point" v-if="item.gear == 10">食堂档口</text>
<text class="selling-point" v-if="item.gear == 20">物品档口</text>
</view>
<view class="goods-price">
<text class="price">{{ item.goodsPrice }}</text>
<text class="num"> x {{ item.totalNum }}</text>
<text class="num">{{ item.deliveryStatus == 10 ? '待签到' : '已签到' }}</text>
</view>
</view>
</view>
</block>
</view>
</view>
</block>
<!-- 临时报餐 -->
<block v-if="temporary && !agentUser">
<view class="order">
<view class="title">
<text>临时报餐</text>
</view>
<view class="fenqi">
<block v-for="(item,index) in temporary.goodsList" :key="index">
<view class="item">
<image class="image" :src="item.imageUrl" mode="aspectFill"></image>
<view class="goods-info">
<view class="goods-name">
<text class="name">{{ item.goodsName }}</text>
<text class="selling-point" v-if="item.gear == 10">食堂档口</text>
<text class="selling-point" v-if="item.gear == 20">物品档口</text>
<text class="selling-point" v-if="item.categoryId == 25">早餐</text>
<text class="selling-point" v-if="item.categoryId == 26">午餐</text>
<text class="selling-point" v-if="item.categoryId == 27">晚餐</text>
</view>
<view class="goods-price">
<text class="price">{{ item.goodsPrice }}</text>
<text class="num"> x {{ item.totalNum }}</text>
<text class="num">{{ item.deliveryStatus == 10 ? '待签到' : '已签到' }}</text>
</view>
</view>
</view>
</block>
</view>
</view>
</block>
<empty v-if="list.length == 0" tips="暂无信息" />
<!-- 与包裹页面所有内容的元素u-page同级且在它的下方 -->
<!-- <u-tabbar v-model="current" :list="tabbar"></u-tabbar> -->
</view>
</template>
<script>
import {
getUser
} from '@/api/user.js'
import {
dateFormat
} from '@/utils/util.js'
import {
createOrderNo
} from '@/utils/util.js'
import store from '@/store';
import Empty from '@/components/empty'
import {
payQuery
} from '@/api/payment.js'
import * as OrderApi from '@/api/order.js'
import * as OrderGoodsApi from '@/api/order-goods.js'
export default {
components: {
Empty
// Search
},
data() {
return {
tabbar: [{
iconPath: "static/tabbar/home.png",
selectedIconPath: "static/tabbar/home-active.png",
text: '首页',
isDot: true,
customIcon: true,
},
{
iconPath: "play-right",
selectedIconPath: "play-right-fill",
text: '报餐',
customIcon: false,
},
// {
// iconPath: "play-right",
// selectedIconPath: "play-right-fill",
// text: '消息',
// customIcon: false,
// },
{
iconPath: "account",
selectedIconPath: "account-fill",
text: '我的',
isDot: false,
customIcon: false,
},
],
current: 0,
disabled: false,
totalPrice: 0,
list: [],
temporary: null,
agentUserId: null,
agentUser: null,
canteenGoods: [],
entityGoods: [],
orderId: null,
record: {},
minDate: '2023-04-01',
maxDate: dateFormat('YYYY-mm-dd', new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 *
60 * 1000 * 7)),
deliveryTime: dateFormat('YYYY-mm-dd',
new Date()), // var startDate= new Date(new Date().toLocaleDateString());
now: new Date().getTime(),
daynow: new Date(new Date(new Date().toLocaleDateString()).getTime()).getTime(),
today: new Date(new Date(new Date().toLocaleDateString()).getTime()).getTime(),
show: false,
dateFormat,
// 正在加载中
isLoading: true,
// 当前选择的设备ID
goodsId: null,
mode: 'range',
month: 6,
agree: true,
price: {
batteryRent: 300,
batteryDeposit: 300,
batteryInsurance: 0
},
customStyle: {
marginTop: '20px', // 注意驼峰命名,并且值必须用引号包括,因为这是对象
backgroundColor: '#51b2aa'
},
isShowCancel: true
}
},
onLoad(option) {
const app = this
app.orderId = option.orderId
if (option.deliveryTime) {
app.deliveryTime = option.deliveryTime
}
},
onShow() {
// 是否代理报餐
this.getAgentUser()
// 是否已下过单
this.getMyOrder()
this.isCancel()
// 查询临时报餐明细
this.getTemporaryFood()
},
methods: {
isCancel() {
const today = new Date().getTime()
// console.log("this.isShowCancel: ",this.isShowCancel);
// console.log(this.deliveryTime + '=========' + today);
// console.log(Date.parse(this.deliveryTime) + '=======' + today);
if (Date.parse(this.deliveryTime) <= today) {
this.isShowCancel = false
} else {
this.isShowCancel = true
}
},
isDisabled(item) {
console.log("isDisabled: ", item);
},
getTemporaryFood() {
const app = this
const {
deliveryTime
} = this
console.log("deldeliveryTime: ",deliveryTime);
OrderApi.getTemporaryOrder({
isTemporary: 1,
deliveryTime
}).then(res => {
app.temporary = res.data
console.log("res: ", res.data);
}).catch(err => {
console.log("err: ",err);
})
},
// getToday(){
// this.today = dateFormat('YYYY-mm-dd',new Date())
// },
// getOrder(){
// const app = this
// const { orderId } = this
// OrderApi.getOrder(orderId).then(res => {
// app.record = res.data
// app.deliveryTime = dateFormat('YYYY-mm-dd',new Date(res.data.deliveryTime))
// OrderGoodsApi.listOrder({orderId}).then(res => {
// console.log("res.data: ",res.data);
// app.list = [];
// app.list = res.data.map(d => {
// if(d.gear == 10){
// app.canteenGoods.push(d)
// }
// if(d.gear == 20){
// app.entityGoods.push(d)
// }
// })
// })
// })
// },
getAgentUser() {
const app = this
const agentUser = uni.getStorageSync('agentUser')
if (agentUser) {
app.agentUser = agentUser
app.agentUserId = agentUser.userId
}
},
getMyOrder() {
const app = this
const {
orderId,
deliveryTime,
agentUserId
} = this
app.list = []
// app.canteenGoods = [];
// app.entityGoods = [];
// 加载今天报餐明细
OrderApi.getMyOrder({
orderId,
deliveryTime,
agentUserId
}).then(res => {
if (res.data) {
console.log("res.data: ", res.data.orderId);
const goodsList = res.data.goodsList
app.list = goodsList.filter(d => d.totalNum > 0)
app.orderId = res.data.orderId
// app.list = goodsList.map(d => {
// if(d.gear == 10){
// app.canteenGoods.push(d)
// }
// if(d.gear == 20){
// app.entityGoods.push(d)
// }
// })
}
})
},
// 取消单个菜品
onCancel(item) {
console.log("item.orderGoodsId: ", item.orderGoodsId);
OrderGoodsApi.cancelfood(item).then(res => {
this.$toast(res.message)
this.getAgentUser()
// 是否已下过单
this.getMyOrder()
})
},
cancelOrder() {
const {
orderId
} = this
console.log("orderId: ", orderId);
OrderApi.cancelOrder({
orderId
}).then(res => {
this.$toast(res.message)
this.getMyOrder()
}).catch(err => {
this.$toast(err.message)
})
},
onChangeStepper({
value
}) {
this.month = value
},
change(e) {
console.log(e);
},
openCalendar() {
this.show = true
},
changeDate(date) {
this.deliveryTime = date.result
this.getMyOrder()
this.isCancel()
},
onInput(month) {
this.month = month
},
onAgree() {
this.agree = !this.agree
},
// 跳转页面
navTo(url) {
uni.$u.route(url);
},
showXieyi() {
this.$navTo('pages/help/xieyi')
},
previous() {
// 前一天
this.today = this.today - 24 * 60 * 60 * 1000
this.deliveryTime = dateFormat('YYYY-mm-dd', new Date(this.today))
this.getAgentUser()
this.getMyOrder()
this.getTemporaryFood()
},
next() {
// 后一天
// console.log("this.today: ",this.today);
this.today = this.today + 24 * 60 * 60 * 1000
// console.log("this.today-------: ",this.today);
this.deliveryTime = dateFormat('YYYY-mm-dd', new Date(this.today))
// console.log("this.deliveryTime: ",this.deliveryTime);
this.getAgentUser()
this.getMyOrder()
this.getTemporaryFood()
},
// 比较时间大小
compare() {
// 预定开始时间
const deliveryTime = new Date(this.deliveryTime).getTime()
// 今天开始时间
const todayStartTime = new Date(dateFormat('YYYY-mm-dd', new Date(this.daynow))).getTime()
if (todayStartTime > deliveryTime) {
return true
} else {
return false
}
},
copyCode(text) {
// #ifndef H5
console.log("text: ", text);
uni.setClipboardData({
text: text,
success: (result) => {
this.$success("复制成功")
}
})
// #endif
// #ifdef H5
let textarea = document.createElement("textarea")
textarea.value = text
textarea.readOnly = "readOnly"
document.body.appendChild(textarea)
textarea.select() // 选中文本内容
textarea.setSelectionRange(0, info.length)
uni.showToast({ //提示
title: '复制成功'
})
result = document.execCommand("copy")
textarea.remove()
// #endif
}
}
}
</script>
<style lang="scss" scoped>
// .goods-info {
// background-color: #ffffff;
// border-radius: 12rpx;
// width: 700rpx;
// margin: 20rpx auto;
// .goods {
// padding: 20rpx;
// display: flex;
// image {
// width: 220rpx;
// height: 220rpx;
// margin: 20rpx;
// }
// .info {
// display: flex;
// flex-direction: column;
// padding: 20rpx;
// .goods-name {
// font-size: 34rpx;
// margin-bottom: 10rpx;
// }
// .goods-desc {
// font-size: 28rpx;
// color: #999999;
// }
// .selling-point{
// padding: 5px 0;
// color: #e6760e;
// }
// }
// }
// .between-time {
// width: 500rpx;
// margin: auto;
// padding-bottom: 20rpx;
// text-align: center;
// .select-slider {
// line-height: 2em;
// color: #e6760e;
// }
// }
// }
.order {
background-color: #ffffff;
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
.title {
font-weight: bold;
font-size: 30rpx;
padding: 20rpx;
display: flex;
justify-content: space-between;
}
.title2 {
font-weight: bold;
font-size: 30rpx;
padding: 20rpx;
display: flex;
color: #ff0000;
justify-content: space-between;
}
.xieyi {
padding: 20rpx;
font-size: 26rpx;
}
}
.submit {
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
}
.xieyi-text {
color: #0000ff;
}
.fenqi {
padding: 30rpx;
border-top: 1px solid #eee;
.item {
display: flex;
padding: 20rpx 0;
.image {
width: 160rpx;
height: 120rpx;
}
.goods-info {
width: 460rpx;
margin-left: 10rpx;
display: flex;
justify-content: space-between;
.goods-name {
text-align: left;
display: flex;
flex-direction: column;
.name {
font-weight: 500;
max-width: 300rpx;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //溢出内容隐藏
text-overflow: ellipsis; //文本溢出部分用省略号表示
display: -webkit-box; //特别显示模式
-webkit-line-clamp: 2; //行数
line-clamp: 2;
-webkit-box-orient: vertical; //盒子中内容竖直排列
}
.selling-point {
max-width: 300rpx;
color: #999999;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //溢出内容隐藏
text-overflow: ellipsis; //文本溢出部分用省略号表示
display: -webkit-box; //特别显示模式
-webkit-line-clamp: 1; //行数
line-clamp: 1;
-webkit-box-orient: vertical; //盒子中内容竖直排列
}
}
.goods-price {
display: flex;
flex-direction: column;
.price {
color: #ff0000;
display: flex;
justify-content: right;
}
.num {
text-align: right;
color: #cccccc;
}
}
}
}
}
.select-date {
text-align: center;
line-height: 2.4rem;
background-color: #ffffff;
border-bottom: 15rpx solid #f3f3f3;
display: flex;
justify-content: space-between;
.agent-user {
color: #ff0000;
}
.icon {
font-size: 34rpx;
}
.arrow-left {
display: flex;
flex-direction: row;
align-items: center;
margin-left: 20rpx;
text {
padding: 0 5px;
}
}
.arrow-right {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 12rpx;
text {
padding: 0 5px;
}
}
.delivery-time {
display: flex;
flex-direction: row;
justify-content: center;
}
.calendar {
margin: 0 5rpx;
}
}
.on-buy {
background-color: #804002;
}
</style>

View File

@@ -0,0 +1,185 @@
<template>
<view class="bg">
<view class="qrcode-box">
<block>
<view class="title line-align">
<view>欢迎使用贵港自然资源云报餐系统</view>
</view>
<view class="qrcode" v-if="!qrcode">今日无报餐记录</view>
<view class="qrcode">
<image :src="qrcode"></image>
</view>
</block>
</view>
<view class="bottom">
贵港自然资源局
</view>
</view>
</template>
<script>
import store from '@/store/index.js'
import storage from '@/utils/storage'
import { ACCESS_TOKEN, USER_ID } from '@/store/mutation-types'
import { pageAgentUser } from '@/api/apps-bc-agent.js'
import { getSetting } from '@/api/setting.js'
import { checkLogin } from '@/core/app.js'
import * as UserRefereeApi from '@/api/user-referee.js'
import * as OrderApi from '@/api/order.js'
import * as UserApi from '@/api/user.js'
import Empty from '@/components/empty'
import { userId } from '@/config'
export default {
components: {
// Search,
Empty
},
data() {
return {
orderId: 0,
qrcode: null
}
},
onLoad() {
},
onShow() {
// if(!checkLogin()){
// return this.$navTo('pages/login/index')
// }
// 扫码取餐
this.getFoodQrCode()
},
methods: {
navTo(merchantId) {
const navTo = uni.$u.route()
navTo('pages/merchant/detail', {
merchantId
})
},
getFoodQrCode(){
OrderApi.generateQrCode().then(res => {
if(res.code == 0){
this.qrcode = res.data
}else{
// this.qrcode = 'https://file.gxwebsoft.com/qrcode/' + uni.getStorageSync('userId') + '/payQrCode.jpg'
this.$toast(res.message)
}
}).catch(err => {
console.log("err: ",err);
})
}
}
}
</script>
<style lang="scss" scoped>
page{
background-color: #67e7dd;
}
.bg {
background-image: linear-gradient(#51b2aa, #67e7dd);
height: calc(100vh - var(--window-top));
padding: 70rpx 0;
display: flex;
flex-direction: column;
justify-content: space-around;
.bottom{
height: 150rpx;
font-size: 37rpx;
color: #51b2aa;
text-align: center;
display: flex;
justify-content: center;
}
}
.qrcode-box{
width: 660rpx;
margin: auto;
background-color: #ffffff;
border-radius: 20rpx;
.title{
padding: 12rpx 0;
display: flex;
justify-content: space-around;
line-height: 80rpx;
font-size: 34rpx;
color: #51b2aa;
.active{
color: #51b2aa;
}
}
.line-align{
width: 580rpx;
margin: auto;
border-bottom: 1rpx solid #eeeeee;
}
.qrcode{
padding-bottom: 20rpx;
color: #666666;
margin: 24rpx auto;
display: flex;
justify-content: center;
image{
width: 500rpx;
height: 500rpx;
}
}
.desc{
color: blue;
display: flex;
text-align: center;
justify-content: center;
padding-bottom: 24rpx;
}
.user-list{
width: 580rpx;
margin: auto;
display: flex;
flex-direction: column;
.item{
border-bottom: 1rpx solid #eeeeee;
display: flex;
justify-content: space-between;
align-items: center;
padding: 10rpx 0;
.info{
.food{
color: #ff0000;
.goods-name{
padding-right: 10rpx;
}
}
.is-buy{
color: #ff0000;
}
.no-buy{
color: #0000ff;
}
.order-ok{
color: #51b2aa;
}
}
.time{
color: #c2c2c2;
}
.remove{
padding: 0 30rpx;
}
}
.custom-style {
margin: 10rpx 0;
width: 220rpx;
}
.custom-active-style {
margin: 10rpx 0;
width: 220rpx;
color: #ffffff;
background-color: #51b2aa;
}
}
}
</style>

451
sub_pages/order/index.vue Executable file
View File

@@ -0,0 +1,451 @@
<template>
<view class="container">
<view class="tabs">
<u-tabs :list="tabs" @click="onChangeTab" lineColor="#ff0000"></u-tabs>
</view>
<!-- 订单列表 -->
<view class="order-list" v-if="list">
<view class="order-item" v-for="(item, index) in list" :key="index">
<view class="item-top">
<view class="item-top-left">
<text class="order-time">
{{ item.planName }}
</text>
</view>
<view class="item-top-right">
<u-tag text="待支付" plain size="mini" type="warning" v-if="item.payStatus == 10"></u-tag>
<u-tag text="已支付" plain size="mini" type="success"
v-else="item.payStatus == 20 && item.receiptStatus == 10"></u-tag>
</view>
</view>
<u-divider></u-divider>
<!-- 商品列表 -->
<view class="goods-list">
<block>
<view class="goods-item">
<view class="icon">
<image :src="item.planIcon" mode="widthFix"></image>
</view>
<view class="goods-content">
<text class="goods-title">订单号{{ item.logId }}</text>
<text class="goods-title">描述{{ item.priceName }}</text>
<text class="goods-title">价格{{ item.money }}</text>
<text class="goods-title">时间{{ item.createTime }}</text>
<text class="goods-title">状态{{ item.isSettled == 1 && item.status == 0 ? '已生效' : '处理中' }}</text>
<block v-if="item.planId == 17 || item.planId == 18">
<text class="goods-title">服务门店{{ item.merchantName }}</text>
<text class="goods-title">有效期至{{ item.expirationTime }}</text>
<text class="goods-title">门店地址{{ item.address }}</text>
</block>
</view>
</view>
</block>
</view>
<u-divider></u-divider>
<!-- 订单合计 -->
<view class="order-total">
<text>合计</text>
<text class="unit" style="color: #ff0000;"></text>
<text class="money">{{ item.money }}</text>
</view>
<!-- 订单操作 -->
</view>
</view>
<u-loadmore v-if="list.length > 0" :status="status" />
<u-empty mode="order" icon="http://cdn.uviewui.com/uview/empty/order.png" v-if="list.length == 0">
</u-empty>
<u-gap height="20"></u-gap>
</view>
</template>
<script>
import store from '@/store/index.js'
import * as UserPlanLogApi from '@/api/love-user-plan-log.js'
import {
dateFormat,
getWeek
} from '@/utils/util.js'
// 每页记录数量
const pageSize = 10
const userId = uni.getStorageSync('userId')
// tab栏数据
const tabs = [{
name: `我的订单`,
value: 'delivery'
}]
export default {
data() {
return {
// 当前页面参数
options: {
dataType: 'all'
},
// tab栏数据
tabs,
// 当前标签索引
curTab: 0,
// 订单列表数据
list: [],
total: 0,
loadMore: true,
status: '加载更多',
page: 1,
where: {
userId
},
// 选择的设备
getWeek,
dateFormat,
userId
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.onRefreshList()
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
// 触底函数
onReachBottom() {
const app = this
if (app.loadMore) {
app.page = ++app.page;
app.onRefreshList()
}
},
onPullDownRefresh() {
const app = this
app.page = 1
app.list = []
app.onRefreshList();
uni.stopPullDownRefresh();
},
methods: {
// 切换标签项
onChangeTab(e) {
const app = this
// 设置当前选中的标签
app.curTab = e.index
app.page = 1
app.list = []
// 刷新订单列表
app.onRefreshList()
},
// 刷新订单列表
onRefreshList() {
const app = this
const {
curTab
} = this
app.where.showGoodsList = true
app.where.page = app.page
app.where.payStatus = 20;
app.where.receiptStatus = 10;
app.where.agent = undefined
console.log("curTab: ",curTab);
if (curTab == 0) {
// app.where.agent = undefined
// app.where.payStatus = 20;
// app.where.receiptStatus = 10;
}
if (curTab == 1) {
app.where.agent = true
// app.where.payStatus = 20;
// app.where.receiptStatus = 10;
}
// if (curTab == 2) {
// app.where.agent = undefined
// app.where.payStatus = 20;
// app.where.receiptStatus = 10;
// }
// 只查询已支付订单
UserPlanLogApi.pageUserPlanLog(app.where).then(res => {
const newList = res.data.list
if (newList.length > 0) {
app.list = app.list.concat(newList)
} else {
app.status = '没有更多了'
app.loadMore = false
}
})
},
// 取消订单
onCancel(orderId) {
const app = this
uni.showModal({
title: '友情提示',
content: '确认要取消该订单吗?',
success(o) {
if (o.confirm) {
OrderApi.removeOrder(orderId)
.then(result => {
// 显示成功信息
app.$toast(result.message)
// 刷新订单列表
app.list = []
app.onRefreshList()
})
}
}
});
},
onCancelOne(item) {
const app = this
// 报餐截止时间
let date = new Date();
if (date.getHours() > 20 && date.getMinutes() > 30) {
return app.$toast('报餐截止时间')
}
OrderGoodsApi.cancelfood(item).then(res => {
app.$toast(res.message)
// 刷新订单列表
app.list = []
app.onRefreshList()
})
},
// 点击去支付
onPay(orderIds) {
this.$navTo('pages/checkout/cashier/index', {
orderIds
})
},
// 跳转到订单详情页
handleTargetDetail(orderId) {
this.$navTo('pages/order/detail', {
orderId
})
},
// 跳转到订单评价页
handleTargetComment(orderId) {
this.$navTo('pages/order/comment/index', {
orderId
})
},
getDeliveryTime(time) {
return dateFormat('YYYY-mm-dd', new Date(new Date(time).toLocaleDateString()));
}
},
}
</script>
<style lang="scss" scoped>
page{
background-color: #f3f3f3 !important;
}
.container {
width: 750rpx;
background-color: #f3f3f3;
}
.order-list {}
// 项目内容
.order-item {
padding: 30rpx;
margin: 20rpx auto 10rpx auto;
width: 660rpx;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.1);
border-radius: 15rpx;
background: #fff;
}
// 项目顶部
.item-top {
display: flex;
justify-content: space-between;
font-size: 26rpx;
margin-bottom: 20rpx;
.order-time {
color: #333333;
font-size: 26rpx;
font-weight: 600;
}
.state-text {
color: $main-bg;
}
}
// 商品列表
.goods-list {
// 商品项
.goods-item {
display: flex;
margin-bottom: 20rpx;
.cancel {
width: 70rpx;
position: absolute;
top: 4rpx;
right: 0;
}
.icon {
width: 100rpx;
height: 100rpx;
border-radius: 100rpx;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
background: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%221%22%20x1%3D%220%22%20x2%3D%221%22%20y1%3D%220%22%20y2%3D%220%22%20gradientTransform%3D%22matrix(6.123233995736766e-17%2C%201%2C%20-0.024693877551020406%2C%206.123233995736766e-17%2C%200.5%2C%200)%22%3E%3Cstop%20stop-color%3D%22%230a060d%22%20stop-opacity%3D%221%22%20offset%3D%220%22%3E%3C%2Fstop%3E%3Cstop%20stop-color%3D%22%23660061%22%20stop-opacity%3D%221%22%20offset%3D%220.95%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22url(%231)%22%3E%3C%2Frect%3E%3C%2Fsvg%3E');
// background: linear-gradient(to bottom, #010002, #681752);
image {
width: 50rpx;
}
}
// 商品图片
.goods-image {
width: 120rpx;
height: 90rpx;
.image {
display: block;
width: 120rpx;
height: 90rpx;
border-radius: 8rpx;
}
}
// 商品内容
.goods-content {
width: 500rpx;
padding-left: 16rpx;
padding-top: 0;
display: flex;
color: #666666;
flex-direction: column;
position: relative;
.goods-title {
font-size: 26rpx;
max-height: 76rpx;
line-height: 36rpx;
}
.goods-props {
margin-top: 14rpx;
height: 40rpx;
color: #ababab;
font-size: 24rpx;
overflow: hidden;
.goods-props-item {
display: inline-block;
margin-right: 14rpx;
padding: 4rpx 16rpx;
border-radius: 12rpx;
background-color: #F5F5F5;
width: auto;
}
}
}
// 交易信息
.goods-trade {
padding-top: 16rpx;
width: 200rpx !important;
text-align: right;
color: $uni-text-color-grey;
font-size: 26rpx;
.goods-price {
vertical-align: bottom;
margin-bottom: 16rpx;
.unit {
margin-right: -2rpx;
font-size: 24rpx;
}
}
}
}
}
// 订单合计
.order-total {
font-size: 26rpx;
vertical-align: bottom;
text-align: right;
height: 50rpx;
padding-top: 10rpx;
.unit {
margin-left: 8rpx;
margin-right: -2rpx;
font-size: 26rpx;
}
.money {
font-size: 28rpx;
color: #ff0000;
}
}
// 订单操作
.order-handle {
.btn-group {
.btn-item {
border-radius: 10rpx;
padding: 8rpx 20rpx;
margin-left: 15rpx;
font-size: 26rpx;
float: right;
color: #383838;
border: 1rpx solid #a8a8a8;
&:last-child {
margin-left: 0;
}
&.active {
color: $main-bg;
border: 1rpx solid $main-bg;
}
}
}
}
.tabs {
width: 600rpx;
margin: auto;
display: flex;
justify-content: center;
}
.yuqi-text {
color: #ff0000;
}
</style>