Commit 044d334d by 李伟康

feat(api): 新增拦截 API 功能

- 添加 interceptionApi 模块,实现员工日报和打卡相关功能
- 在 api/module/index.js 中引入并导出 interceptionApi
1 parent 8335cdde
...@@ -6,6 +6,7 @@ import customerApi from './customerApi' ...@@ -6,6 +6,7 @@ import customerApi from './customerApi'
import pointApi from './point' import pointApi from './point'
import receptionApi from './receptionApi' import receptionApi from './receptionApi'
import sceneMarketApi from './sceneMarketApi' import sceneMarketApi from './sceneMarketApi'
import interceptionApi from './interceptionApi'
module.exports = { module.exports = {
commonApi, commonApi,
systemApi, systemApi,
...@@ -14,5 +15,6 @@ module.exports = { ...@@ -14,5 +15,6 @@ module.exports = {
customerApi, customerApi,
pointApi, pointApi,
receptionApi, receptionApi,
sceneMarketApi sceneMarketApi,
interceptionApi
} }
import http from '../request/http'
module.exports = {
/** 查询该店员工日报是否开启 */
staffDailyReportMerchantValid (data) {
return http.post({
method: 'dj.api.smartcarlife.staff.daily.report.popup.need',
projectName: 'boutique',
...data
})
},
/** 校验手机号是否配置打卡和是否打卡 */
clockInConfigPhone (data) {
return http.post({
method: 'dj.api.smartcarlife.clock.in.config.phone',
projectName: 'boutique',
...data
})
},
}

2.53 MB | W: | H:

2.53 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -2,9 +2,11 @@ import loginMixin from './loginMixin' ...@@ -2,9 +2,11 @@ import loginMixin from './loginMixin'
import receptionTrackMixin from './receptionTrackMixin' import receptionTrackMixin from './receptionTrackMixin'
import aiUrlMixin from './aiUrlMixin' import aiUrlMixin from './aiUrlMixin'
import report from './report' import report from './report'
import interceptionMixin from './interceptionMixin'
module.exports = { module.exports = {
loginMixin, loginMixin,
receptionTrackMixin, receptionTrackMixin,
aiUrlMixin, aiUrlMixin,
report report,
interceptionMixin
} }
let modalQueue = []
export default {
data () {
return {
eventRequest: []
}
},
computed: {
userInfo () {
return uni.$storage.get('userInfo') || {}
}
},
mounted () {
},
methods: {
async checkDailyReport () {
let { sceneType, isSuper, loginRole } = this.userInfo
if (!(isSuper || loginRole == 3 || loginRole == 5 || loginRole == 6)) {
// 判断员工是否已打卡上班
this.eventRequest.push(this.clockedIntoWork())
let apiName = {
0: 'equityStaffDailyReport',
1: 'staffDailyReport'
}
this.eventRequest.push(apiName[sceneType]())
}
return new Promise((resolve) => {
Promise.all(this.eventRequest).then((results) => {
results = results.slice(-2)
let resultFlag = results.some((item) => item);
this.showNextModal()
resolve(resultFlag)
})
})
},
showNextModal () {
if (modalQueue.length > 0) {
const modalInfo = modalQueue.pop();
// if (wx.__HAS_SHOW_MODAL) return;
// wx.__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) {
// wx.__HAS_SHOW_MODAL = false;
// if (res.cancel) _this.showNextModal();
if (res.cancel) showNextModal();
modalInfo.eventCallback(res);
},
});
}
},
staffDailyReport () {
let { userInfo } = this
return new Promise((resolve, reject) => {
uni.$api.interceptionApi.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) {
console.log(123)
// wx.$router.go("tabWorkOrder.upgradeStaffDaily", {
// reportDate: formattedDate,
// });
}
}
);
resolve(true);
} else {
resolve(false);
}
})
.catch((err) => {
resolve();
});
});
},
clockedIntoWork () {
return new Promise((resolve, reject) => {
uni.$api.interceptionApi.clockInConfigPhone({})
.then((res) => {
let { need, clockIn } = res.data;
// console.log(res, need == 0 && clockIn == 0, "clockInConfigPhone");
// 已配置未打卡
if (need == 1 && clockIn == 0) {
// 有配置并且没有打卡就提示
this.addModalToQueue(
"打卡提醒",
"您当前企微未打卡,无法录单,请前往企微打卡后再试,如有异议请联系管理员。",
"知道了",
false,
4,
(res) => {
if (res.confirm) {
// wx.$router.go("tabWorkOrder.staffDaily", {
// // reportDate: formattedDate,
// });
}
}
);
resolve(true);
} else {
resolve(false);
}
})
.catch((err) => {
resolve(false);
});
});
}
},
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);
}
}
\ No newline at end of file \ No newline at end of file
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</template> </template>
<script> <script>
import Entrance from './components/Entrance.vue'; import Entrance from '@/components/Entrance.vue';
import CreateOrder from './components/CreateOrder.vue' import CreateOrder from './components/CreateOrder.vue'
import DailyReport from './components/DailyReport.vue' import DailyReport from './components/DailyReport.vue'
import DefeatOrder from './components/DefeatOrder.vue' import DefeatOrder from './components/DefeatOrder.vue'
...@@ -44,6 +44,9 @@ export default { ...@@ -44,6 +44,9 @@ export default {
toolComponentName: '' toolComponentName: ''
} }
}, },
onLoad(options){
if(options.componentName) this.toolComponentName = options.componentName
},
methods: { methods: {
entranceClick(item) { entranceClick(item) {
console.log(item) console.log(item)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!