Commit 96d21fc8 by 张立顺

v4.16.0 功能开发

1 parent 161df0c6
......@@ -14,7 +14,7 @@ const systemInfo = wx.getSystemInfoSync()
const manual = false
const release = false
let index = 3
let index = 1
// 判断小程序环境
// develop:开发版(正常开发工具,测试时)
......
......@@ -3,16 +3,12 @@ import request from './api/request.js'
import router from './router/index.js'
import util from './utils/util.js'
import api from './api/api.js'
import * as Sentry from './utils/sentry-miniapp.wx.min'
// 先屏蔽不上sentry功能
const accountInfo = wx.getAccountInfoSync()
// console.log(Sentry)
// 初始化 Sentry 生产环境再开启
// console.log('Sentry',Sentry);
accountInfo.miniProgram.envVersion == 'release' &&
Sentry.init({
dsn: 'https://ddaadc52bf8d4ecc92eca632683d456a@sentry.glsx.com.cn/23'
})
// 初始化sentry
import sentryInit from '~/utils/sentryConfig/sentryInit'
sentryInit()
// 判断小程序是否需要更新
import getUpdateManager from './utils/lib/wxUpdateManager'
App({
onLaunch() {
/**挂载到wx对象 */
......@@ -27,58 +23,12 @@ App({
showModal(that, options) {
that.selectComponent('#modal').showModal(options)
},
/**
* 下载小程序新版本并重启应用
*/
autoUpdate: function () {
const self = this
// 获取小程序更新机制兼容
if (wx.canIUse('getUpdateManager')) {
const updateManager = wx.getUpdateManager()
//1. 检查小程序是否有新版本发布
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
if (res.hasUpdate) {
//2. 小程序有新版本,则静默下载新版本,做好更新准备
updateManager.onUpdateReady(function () {
console.log(new Date())
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
//3. 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
wx.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
})
})
}
})
} else {
// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
wx.showModal({
title: '提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
})
}
},
onShow(options) {
let that = this
this.autoUpdate()
console.log(options)
getUpdateManager()
// console.log(options)
// wx.onMemoryWarning(function () {
// console.log('onMemoryWarningReceive')
// })
let systemInfo = util.getStorageSync('dj_boutique_system_info')
wx.getSystemInfo({
success(res) {
......@@ -90,10 +40,11 @@ App({
let { query } = options
// 判断对象是否满足任意一个key
console.log(query, ' query')
wx.$SCENE = null // 解决不是外部跳转进来的问题, 重置
if (query && (query.scene || query.merchantId || query.type)) {
options.patch = 'pages/index/index'
// 需要满
if (query.merchantId) {
// 判断是首页还是待补录页面
options.patch = query.scene ? 'tabWorkOrder/pages/additionRecordOrder/additionRecordOrder' : 'pages/index/index'
// options.patch == 'tabIndex/pages/index/index'
let userInfo = util.getStorageSync('dj_boutique_user_info')
// 需要当前门店的 不是就重新登录
......@@ -117,7 +68,7 @@ App({
}
}
if (query.type) {
options.patch = 'tabWorkOrder/pages/createOrder/createOrder'
options.patch = 'tabWorkOrder/pages/createArchives/createArchives'
}
wx.$SCENE = options
// tabIndex/pages/index/index?supplement=true
......@@ -142,20 +93,7 @@ App({
// }
router.reLaunch('pages.wxLogin')
},
// 获取设备信息
getDeviceSize: function () {
return new Promise((resolve, reject) => {
wx.getSystemInfo({
success: function (res) {
// console.log(res)
const { screenHeight, safeArea } = res
const { bottom } = safeArea
const bottomLift = screenHeight - bottom
resolve({ bottomLift })
}
})
})
},
// &&(userInfo.subLoginUser.merchantId != userInfo.merchantId || canRemark )
checkYqdSuper(userInfo) {
// console.log('app', userInfo)
......
......@@ -82,6 +82,9 @@
"tips-bottom": "components/tipsBottom/index"
},
"sitemapLocation": "sitemap.json",
"resolveAlias": {
"~/*": "/*"
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
......
/**
* 用来配置小程序项目的变量
* 统一管理
*/
// 配置预发布的小程序aapId
// export const preReleaseAppId = 'wx24ebae5768e74138'
// 小程序id
export const appId = 'wx570d9331f9ace0bd'
// 开发环境
// 开发指定的小程序
// sentry Dsn 地址
export const dsnUrl = 'https://ddaadc52bf8d4ecc92eca632683d456a@sentry.glsx.com.cn/23'
......@@ -174,7 +174,6 @@ Page({
onShow: function () {
wx.hideHomeButton()
this.login()
console.log(' wx.$SCENE ', wx.$SCENE );
},
login() {
wx.$util.showLoading()
......
......@@ -281,7 +281,7 @@ Page({
table
})
},
setTime() {
let _this = this
time = setTimeout(() => {
......@@ -294,9 +294,10 @@ Page({
// console.log('waitorder')
let { isStaff } = this.data
// console.log('isStaff', isStaff)
let thisPage = wx.$router.getPageInstance()
console.log( thisPage.route,' thisPage.route');
thisPage.route == 'tabIndex/pages/index/index'&& isStaff &&
let thisPage = wx.$router.getPageInstance()
console.log(thisPage.route, ' thisPage.route')
thisPage.route == 'tabIndex/pages/index/index' &&
isStaff &&
api
.waitinputorder()
.then(result => {
......@@ -399,30 +400,28 @@ Page({
}
})
},
checkShowOrderPop(options){
checkShowOrderPop(options) {
let userInfo = wx.$util.getStorageSync('dj_boutique_user_info')
// 需要当前门店的 不是就重新登录
if (userInfo?.subLoginUser?.merchantId == options.merchantId) {
if (options.merchantId) {
this.setData({
showOrderpop: true
})
}
if (options.merchantId) {
this.setData({
showOrderpop: true
})
}
}
},
onRoute(options) {
// console.log($query);
// debugger
// console.log(options,'options');
options&& this.checkShowOrderPop(options)
options && this.checkShowOrderPop(options)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// console.log(options)
options&& this.checkShowOrderPop(options)
options && this.checkShowOrderPop(options)
let today = new Date()
let startDate = today.format('yyyy-MM-dd')
......@@ -471,14 +470,14 @@ Page({
onHide: function () {
// console.log('onHide')
// console.log(time)
time &&clearTimeout(time)
time && clearTimeout(time)
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
time &&clearTimeout(time)
time && clearTimeout(time)
},
/**
......
......@@ -7,7 +7,8 @@ export default {
url: 'tabWorkOrder.createOrder'
},
{
name: '战败下单',
name: '客户建档',
// name: '战败下单',
url: 'tabWorkOrder.createArchives'
},
{
......
......@@ -76,51 +76,6 @@ Page({
})
})
.catch(err => {})
// console.log(userInfo)
// debugger
// if (!userInfo.isSuper && userInfo.merchantType && userInfo.userType == 2) {
// this.setData({
// merchantRange: [
// {
// merchantName: userInfo.merchantName
// }
// ],
// subIndex: 0
// })
// return
// }
// let all = {
// merchantName: '全部'
// }
// api.getYQList().then(res => {
// console.log(res)
// wx.hideLoading()
// let { code, data } = res
// if (code == 0) {
// let subIndex = 0
// let arr = []
// if (data.length > 1) {
// if (userInfo.merchantId != userInfo.subLoginUser.merchantId) {
// data.map((e, index) => {
// if (e.merchantId == userInfo.subLoginUser.merchantId) subIndex = index + 1
// })
// }
// arr = [all, ...data]
// } else {
// arr = [
// {
// merchantName: userInfo.merchantName
// }
// ]
// }
// this.setData({
// merchantRange: arr,
// subIndex,
// canRemark: arr.length == 1
// })
// }
// })
// this.getPageData()
},
refresh(data) {
// console.log('refresh')
......@@ -149,8 +104,6 @@ Page({
// console.log('time')
let maxDate = new Date().format('yyyy-MM-dd')
let today = dateNum || new Date().format('yyyy-MM-dd')
// console.log(new Date(today).getTime())
// console.log(today)
/**
* 根据日期字符串获取星期几
* @param dateString 日期字符串(如:2020-05-02)
......@@ -299,6 +252,20 @@ Page({
console.log(err)
})
},
// 获取设备信息
getDeviceSize() {
return new Promise((resolve, reject) => {
wx.getSystemInfo({
success: function (res) {
// console.log(res)
const { screenHeight, safeArea } = res
const { bottom } = safeArea
const bottomLift = screenHeight - bottom
resolve({ bottomLift })
}
})
})
},
/**
* 生命周期函数--监听页面加载
*/
......@@ -306,10 +273,9 @@ Page({
// console.log('onload')
this.setTimeList()
// this.getOrderNum()
let { bottomLift } = app.globalData
if (bottomLift >= 0) {
app.getDeviceSize().then(res => {
this.getDeviceSize().then(res => {
const { bottomLift } = res
this.setData({
bottomLift
......
......@@ -723,6 +723,7 @@ Page({
// if (options.scene) {
// this.setData(options)
// }
options?.scene && this.checkShowOrderInfo(options)
},
/**
* 生命周期函数--监听页面初次渲染完成
......@@ -735,46 +736,45 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function (res) {
this.getSetting()
// console.log(111)
// this.saveImageClick()
// console.log(res)
// setTimeout(() => {
// wx.$util.showLoading()
// }, 2000)
},
checkShowOrderInfo(options) {
let userInfo = wx.$util.getStorageSync('dj_boutique_user_info')
if (userInfo?.subLoginUser?.merchantId != options.merchantId) {
wx.$router.go('index')
} else {
// 查询补单信息
api
.supplementOrder({ scene: options })
.then(result => {
let { outTradeNo, totalFee, accountDate } = result
this.setData({
outTradeNo,
totalFee: totalFee,
accountDate
})
})
.catch(err => {})
}
},
onRoute(res) {
// debugger
let { outTradeNo, totalFee, accountDate } = res
// console.log(res)
// console.log(outTradeNo, totalFee)
this.setData({
outTradeNo,
totalFee: totalFee,
accountDate
})
// console.log(res)
// console.log()
// if (res.scene) {
// res.returnFun = true
// this.setData(res)
// } else if (res.merchantId) {
// this.setData({
// returnFun: true
// })
// this.setOrderObj(res)
// } else {
// wx.$util.showLoading('加载中...')
// this.setData(
// {
// flag: true
// },
// () => {
// wx.$util.hideLoading()
// }
// )
// }
// console.log(11)
this.getSetting()
let { outTradeNo, totalFee, accountDate, scene } = res
// 如果是扫码进来的
if (scene) {
return this.checkShowOrderInfo(res)
} else {
this.setData({
outTradeNo,
totalFee: totalFee,
accountDate
})
}
},
/**
* 生命周期函数--监听页面隐藏
......@@ -799,27 +799,27 @@ Page({
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
onShareAppMessage: function () {}
// 获取园区店支付配置
getConfig() {
// console.log(this.data.orderObj)
let o = this.data.orderObj
let oParams = {}
oParams.yqMerchantId = o.sellerMerchantId
api.getYqStoreConfig(oParams).then(res => {
console.log(res)
let obj = res.data || {}
let m = obj.supportPayTypes || []
let n = this.data.payTypeList
let list = n.filter(k => {
let idx = m.find(j => j == k.value)
return idx >= 0
})
this.setData({
showPayList: list
})
// console.log(list)
})
}
// getConfig() {
// // console.log(this.data.orderObj)
// let o = this.data.orderObj
// let oParams = {}
// oParams.yqMerchantId = o.sellerMerchantId
// api.getYqStoreConfig(oParams).then(res => {
// console.log(res)
// let obj = res.data || {}
// let m = obj.supportPayTypes || []
// let n = this.data.payTypeList
// let list = n.filter(k => {
// let idx = m.find(j => j == k.value)
// return idx >= 0
// })
// this.setData({
// showPayList: list
// })
// // console.log(list)
// })
// }
})
{
"navigationBarTitleText": "战败下单",
"navigationBarTitleText": "创建客户档案",
"usingComponents": {
"car-brands": "/components/CarBrands/CarBrands",
"merchant-seles": "/components/Merchant-Seles/Merchant-Seles"
......
......@@ -193,9 +193,17 @@
<!-- <car-brands show="{{carBrandBox}}" bindconfirm="chooseCar" carSeriesId="{{orderObj.carSeriesId || ''}}" /> -->
<view class="btns {{isFullSucreen?'isFullSucreen-btn':''}}">
<view class="tips">可批量生成当天的战败客户,缺漏信息建档后在工单详情补充</view>
<view class="confirm text-center" bindtap="submit">
{{notUpgradeOrderList.length==1?'提交客户工单':'提交'+notUpgradeOrderList.length+'个客户工单'}}
<view class="btns-con">
<view class="confirm fail text-center" bindtap="submit">
战败下单
<!-- {{notUpgradeOrderList.length==1?'提交客户工单':'提交'+notUpgradeOrderList.length+'个客户工单'}} -->
</view>
<view class="confirm save text-center" bindtap="submitUserInfo">提交</view>
</view>
<!-- <view class="confirm text-center" bindtap="submit">
{{notUpgradeOrderList.length==1?'提交客户工单':'提交'+notUpgradeOrderList.length+'个客户工单'}}
</view> -->
</view>
<merchant-seles
show="{{selesBox}}"
......
......@@ -269,14 +269,35 @@ scroll-view ::-webkit-scrollbar {
height: 80rpx;
background-color: #3582EE;
border-radius: 12rpx;
margin: 0 32rpx;
/* margin: 0 32rpx; */
}
.btns-con {
box-sizing: border-box;
display: flex;
padding: 0 32rpx;
}
.btns-con .save {
width: 480rpx;
}
.btns-con .fail {
width: 186rpx;
margin-right: 20rpx;
background: #FFFFFF;
border: 2rpx solid #DCDEE0;
border-radius: 12rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #323233;
}
.touch-item {
/* margin: 0 20rpx; */
box-sizing: border-box;
position: relative;
box-sizing: border-box;position: relative;
display: flex;
justify-content: space-between;
/* width: calc(100% - 40rpx); */
......
This diff could not be displayed because it is too large.
const getUpdateManager = () => {
let startParamObj = wx.getLaunchOptionsSync()
// 解决朋友圈分享是单页面报错问题
if (wx.canIUse('getUpdateManager') && startParamObj.scene != 1154) {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新版本下载失败
wx.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
})
})
}
}
export default getUpdateManager
import { dsnUrl } from '~/config'
import * as Sentry from '~/utils/lib/sentry-miniapp'
export default function sentryInit() {
// accountInfo.miniProgram.envVersion == 'release' &&
const accountInfo = wx.getAccountInfoSync()
//测试和生产才开发sentry
const env = ['trial', 'release']
env.includes(accountInfo.miniProgram.envVersion) &&
Sentry.init({
// dsn: 'http://ebcf31c417cc4ce185782f046e4a87a2@sentry.glsx.com.cn/5'
dsn: dsnUrl
})
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!