Commit 9e28ebee by 胡悦

Merge branch 'V4.56.0' of http://192.168.3.233:8090/glsx/gl_tape into V4.56.0

2 parents 74fc6ae4 70cd0bf7
......@@ -213,4 +213,19 @@ module.exports = {
...data
})
},
/** 查询该店员工日报是否开启 */
staffDailyReportMerchantValid(data) {
// return api.post('dj.api.smartcarlife.staff.daily.report.merchant.valid', data)
return http.post({ method: 'dj.api.smartcarlife.staff.daily.report.popup.need', projectName: 'boutique', ...data })
},
/** 校验手机号是否配置打卡和是否打卡 */
clockInConfigPhone(data) {
// return api.post('dj.api.smartcarlife.staff.daily.report.merchant.valid', data)
return http.post({ method: 'dj.api.smartcarlife.clock.in.config.phone', projectName: 'boutique', ...data })
},
/** 获取商户基本信息 */
getServiceBaseInfo(data) {
return http.post({ method: 'dj.api.smartcarlife.serviceMerchant.getServiceBaseInfo', projectName: 'boutique', ...data })
}
}
......@@ -55,6 +55,12 @@
-webkit-justify-content: center;
justify-content: center;
}
.justify-end {
-webkit-box-pack: end;
-ms-flex-pack: end;
-webkit-justify-content: flex-end;
justify-content: flex-end;
}
.flex-wrap {
-ms-flex-wrap: wrap;
......

2.54 MB | W: | H:

2.54 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -76,7 +76,6 @@ export default {
arr.push(c)
}
})
console.log(arr)
this.searchList = arr
this.searchStatus = true
}
......
<template>
<view class="goods-list">
<!-- <template v-if="list.length"> -->
<template v-for="(item, index) in (searchStatus ? searchList : list)">
<view
:key="index"
@click="choose(item)"
:class="['item',{active: checkActive(item)}]"
>
<view class="title flex">
<view class="icon">
<uni-icons
type="circle"
:size="16"
color="#8C8C8C"
class="uni-icons"
></uni-icons>
<view class="sprite-icon icon-notice-success"></view>
</view>
{{item.packageGoods.packageAlias||item.packageGoods.packageName}}
<text class="price">¥{{item.packageGoods.upgradePrice}}</text>
</view>
<view class="package-list">
<template v-for="(i,ind) in item.packageGoods.goodsList">
<view
class="package-item flex"
:key="ind"
>
<view class="name">{{i.goodsAlias||i.upgradeGoodsAlias||i.upgradeGoodsName}}</view>
<view class="price">¥{{i.sellPrice}}</view>
</view>
</template>
</view>
</view>
</template>
<!-- </template> -->
</view>
</template>
<script type='text/ecmascript-6'>
import NP from 'number-precision'
export default {
name: 'GoodsList',
inject: ['userInfo', 'baseConfigData'],
data () {
return {
list: [],
currentIds: [],
chooseList: [],
searchStatus: false,
searchList: [],
}
},
props: {
params: Object,
data: [Object, Array],
cacheData: Array
},
mounted () {
},
methods: {
async getList (searchValue) {
const { userInfo, params } = this,
{ cacheData } = params
this.currentIds = []
this.chooseList = []
if (cacheData && cacheData.length) {
this.list = this.initGoodsList(cacheData)
if (searchValue) this.handleSearch(searchValue)
return
}
const { shopMerchantId, sceneType } = userInfo,
response = await uni.$api.popupApi.getGoodsList({
merchantId: shopMerchantId,
sceneType
})
if (response && response.length) {
this.list = this.initGoodsList(response)
params.cacheData = response
this.$emit('update:params', params)
}
},
handleSearch (searchValue) {
if (!searchValue) this.searchStatus = false
else {
let { list } = this,
goodsList = JSON.parse(JSON.stringify(list)),
arr = []
goodsList.map(c => {
let name = ''
if (c.goodsFlag == 3 && c.packageGoods) name = c.packageGoods.packageName || c.packageGoods.packageAlias
if (name.indexOf(searchValue) != -1) {
arr.push(c)
}
})
this.searchList = arr
this.searchStatus = true
}
},
initGoodsList (goodsData) {
let { data } = this,
arr = []
goodsData.map(val => {
if (val.goodsFlag == 3) {
val.packageGoods.upgradePrice = NP.round(val.packageGoods.goodsList.reduce((prev, cur) => {
prev = NP.plus(prev + cur.sellPrice);
return prev;
}, 0), 2)
arr.push(val)
}
})
if (data.length) data.map(e => {
this.currentIds.push(e.packageGoods.packageCode)
this.chooseList.push(e)
})
return arr
},
choose (i) {
let { packageCode } = i.packageGoods,
{ currentIds } = this,
index = currentIds.indexOf(packageCode)
if (index == -1) {
this.currentIds.push(packageCode)
this.chooseList.push(i)
}
else {
this.currentIds.splice(index, 1)
this.chooseList.splice(index, 1)
}
this.$emit('choose', this.chooseList)
},
replaceItemText (item, key) {
let reg = getRegExp(';~;', 'g'),
value = item[key]
return value ? value.replace(reg, ' ') : ''
},
checkActive (i) {
let { currentIds } = this,
active = false
if (currentIds.length) active = currentIds.includes(i.packageGoods.packageCode)
return active
}
}
}
</script>
<style scoped lang='scss'>
.goods-list {
display: flex;
flex-direction: column;
gap: 32rpx 0;
margin: 0 48rpx;
.item {
justify-content: center;
border-radius: 24rpx;
border: 2rpx solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: 32rpx;
box-sizing: border-box;
padding: 0 32rpx 24rpx;
.price {
margin-left: auto;
}
.title {
line-height: 44rpx;
padding: 24rpx 0 20rpx;
.icon {
margin-right: 16rpx;
}
.sprite-icon {
display: none;
}
}
.package-list {
border-radius: 16rpx;
background-color: #f5f7fa;
padding-left: 32rpx;
overflow: hidden;
.package-item {
color: #333333;
font-size: 28rpx;
line-height: 40rpx;
padding: 24rpx 0;
border-bottom: 2rpx solid #f0f0ef;
padding-right: 32rpx;
.price {
margin-left: auto;
}
&:last-of-type {
border: none;
}
}
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.icon {
.uni-icons {
display: none;
}
.sprite-icon {
display: block;
}
}
.package-list {
background: #fff;
}
}
}
</style>
\ No newline at end of file
......@@ -79,15 +79,21 @@ const componentConfig = {
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
goodsType: [5, 6, 7] // 后档
goodsType: [4] // 后档
},
10: {
name: 'GoodsList',
title: '选择商品(可多选)',
placeholder: '请输入名称',
idKey: 'goodsId',
goodsType: 'skylight' // 天窗
goodsType:[5, 6, 7] // 天窗
},
11:{
name: 'PackageList',
title: '选择套餐',
placeholder:'查找',
idKey: 'packageCode'
}
}
import EmployeeList from './components/EmployeeList.vue'
......@@ -95,6 +101,7 @@ import DiversionMerchant from './components/DiversionMerchant.vue'
import CarModelList from './components/CarModelList.vue'
import CouponList from './components/CouponList.vue'
import GoodsList from './components/GoodsList.vue'
import PackageList from './components/PackageList.vue'
export default {
data () {
return {
......@@ -106,6 +113,7 @@ export default {
DiversionMerchant,
CarModelList,
CouponList,
GoodsList
GoodsList,
PackageList
},
}
\ No newline at end of file
......@@ -5,7 +5,7 @@
:is-mask-click="maskClick"
:animation="animation"
>
<view :class="['popup-box']">
<view :class="['popup-box',{'right-box':position=='right'}]">
<view class="popup-title flex">
{{title}}
<view
......@@ -110,6 +110,7 @@ export default {
popupType: {
handler (val) {
this.componentObject = this.componentConfig[this.popupType]
if (val == 11 || val == 12) this.position = 'right'
},
deep: true,
immediate: true
......@@ -273,4 +274,12 @@ export default {
}
}
}
.right-box {
width: 46vw;
height: 100vh;
border-radius: 32rpx 0 0 32rpx;
.popup-footer {
margin: 0 48rpx;
}
}
</style>
\ No newline at end of file
<!--工单信息卡片-->
<template>
<view class="order-card">
<view class="order-card" @click="() => jump(orderCardDetail.status == 3 ? 'confirmOrder' : orderCardDetail.status == 1 ? 'createOrder' : 'orderDetail', orderCardDetail)">
<view class="order-card-top-box flex justify-between">
<text>{{ orderCardDetail.customer.customerName }}</text>
<view class="status text-center" :style="{ color: orderCardDetail.statuscolor, 'background-color': orderCardDetail.statusbackground }">
......@@ -92,7 +92,11 @@
</template>
<script>
import order_mixins from '../order_mixins.js'
import { interceptionMixin } from '@/mixin/index'
import utils from '@/utils/utils'
import { checkDailyReport, showNextModal } from '@/utils/modalUtils'
export default {
mixins: [interceptionMixin],
name: 'OrderCard',
props: {
orderCardDetail: {
......@@ -104,6 +108,8 @@ export default {
return {
...order_mixins.data,
IMG_URL: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/',
isSettingExpiredTraffic: false, // 是否启用流量失效
selectType: 1,
pointsMultiObj: [
{
label: '销售顾问 /录单员',
......@@ -153,20 +159,100 @@ export default {
item: this.orderCardDetail,
flag: !this.orderCardDetail.showAllGoodsListFlag
})
},
async jump(name, item) {
// 订单状态 1 待跟进, 2 不升级, 3 待支付,4 已支付,6 已评价 ,9 已撤销 , 10 已关闭 , 11 已失效
// constructionFlag 施工标识(Y:已施工;N||null:未施工)
// failureFlag 订单失效状态(Y:已失效,N:未失效)
// console.log(e.currentTarget.dataset)
// return
const userInfo = uni.$storage.get('userInfo')
if (userInfo.merchantAccountList && userInfo.merchantAccountList.length) {
try {
userInfo.merchantAccountList.map(e => {
if (e == 6 || e == 8) throw true
})
} catch (error) {
userInfo.merchantType = error
}
}
userInfo.isMake = !(userInfo?.isSuper || userInfo?.loginRole == 3 || userInfo?.loginRole == 5 || userInfo?.loginRole == 6 || userInfo?.loginRole == 7)
let { userType, isSuper, merchantType, isMake } = userInfo
console.log(item)
if (name == 'createOrder' || name == 'premiumUpgrade') {
if (merchantType && !isSuper && isMake) {
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport()
if (staffCheck) return false
if (name == 'createOrder' && (await this.inspectionOfProhibitionBill())) return /**禁止提单 */
// 是微信支付直接跳转确认页面
if (userType == 2 && item?.selectPayType == 1) {
wx.$router.go('tabWorkOrder.confirmOrder', item)
} else if (userType == 2) {
item
? this.showSelectType({
item
})
: wx.$router.go('tabWorkOrder.' + name, item)
} else {
utils.showNoAccess()
}
} else {
utils.showNoAccess()
}
// 已支付加已施工
} else if (item.constructionFlag == 'Y' && item.status != 10) {
wx.$router.go('tabWorkOrder.constructionOrderDetail', item)
} else {
wx.$router.go('tabWorkOrder.' + name, item)
}
},
// 确定是否要显示
showSelectType({ scene = '', item = {} }, scan = false) {
this.isScan = scan
// 当切换门店后,不支持录入失效客户工单,将selectType置为1录入工单
if ((!this.isSettingExpiredTraffic || scan) && this.selectType == 3) {
this.selectType = 1
}
uni.showModal({
show: true,
title: '请选择录单入口',
tabTitleShow: false,
success: async res => {
// 跳转新增订单页面 并带特定参数
console.log(item, 'showSelectType')
if (this.selectType == 1) {
if (await this.inspectionOfProhibitionBill()) return
wx.$router.go('tabWorkOrder.createOrder', {
scene,
...item
})
} else {
wx.$router.go('tabWorkOrder.defeatOrder', {
scene,
...item,
isExpiredTraffic: this.selectType == 3
})
}
},
error: () => {}
})
},
// 获取轻改录单配置是否启用流量失效
getCreateOrderSetting() {
let userInfo = uni.$storage.get('userInfo')
let merchantType = userInfo?.merchantAccountList.includes('6') || userInfo?.merchantAccountList.includes('8')
if (merchantType && !userInfo?.isSuper && userInfo?.loginRole != 3 && userInfo?.userType == 2 && userInfo?.shopMerchantId) {
uni.$api.boutiqueApi.getServiceBaseInfo({ merchantId: userInfo?.shopMerchantId }).then(res => {
this.isSettingExpiredTraffic = res?.data?.trafficExpireFlag == 'Y'
})
}
}
}
}
</script>
<style lang="scss" scoped>
.flex {
display: flex;
}
.justify-between {
justify-content: space-between;
}
.align-center {
align-items: center;
}
.order-card {
padding: toRpx(36) toRpx(32);
border-radius: toRpx(24);
......
......@@ -224,7 +224,7 @@ export default {
async getSoure () {
let baseConfigData = await uni.$api.systemApi.getBoutiqueMockData(true),
{moduleList, toolList, defaultCarId } = baseConfigData
this.$store.state.boutique.baseConfigData = configData
this.$store.state.boutique.baseConfigData = baseConfigData
this.moduleList = moduleList
this.toolList = toolList
this.defaultCarId = defaultCarId
......
<template>
<view class="order-confirm">
<view class="common-title">工单确认</view>
<view class="px-48 scroll-y">
<view class="top-tips flex align-center">
<text class="fs-16 fw-7">等待客户付款</text>
<text class="fs-13 ml-12">点击下一步,锁定并生成工单码。</text>
</view>
<!-- 商品信息 -->
<view class="box-shell">
<view class="box-shell-title">商品信息</view>
<view class="good-list">
<view class="good">
<view class="flex justify-between align-center">
<text class="good-name">商品名称:</text>
<text class="good-price">¥1000</text>
</view>
<view class="flex justify-between align-center pt-6">
<text class="good-alias">商品别名:</text>
</view>
<view class="flex align-center pt-12">
<text class="good-sku">天窗玻璃</text>
<text class="good-count">x2</text>
</view>
</view>
</view>
<view class="flex align-center py-8">
<view class="sprite-icon icon-coupon fs-14"></view>
<text class="fs-14 coupon-name">贴膜抵用券GH647-039(系统)</text>
</view>
<view class="flex justify-end align-center">
<text class="good-total-lable">商品总金额:</text>
<text class="good-total-value">
<text class="unit">¥</text>
{{ toPrice(218.98887, 2) }}
</text>
</view>
</view>
<!-- 工单信息 -->
<view class="box-shell">
<view class="box-shell-title">工单信息</view>
<view class="order-info pt-16">
<view v-for="(item, index) in orderObj" :key="index" class="flex align-center pt-8">
<view class="label">{{ item.label }}</view>
<view v-if="item.key == 'status'">
<view class="value" :style="{ color: item.constructionFlag == 'Y' ? status[orderInfo.status].color : '' }">
<!-- {{ item.constructionFlag == 'Y'? status[orderInfo.status].text: '待施工'}} -->
<!-- {{ status[orderInfo.status].text }} -->
</view>
</view>
<view v-else>
<view class="value">
<view v-if="item.key == 'payType'">
{{ payType[orderInfo.selectPayType] || '' }}
</view>
<view v-else>{{ orderInfo[item.key] || '' }}</view>
</view>
</view>
<view v-if="item.copy">
<view class="copy" @click="setCopyData">
<!-- 复制 -->
</view>
</view>
</view>
<view v-if="(orderInfo.selectPayType == 2 || orderInfo.selectPayType == 5 || orderInfo.selectPayType == 6 || orderInfo.selectPayType == 7) && orderInfo.payVoucherList.length">
<view class="flex align-center pt-8">
<view class="label">付款凭证</view>
<view class="image-box">
<view class="value" @click="previewImage" v-for="(item, index) in orderInfo.payVoucherList" :key="index">
<view class="image">
<!-- <image src="{{item.payVoucher}}" /> -->
</view>
</view>
</view>
</view>
</view>
<view v-if="orderInfo.status == 5 || orderInfo.status == 12">
<view class="flex align-center pt-8">
<view class="label">退款明细</view>
<view class="value">{{ orderInfo.refundType == 1 ? '退全款' : '退部分款' }}¥{{ orderInfo.refundAmount }}</view>
</view>
</view>
<view class="paid" v-if="orderInfo.payOrder && orderInfo.payOrder.payStatus == 2">
<!-- <image src="../../images/paid.png" /> -->
</view>
</view>
</view>
<!-- 客户信息 -->
<view class="box-shell">
<view class="box-shell-title">客户信息</view>
<view class="order-info pt-16">
<view class="flex align-center pt-8" v-for="(item, index) in customerObj" :key="index">
<view class="label">{{ item.label }}</view>
<view class="value" :style="{ color: item.color || '#333' }">
<view v-if="item.arr">
<view v-if="orderInfo[item.arr[1]]">
<view v-for="(i, ind) in item.arr" :key="ind">
<view class="value-item text-hide">
<text v-if="ind == 1">|</text>
{{ orderInfo[i] }}
</view>
</view>
</view>
</view>
<view v-else>
{{ item.enum ? item.enum[orderInfo[item.key]] : orderInfo[item.key] || '' }}
</view>
<view v-if="item.copy">
<view class="copy" @click="setCopyData">
<!-- 复制 -->
<!-- <image src="{{IMG_URL}}copy_icon_gapy.png" class="copyImage" binderror="" bindload=""></image> -->
</view>
</view>
</view>
</view>
</view>
<view v-if="orderInfo.selectPayType == 0">
<view class="flex align-center pt-8">
<view class="label">拒升理由</view>
<view class="value">
{{ orderInfo.customer.refusalReason ? orderInfo.customer.refusalReason : '' }}
</view>
</view>
</view>
</view>
<view class="flex align-center footer-box justify-center">
<view class="edit btn">修改</view>
<view class="confirm btn">确认</view>
</view>
</view>
</view>
</template>
<script>
import utils from '@/utils/utils'
import order_mixins from '../../order_mixins.js'
export default {
name: 'OrderConfirm',
props: {
orderInfo: {
type: Object,
default: () => ({})
}
},
data() {
return {
...order_mixins.data
}
},
methods: {
toPrice(val, num) {
return Number(utils.decimal(val, num)).toFixed(2)
}
}
}
</script>
<style scoped lang="scss">
.order-confirm {
position: relative;
height: 100%;
.scroll-y {
height: calc(100% - #{toRpx(296)});
overflow-y: scroll;
&::-webkit-scrollbar {
width: 0;
height: 0;
background: transparent;
}
}
.px-48 {
padding: 0 toRpx(48);
}
.pt-6 {
padding-top: toRpx(6);
}
.pt-8 {
padding-top: toRpx(8);
}
.pt-16 {
padding-top: toRpx(16);
}
.pt-12 {
padding-top: toRpx(12);
}
.fs-14 {
font-size: toRpx(14);
}
.fs-16 {
font-size: toRpx(16);
}
.fw-7 {
font-weight: 700;
}
.fs-13 {
font-size: toRpx(13);
}
.ml-12 {
margin-left: toRpx(12);
}
.py-8 {
padding: toRpx(8) 0;
}
.top-tips {
width: 100%;
height: toRpx(48);
border-radius: toRpx(8);
background: linear-gradient(-90deg, #61c0ff 0%, #2c66f7 100%);
box-shadow: inset 0 0 toRpx(20) 0 #ffffff99;
color: #fff;
padding: 0 toRpx(16);
}
.box-shell {
width: 100%;
border-radius: toRpx(16);
background: #ffffff;
padding: toRpx(24) toRpx(32);
margin-top: toRpx(16);
&-title {
font-size: toRpx(28);
color: #333333;
font-weight: 400;
}
.good-list {
margin-top: toRpx(16);
.good {
color: #333333;
font-size: toRpx(28);
border-radius: toRpx(24);
background: #f5f7fa;
padding: toRpx(24);
.good-name {
font-weight: 400;
flex: 4;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.good-price {
font-weight: 500;
flex: 1;
text-align: right;
}
.good-alias {
font-size: toRpx(24);
font-weight: 400;
}
.good-sku {
color: #999999;
font-size: toRpx(24);
font-weight: 400;
}
.good-count {
color: #999999;
font-size: toRpx(24);
font-weight: 400;
}
}
}
.coupon-name {
color: #292d33;
font-size: toRpx(24);
font-weight: 400;
margin-left: toRpx(8);
}
.good-total-lable {
color: #757980;
font-size: toRpx(28);
font-weight: 400;
}
.good-total-value {
color: #4673ff;
font-size: toRpx(40);
font-weight: 700;
}
.order-info {
.label {
width: toRpx(156);
color: #999999;
font-size: toRpx(26);
font-weight: 400;
}
.value {
color: #222222;
font-size: toRpx(26);
font-weight: 400;
}
}
}
.footer-box {
position: absolute;
bottom: toRpx(24);
width: 100%;
left: 0;
.btn {
width: 42%;
height: toRpx(80);
border-radius: toRpx(48);
font-size: toRpx(28);
font-weight: 500;
line-height: toRpx(80);
text-align: center;
}
.confirm {
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff;
margin-left: toRpx(32);
}
.edit {
background: #3b73ff1a;
color: #4673ff;
}
}
}
</style>
......@@ -175,7 +175,6 @@ export default {
keyword: '',
searchObj: {},
dataList: [],
userInfo: JSON.parse(getApp().globalData.userInfo),
waitInputCount: 0, // 添加待补录计数
waitOrderTimer: null, // 定时器引用
tipsProps: {
......@@ -190,11 +189,13 @@ export default {
normalCurrentPage: 1,
abnormalPages: 1,
normalPages: 1,
userInfo: null,
checkListObj: {},
...order_mixins.data
}
},
mounted() {
this.userInfo = uni.$storage.get('userInfo') || {}
this.search()
this.startWaitOrderPolling()
},
......@@ -203,7 +204,7 @@ export default {
},
methods: {
search() {
// 判断是不是超管 && !userInfo.isSuper
// 判断是不是超管 && !this.userInfo.isSuper
// ,不是只能筛选当前4s店的
if (!this.searchObj.merchantId) {
this.searchObj.merchantId = this.userInfo?.shopMerchantId
......@@ -213,7 +214,9 @@ export default {
},
async waitinputorderClick() {
if (await this.inspectionOfProhibitionBill()) return
this.getTransactionSerialNumber()
if (!this.normalOrderNoList.length && !this.abnormalOrderNoList.length) {
this.getTransactionSerialNumber()
}
this.$refs.WaitinputorderPopup.open()
},
handleToggleGoodsList(data) {
......@@ -309,7 +312,7 @@ export default {
// let userType = true
list.map(e => {
if (e.orderTime) e.orderTime = dayjs(new Date(e.orderTime)).format('yyyy-MM-dd hh:mm:ss')
if (e.orderTime) e.orderTime = dayjs(new Date(e.orderTime)).format('YYYY-MM-DD HH:mm:ss')
e.subOrderList.map(i => {
i.totalPrice = Number(utils.decimal(i.totalPrice, 2)).toFixed(2)
})
......@@ -319,7 +322,7 @@ export default {
e.invoiceName = e.invoiceStatus == 2 ? '查看发票' : '申请开票'
// && e.status != 1 待跟进现在也能撤销
let orderType = (this.userInfo.userType == 1 || this.userInfo.userType == 2) && e.status != 9 && ![1, 3, 4].includes(e.selectPayType)
// let orderType = userInfo.userType !== 1 && e.status != 9 && e.status != 1 && e.selectPayType != 3 && e.selectPayType != 1
// let orderType = this.userInfo.userType !== 1 && e.status != 9 && e.status != 1 && e.selectPayType != 3 && e.selectPayType != 1
// console.log(userType);
// console.log(orderType);
e.repeal = userType && orderType
......
......@@ -30,13 +30,15 @@ import CreateOrder from './components/CreateOrder.vue'
import DailyReport from './components/DailyReport.vue'
import DefeatOrder from './components/DefeatOrder.vue'
import OrderManagement from './components/OrderManagement.vue'
import ConfirmOrder from './components/ConfirmOrder.vue'
export default {
components: {
Entrance,
CreateOrder,
DailyReport,
DefeatOrder,
OrderManagement
OrderManagement,
ConfirmOrder
},
data() {
return {
......
let modalQueue = []
import api from '@/api/index.js'
let eventRequest = []
export const checkDailyReport = async sceneType => {
let userInfo = uni.$storage.get('userInfo')
// debugger
// 判读是否要填写日报
if (!(userInfo?.isSuper || userInfo?.loginRole == 3 || userInfo.loginRole == 5 || userInfo?.loginRole == 6)) {
// 判断员工是否已打卡上班
eventRequest.push(clockedIntoWork())
eventRequest.push(sceneType ? equityStaffDailyReport(userInfo) : staffDailyReport(userInfo))
}
return new Promise(resolve => {
Promise.all(eventRequest).then(results => {
// const [reportStatus] = results;
results = results.slice(-2)
// console.log(reportStatus, results, results.length, results[results.length - 1], 'reportStatus');
let resultFlag = results.some(item => item)
showNextModal()
console.log(resultFlag, 'resultFlag')
resolve(resultFlag)
})
})
}
export const showNextModal = () => {
let _this = this
if (modalQueue.length > 0) {
const modalInfo = modalQueue.pop()
if (uni.__HAS_SHOW_MODAL) return
uni.__HAS_SHOW_MODAL = true
uni.showModal({
title: modalInfo.title,
content: modalInfo.content,
showCancel: modalInfo.showCancel,
cancelColor: '#292D33',
confirmText: modalInfo.confirmText,
confirmColor: '#347BFF',
success: function (res) {
uni.__HAS_SHOW_MODAL = false
// if (res.cancel) _this.showNextModal();
if (res.cancel) showNextModal()
modalInfo.eventCallback(res)
}
})
}
}
const staffDailyReport = userInfo => {
return new Promise((resolve, reject) => {
api.boutiqueApi
.staffDailyReportMerchantValid({
merchantId: userInfo.shopMerchantId,
yqMerchantId: userInfo.merchantId,
staffUuid: userInfo.uuid,
sceneType: 1
})
.then(res => {
if (res.data) {
// 获取当前日期
let currentDate = new Date()
// 获取上一天的日期
let previousDate = new Date(currentDate)
previousDate.setDate(currentDate.getDate() - 1)
// toISOString 方法会丢失时区 导致与北京时间差八小时
let hour = previousDate.getHours() + 8
previousDate.setHours(hour)
// 格式化日期为"yyyy-mm-dd"
let formattedDate = previousDate.toISOString().split('T')[0]
if (wx.__HAS_NOTLOGIN_MODAL) return false
addModalToQueue('日报提醒', '您有未填写的日报,请点击前往。', '前往填写', false, 2, res => {
if (res.confirm) {
wx.$router.go('tabWorkOrder.upgradeStaffDaily', {
reportDate: formattedDate
})
}
})
resolve(true)
} else {
resolve(false)
}
})
.catch(err => {
resolve()
console.log(err)
})
})
}
const equityStaffDailyReport = userInfo => {
return new Promise((resolve, reject) => {
api.boutiqueApi
.staffDailyReportMerchantValid({
merchantId: userInfo?.shopMerchantId,
yqMerchantId: userInfo?.merchantId,
staffUuid: userInfo?.uuid,
sceneType: 0
})
.then(res => {
if (res.data) {
// 获取当前日期
let currentDate = new Date()
// 获取上一天的日期
let previousDate = new Date(currentDate)
previousDate.setDate(currentDate.getDate() - 1)
console.log(previousDate, 'previousDate')
// toISOString 方法会丢失时区 导致与北京时间差八小时
let hour = previousDate.getHours() + 8
previousDate.setHours(hour)
// 格式化日期为"yyyy-mm-dd"
let formattedDate = previousDate.toISOString().split('T')[0]
console.log('formattedDate', formattedDate)
if (wx.__HAS_NOTLOGIN_MODAL || userInfo?.isSuper || userInfo?.loginRole == 3 || userInfo.loginRole == 5 || userInfo?.loginRole == 6) return false
addModalToQueue('日报提醒', '您有未填写的日报,请点击前往。', '前往填写', false, 4, res => {
if (res.confirm) {
wx.$router.go('tabWorkOrder.staffDaily', {
reportDate: formattedDate
})
}
})
resolve(true)
} else {
resolve(false)
}
})
.catch(err => {
resolve(false)
})
})
}
export const clockedIntoWork = userInfo => {
return new Promise((resolve, reject) => {
api.boutiqueApi
.clockInConfigPhone({})
.then(res => {
let { need, clockIn } = res.data
// console.log(res, need == 0 && clockIn == 0, "clockInConfigPhone");
// 已配置未打卡
if (need == 1 && clockIn == 0) {
// 有配置并且没有打卡就提示
addModalToQueue('打卡提醒', '您当前企微未打卡,无法录单,请前往企微打卡后再试,如有异议请联系管理员。', '知道了', false, 4, res => {
if (res.confirm) {
// wx.$router.go("tabWorkOrder.staffDaily", {
// // reportDate: formattedDate,
// });
}
})
resolve(true)
} else {
resolve(false)
}
})
.catch(err => {
resolve(false)
})
})
}
const addModalToQueue = (title, content, confirmText, showCancel, priority, eventCallback) => {
if (modalQueue.findIndex(val => val.content == content) < 0)
modalQueue.push({
title,
content,
confirmText,
showCancel,
priority,
eventCallback
})
modalQueue.sort((a, b) => a.priority - b.priority)
}
......@@ -231,6 +231,13 @@ const setPrice = price => {
if (!decimal) decimal = '00'
return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + `.${decimal}`
}
const showNoAccess = () => {
// wx.showToast('您的账号无法完成此操作')
uni.showToast({
title: '您的账号无法完成此操作',
icon: 'error'
})
}
export default {
compareVersions,
convertDateTimeFormat,
......@@ -247,5 +254,6 @@ export default {
calcAdd,
getViewInfo,
setPrice,
decimal
decimal,
showNoAccess
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!