Commit 4e2c201a by 胡悦

Merge branch 'SAAS+V5.5.0' of http://192.168.3.233:8090/glsx/gl_tape into SAAS+V5.5.0

2 parents 12a71291 c05a3e90
Showing 59 changed files with 3836 additions and 399 deletions
...@@ -2,7 +2,7 @@ import http from '../request/http' ...@@ -2,7 +2,7 @@ import http from '../request/http'
module.exports = { module.exports = {
/**新建车损报价单 */ /**新建车损报价单 */
quotationAdd(data) { quotationAdd (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.add', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.add',
projectName: 'boutique', projectName: 'boutique',
...@@ -10,7 +10,7 @@ module.exports = { ...@@ -10,7 +10,7 @@ module.exports = {
}) })
}, },
/** 报价单支付订单生成(带上签名)返回订单号(商户地址) */ /** 报价单支付订单生成(带上签名)返回订单号(商户地址) */
quotationUpgrade(data) { quotationUpgrade (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.pay.order.generate', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.pay.order.generate',
projectName: 'boutique', projectName: 'boutique',
...@@ -18,7 +18,7 @@ module.exports = { ...@@ -18,7 +18,7 @@ module.exports = {
}) })
}, },
// 校验订单是否需要上传合同协议 // 校验订单是否需要上传合同协议
checkZyPayFlag(data) { checkZyPayFlag (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.zyPayUrl.check', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.zyPayUrl.check',
projectName: 'boutique', projectName: 'boutique',
...@@ -27,7 +27,7 @@ module.exports = { ...@@ -27,7 +27,7 @@ module.exports = {
}, },
// 查询店铺配置 // 查询店铺配置
getShopMerchantPointConfig(data) { getShopMerchantPointConfig (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.shopMerchantPointConfig.get', method: 'dj.api.smartcarlife.shopMerchantPointConfig.get',
projectName: 'boutique', projectName: 'boutique',
...@@ -36,7 +36,7 @@ module.exports = { ...@@ -36,7 +36,7 @@ module.exports = {
}, },
/** 查询报价单信息 */ /** 查询报价单信息 */
getQuotationInfoById(data) { getQuotationInfoById (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.find.by.id', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.find.by.id',
projectName: 'boutique', projectName: 'boutique',
...@@ -46,7 +46,7 @@ module.exports = { ...@@ -46,7 +46,7 @@ module.exports = {
/** /**
* 订单详情 * 订单详情
*/ */
getOrderDetail(data) { getOrderDetail (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.order.detail', method: 'dj.api.smartcarlife.order.detail',
projectName: 'boutique', projectName: 'boutique',
...@@ -54,7 +54,7 @@ module.exports = { ...@@ -54,7 +54,7 @@ module.exports = {
}) })
}, },
/**pos支付 */ /**pos支付 */
getPosQr(data) { getPosQr (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.payOrder.create', method: 'dj.api.smartcarlife.payOrder.create',
projectName: 'boutique', projectName: 'boutique',
...@@ -65,7 +65,7 @@ module.exports = { ...@@ -65,7 +65,7 @@ module.exports = {
* 查询门店录单设置 * 查询门店录单设置
}, },
*/ */
orderSettingList(data) { orderSettingList (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.order.field.setting.list', method: 'dj.api.smartcarlife.order.field.setting.list',
projectName: 'boutique', projectName: 'boutique',
...@@ -74,7 +74,7 @@ module.exports = { ...@@ -74,7 +74,7 @@ module.exports = {
}, },
/** 报价单分页列表 */ /** 报价单分页列表 */
quotationPage(data) { quotationPage (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.page', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.page',
projectName: 'boutique', projectName: 'boutique',
...@@ -82,7 +82,7 @@ module.exports = { ...@@ -82,7 +82,7 @@ module.exports = {
}) })
}, },
/** 根据id查询报价单数据 */ /** 根据id查询报价单数据 */
getQuotationInfo(data) { getQuotationInfo (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.generate', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.generate',
projectName: 'boutique', projectName: 'boutique',
...@@ -90,7 +90,7 @@ module.exports = { ...@@ -90,7 +90,7 @@ module.exports = {
}) })
}, },
/** 修改车损报价单客户基本信息信息 */ /** 修改车损报价单客户基本信息信息 */
updateCustomerInfo(data) { updateCustomerInfo (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.customer.base.info.update', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.customer.base.info.update',
projectName: 'boutique', projectName: 'boutique',
...@@ -99,7 +99,7 @@ module.exports = { ...@@ -99,7 +99,7 @@ module.exports = {
}, },
/** 报价单订单分状态统计信息 */ /** 报价单订单分状态统计信息 */
orderStatistics(data) { orderStatistics (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.order.status.statistics', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.order.status.statistics',
projectName: 'boutique', projectName: 'boutique',
...@@ -107,7 +107,7 @@ module.exports = { ...@@ -107,7 +107,7 @@ module.exports = {
}) })
}, },
// 查询订单是否支持状态变更 // 查询订单是否支持状态变更
getOrderRefundStep(data) { getOrderRefundStep (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.refundApplyRecord.isExist', method: 'dj.api.smartcarlife.refundApplyRecord.isExist',
projectName: 'boutique', projectName: 'boutique',
...@@ -115,7 +115,7 @@ module.exports = { ...@@ -115,7 +115,7 @@ module.exports = {
}) })
}, },
/**报价单-撤销工单 */ /**报价单-撤销工单 */
cancelOrderById(data) { cancelOrderById (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.quotation.cancel', method: 'dj.api.smartcarlife.quotation.cancel',
projectName: 'boutique', projectName: 'boutique',
...@@ -123,7 +123,7 @@ module.exports = { ...@@ -123,7 +123,7 @@ module.exports = {
}) })
}, },
// 车损报价单战败订单创建 // 车损报价单战败订单创建
defeatOrderCreate(data) { defeatOrderCreate (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.add.defeat.order', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.add.defeat.order',
projectName: 'boutique', projectName: 'boutique',
...@@ -131,7 +131,7 @@ module.exports = { ...@@ -131,7 +131,7 @@ module.exports = {
}) })
}, },
// 更新合同协议内容 // 更新合同协议内容
updateZyInfo(data) { updateZyInfo (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.zyPayUrl.update', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.zyPayUrl.update',
projectName: 'boutique', projectName: 'boutique',
...@@ -139,7 +139,7 @@ module.exports = { ...@@ -139,7 +139,7 @@ module.exports = {
}) })
}, },
/** 根据商户号商品id获取可选升级商品列表 */ /** 根据商户号商品id获取可选升级商品列表 */
quotationGoodsList(data) { quotationGoodsList (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.quotationGoods.list', method: 'dj.api.smartcarlife.quotationGoods.list',
projectName: 'boutique', projectName: 'boutique',
...@@ -148,14 +148,14 @@ module.exports = { ...@@ -148,14 +148,14 @@ module.exports = {
}, },
/** /**
* /** 修改车损报价单信息 */ * /** 修改车损报价单信息 */
updateQuotation(data) { updateQuotation (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.update', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.update',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}) })
}, },
getCheckEmployeeList(data) { getCheckEmployeeList (data) {
// 0->2.0 1->1.1 2->1.2 3->1.3 场景对应 // 0->2.0 1->1.1 2->1.2 3->1.3 场景对应
// data.sceneList = [1] // data.sceneList = [1]
return http.post({ return http.post({
...@@ -166,7 +166,7 @@ module.exports = { ...@@ -166,7 +166,7 @@ module.exports = {
// return api.post("dj.api.smartcarlife.employee.getByMerchantId", data); // return api.post("dj.api.smartcarlife.employee.getByMerchantId", data);
}, },
/** 更新报价单状态 */ /** 更新报价单状态 */
updateOrderStatus(data) { updateOrderStatus (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.status.update', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.status.update',
projectName: 'boutique', projectName: 'boutique',
...@@ -178,7 +178,7 @@ module.exports = { ...@@ -178,7 +178,7 @@ module.exports = {
* 服务信息详情 * 服务信息详情
* *
*/ */
getServiceInfoDetail(data) { getServiceInfoDetail (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.detail', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.detail',
projectName: 'boutique', projectName: 'boutique',
...@@ -186,7 +186,7 @@ module.exports = { ...@@ -186,7 +186,7 @@ module.exports = {
}) })
}, },
/** 权益单分页列表 */ /** 权益单分页列表 */
equityPage(data) { equityPage (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.page', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.page',
projectName: 'boutique', projectName: 'boutique',
...@@ -194,11 +194,55 @@ module.exports = { ...@@ -194,11 +194,55 @@ module.exports = {
}) })
}, },
/** 权益单统计信息 */ /** 权益单统计信息 */
equityStatistics(data) { equityStatistics (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.statics', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.statics',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}) })
} },
// 更新客户签名
updateCustomerNameUrlAPI (data) {
return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.updateCustomerNameUrl',
projectName: 'boutique',
...data
})
},
/** 查询合同*/
equityOrderList (data) {
return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.listContracts',
projectName: 'boutique',
...data
})
},
/** 打印合同*/
printContract (data) {
return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.print',
projectName: 'boutique',
...data
})
},
/**
* 提交前检查车架号是否已购买
*/
checkVinBuyEquityOrder (data) {
return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.vin.check',
projectName: 'boutique',
...data
}, true)
},
/**提交权益单
*
*/
addEquityOrder (data) {
return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.add',
projectName: 'boutique',
...data
}, true)
},
} }
...@@ -2,7 +2,7 @@ import http from '../request/http' ...@@ -2,7 +2,7 @@ import http from '../request/http'
module.exports = { module.exports = {
/** 销售顾问/录单员 & 交付专员 */ /** 销售顾问/录单员 & 交付专员 */
getEmployeeList(data) { getEmployeeList (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.employee.onTheJob.getByMerchantId', method: 'dj.api.smartcarlife.employee.onTheJob.getByMerchantId',
projectName: 'boutique', projectName: 'boutique',
...@@ -13,7 +13,7 @@ module.exports = { ...@@ -13,7 +13,7 @@ module.exports = {
* 二级流量方 * 二级流量方
*/ */
getDiversionMerchantRef(data) { getDiversionMerchantRef (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.diversionMerchant.getDiversionMerchantRef', method: 'dj.api.smartcarlife.diversionMerchant.getDiversionMerchantRef',
projectName: 'boutique', projectName: 'boutique',
...@@ -24,7 +24,7 @@ module.exports = { ...@@ -24,7 +24,7 @@ module.exports = {
* 获取门店品牌车型 * 获取门店品牌车型
*/ */
getMerchantCarBrandList(data) { getMerchantCarBrandList (data) {
return http.post({ return http.post({
method: 'dj.api.get.car.brandList', method: 'dj.api.get.car.brandList',
projectName: 'boutique', projectName: 'boutique',
...@@ -36,7 +36,7 @@ module.exports = { ...@@ -36,7 +36,7 @@ module.exports = {
/*** /***
* 获取门店礼券列表 * 获取门店礼券列表
*/ */
getMerchantCouponList(data) { getMerchantCouponList (data) {
return http.post({ return http.post({
method: 'dj.api.smartCarLife.merchant.coupon.list', method: 'dj.api.smartCarLife.merchant.coupon.list',
projectName: 'boutique', projectName: 'boutique',
...@@ -46,7 +46,7 @@ module.exports = { ...@@ -46,7 +46,7 @@ module.exports = {
/** /**
* 获取客户礼券列表 * 获取客户礼券列表
*/ */
getCustomerCouponList(data) { getCustomerCouponList (data) {
return http.post({ return http.post({
method: 'dj.api.customer.coupon.list', method: 'dj.api.customer.coupon.list',
projectName: 'boutique', projectName: 'boutique',
...@@ -56,7 +56,7 @@ module.exports = { ...@@ -56,7 +56,7 @@ module.exports = {
/** /**
* 获取商品列表 * 获取商品列表
*/ */
getGoodsList(data) { getGoodsList (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.selectOrderGoods.list', method: 'dj.api.smartcarlife.selectOrderGoods.list',
projectName: 'boutique', projectName: 'boutique',
...@@ -65,7 +65,7 @@ module.exports = { ...@@ -65,7 +65,7 @@ module.exports = {
}, },
/**获取订单列表筛选转化人员&销售顾问 */ /**获取订单列表筛选转化人员&销售顾问 */
getOrderScreenEmployeeList(data) { getOrderScreenEmployeeList (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.employee.getByMerchantId', method: 'dj.api.smartcarlife.employee.getByMerchantId',
projectName: 'boutique', projectName: 'boutique',
...@@ -75,7 +75,7 @@ module.exports = { ...@@ -75,7 +75,7 @@ module.exports = {
/** /**
* 获取园区店配置 * 获取园区店配置
*/ */
getYqStoreConfig(data) { getYqStoreConfig (data) {
return http.get({ return http.get({
method: 'dj.api.smarcarlife.yqMerchantConfig.detail', method: 'dj.api.smarcarlife.yqMerchantConfig.detail',
projectName: 'boutique', projectName: 'boutique',
...@@ -86,7 +86,7 @@ module.exports = { ...@@ -86,7 +86,7 @@ module.exports = {
* 战败下单商品列表 * 战败下单商品列表
* *
*/ */
getOrderUpgradeGoodsList(data) { getOrderUpgradeGoodsList (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.orderUpgradeGoods.listByMerchantId', method: 'dj.api.smartcarlife.orderUpgradeGoods.listByMerchantId',
projectName: 'boutique', projectName: 'boutique',
...@@ -96,7 +96,7 @@ module.exports = { ...@@ -96,7 +96,7 @@ module.exports = {
/** /**
* 获取精品升级场景 太阳膜类商品部位数据 * 获取精品升级场景 太阳膜类商品部位数据
*/ */
getPositionList(data) { getPositionList (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.goodsPosition.list', method: 'dj.api.smartcarlife.goodsPosition.list',
projectName: 'boutique', projectName: 'boutique',
...@@ -107,7 +107,7 @@ module.exports = { ...@@ -107,7 +107,7 @@ module.exports = {
* 获取提单客户档案列表 * 获取提单客户档案列表
* *
*/ */
getQuotationCustomerList(data) { getQuotationCustomerList (data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.customer.page', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.quotation.customer.page',
projectName: 'boutique', projectName: 'boutique',
...@@ -115,7 +115,7 @@ module.exports = { ...@@ -115,7 +115,7 @@ module.exports = {
}) })
}, },
/**搜索订单(含套餐) */ /**搜索订单(含套餐) */
getWorkPackageGoodsList(data) { getWorkPackageGoodsList (data) {
let params = data || {} let params = data || {}
params.sceneType = 1 params.sceneType = 1
return http.post( return http.post(
...@@ -131,5 +131,31 @@ module.exports = { ...@@ -131,5 +131,31 @@ module.exports = {
'dj', 'dj',
1000000 1000000
) )
} },
/**
* 获取车品牌
*/
getCarBrandList (data = {}) {
return http.post({
method: 'scrm.api.carlife.common.getOnlyCarBrandList',
projectName: 'carlife',
...data
}, false, 'scrm')
},
/** 获取车系列表 */
getCarSeriesList (data = {}) {
return http.post({
method: 'scrm.api.carlife.common.getCarSeriesList',
projectName: 'carlife',
...data
}, false, 'scrm')
},
/** 获取车型 */
getCarTypeList (data = {}) {
return http.post({
method: 'scrm.api.carlife.common.getCarTypeList',
projectName: 'carlife',
...data
}, false, 'scrm')
},
} }
No preview for this file type
...@@ -140,6 +140,9 @@ ...@@ -140,6 +140,9 @@
.ml-32 { .ml-32 {
margin-left: toRpx(32); margin-left: toRpx(32);
} }
.ml-36 {
margin-left: toRpx(36);
}
.ml-48 { .ml-48 {
margin-left: toRpx(48); margin-left: toRpx(48);
} }
......

2.93 MB | W: | H:

2.94 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template> <template>
<view <view class="gl-cell">
class="gl-cell"
v-if="formList.length"
>
<view <view
v-for="(items, boxIdx) in formList" v-for="(items, boxIdx) in formList"
:key="boxIdx" :key="boxIdx"
class="cell-box-block" class="cell-box-block"
> >
<view class="cell-box"> <view
class="cell-box"
v-if="items.length"
:style="cellBoxStyle"
>
<template v-if="titleList.length"> <template v-if="titleList.length">
<view <view
class="cell-title flex" class="cell-title flex"
...@@ -52,6 +53,12 @@ ...@@ -52,6 +53,12 @@
v-if="item.required" v-if="item.required"
class="required" class="required"
>*</view> >*</view>
<template v-if="item.labelTips">
<view
class="label-tips"
@click.stop="onLabelTipsClick(item)"
>{{ item.labelTips }}</view>
</template>
</view> </view>
<view class="cell-value"> <view class="cell-value">
<!-- 输入框 --> <!-- 输入框 -->
...@@ -66,6 +73,7 @@ ...@@ -66,6 +73,7 @@
:maxlength="item.maxlength ? item.maxlength : -1" :maxlength="item.maxlength ? item.maxlength : -1"
placeholder-class="input-placeholder" placeholder-class="input-placeholder"
@input="item.inputType === 'number' && item.maxlength ? (formData[item.value] = String($event.target.value).slice(0, item.maxlength)) : null" @input="item.inputType === 'number' && item.maxlength ? (formData[item.value] = String($event.target.value).slice(0, item.maxlength)) : null"
:readonly="item.readonly || false"
/> />
<view <view
v-if="item.valueIcon" v-if="item.valueIcon"
...@@ -123,6 +131,63 @@ ...@@ -123,6 +131,63 @@
:maxlength="item.maxlength" :maxlength="item.maxlength"
></textarea> ></textarea>
</template> </template>
<template v-else-if="item.type === 'single-calendar'">
<view
class="value"
@click="openCalendar(boxIdx,idx)"
>
<template v-if="!item.addHtml && formData[item.value]">
{{ formData[item.value] }}
</template>
<template v-else>
<span class="placeholder">请选择</span>
</template>
<view class="sprite-icon icon-icon-select"></view>
</view>
<uni-calendar
:ref="`calendar-${boxIdx}-${idx}`"
:insert="false"
:clearDate="false"
:startDate="item.startDate || ''"
:endDate="item.endDate || ''"
:date="formData[item.value] || item.endDate"
showBottomBtn
@confirm="confirmCalendar($event,item.value )"
/>
</template>
<template v-else-if="item.type === 'range-calendar'">
<view
class="value"
@click="openCalendar(boxIdx,idx)"
>
<template v-if="!item.addHtml && formData[item.value]">
{{ formData[item.value] }}
</template>
<template v-else>
<span class="placeholder">请选择</span>
</template>
<view class="sprite-icon icon-icon-select"></view>
</view>
<uni-calendar
:ref="`calendar-${boxIdx}-${idx}`"
range
:insert="false"
:clearDate="false"
:startDate="item.startDate || ''"
:endDate="item.endDate || ''"
:rangeValue="formData[item.value]"
showBottomBtn
@confirm="confirmCalendar($event,item.value)"
/>
</template>
<slot
v-else-if="item.cellHtml"
:name="item.cellHtml"
></slot>
<template v-if="item.suffix">
<view class="suffix">{{item.suffix}}</view>
</template>
</view> </view>
</view> </view>
<slot <slot
...@@ -140,6 +205,7 @@ ...@@ -140,6 +205,7 @@
</template> </template>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
...@@ -171,7 +237,9 @@ export default { ...@@ -171,7 +237,9 @@ export default {
type: Array, type: Array,
default: () => [] default: () => []
}, },
collapseControl: Boolean collapseControl: Boolean,
cellBoxStyle: String,
index: Number
}, },
data () { data () {
return { return {
...@@ -184,7 +252,7 @@ export default { ...@@ -184,7 +252,7 @@ export default {
methods: { methods: {
onCellClick (item) { onCellClick (item) {
if (item.type === 'select') { if (item.type === 'select') {
this.$emit('handleCell', item) this.$emit('handleCell', item, this.index)
} }
}, },
onRadioChange (e, item) { onRadioChange (e, item) {
...@@ -194,10 +262,20 @@ export default { ...@@ -194,10 +262,20 @@ export default {
this.$emit('handleValue', item) this.$emit('handleValue', item)
}, },
handleBlur (e, item) { handleBlur (e, item) {
this.$emit('inputBlur', e, item) this.$emit('inputBlur', e, item, this.index)
}, },
collapseAll (index) { collapseAll (index) {
this.$emit('collapseAll', index) this.$emit('collapseAll', index)
},
confirmCalendar (e, key) {
this.$emit('confirmCalendar', e, key, this.index)
},
openCalendar (index, ind) {
let [calendar] = this.$refs[`calendar-${index}-${ind}`]
if (calendar) calendar.open()
},
onLabelTipsClick (item) {
this.$emit('handleLabelTips', item)
} }
} }
} }
...@@ -270,7 +348,12 @@ export default { ...@@ -270,7 +348,12 @@ export default {
font-size: toRpx(28); font-size: toRpx(28);
display: flex; display: flex;
align-items: center; align-items: center;
.label-tips {
margin-left: 8rpx;
color: #4673ff;
font-size: 24rpx;
font-weight: 400;
}
.sprite-icon { .sprite-icon {
margin-right: toRpx(8); margin-right: toRpx(8);
} }
...@@ -304,7 +387,12 @@ export default { ...@@ -304,7 +387,12 @@ export default {
margin-left: toRpx(20); margin-left: toRpx(20);
overflow: hidden; overflow: hidden;
font-size: toRpx(28); font-size: toRpx(28);
display: flex;
align-items: center;
.suffix {
flex-shrink: 0;
margin-left: 16rpx;
}
uni-input { uni-input {
font-size: toRpx(28); font-size: toRpx(28);
} }
...@@ -318,6 +406,8 @@ export default { ...@@ -318,6 +406,8 @@ export default {
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
height: 100%; height: 100%;
width: 100%;
word-break: break-all;
.sprite-icon { .sprite-icon {
margin-bottom: toRpx(2); margin-bottom: toRpx(2);
} }
...@@ -345,6 +435,7 @@ export default { ...@@ -345,6 +435,7 @@ export default {
width: 100%; width: 100%;
border: none; border: none;
padding: 0; padding: 0;
background-color: transparent;
} }
.input-bottom { .input-bottom {
min-height: toRpx(100); min-height: toRpx(100);
......
...@@ -567,8 +567,6 @@ export default { ...@@ -567,8 +567,6 @@ export default {
const noInterceptPage = ['DailyReport', 'DeliveryManagement'], const noInterceptPage = ['DailyReport', 'DeliveryManagement'],
{ sceneType } = this { sceneType } = this
if (!noInterceptPage.includes(item.name)) { if (!noInterceptPage.includes(item.name)) {
// 日报
if (await this.checkDailyReport(sceneType != 7)) return
if (sceneType != 7) { if (sceneType != 7) {
// if (await this.inspectionOfProhibitionBill()) return // if (await this.inspectionOfProhibitionBill()) return
// 检查是否限制录单 // 检查是否限制录单
...@@ -579,6 +577,7 @@ export default { ...@@ -579,6 +577,7 @@ export default {
return return
} }
} }
if (await this.checkDailyReport(sceneType != 7)) return
} }
if (item.name === 'EvaluationFormList') { if (item.name === 'EvaluationFormList') {
mediaResourceManager.cleanupExpired() mediaResourceManager.cleanupExpired()
......
<template>
<view
class="car-model-box"
:key="viewKey"
>
<scroll-view
class="scroll-view"
scroll-y
:scroll-into-view="letter"
>
<template v-if="listData.length">
<template v-for="(i, index) in listData">
<view
class="item-box"
:key="index"
:id="i.letter"
>
<view class="letter-title flex">{{i.letter}}</view>
<template v-for="(c,cindex) in i.list">
<view
class="car-model"
:key="cindex"
>
<view class="brand-name">{{c.name}}</view>
<view class="brand-list">
<template v-for="(j, jindex) in c.childs_list">
<view
:key="jindex"
:class="['sub-brand-name']"
>
<view
class="subtitle subtitle-one flex"
@click.stop="chooseSubBrand(j, c , jindex, cindex, index)"
>
{{j.name}}
<uni-icons
:type="`${j.children && j.children.length?'down':'right'}`"
size="18"
></uni-icons>
</view>
</view>
<template v-for="(k,kindex) in j.children">
<view
class="sub-item flex"
:key="`${k.id}_${kindex}`"
>
<view
class="subtitle subtitle-two flex"
@click.stop="chooseSeries(k,jindex, cindex, index ,kindex)"
>
{{k.name}}
<uni-icons
:type="`${k.children && k.children.length?'down':'right'}`"
size="18"
></uni-icons>
</view>
<template v-for="(s,sindex) in k.children">
<view
:class="['item flex',{active: checkActive(s)}]"
:key="`${s.id}_${sindex}`"
@click.stop="chooseCarType(s,c)"
>
{{s.name}}
<view class="sprite-icon icon-tag-checked"></view>
</view>
</template>
</view>
</template>
</template>
</view>
</view>
</template>
</view>
</template>
<view class="block"></view>
</template>
</scroll-view>
<view class="letter-list">
<template v-for="(i, index) in listData">
<view
class="letter-item"
:key="index"
@click="letter = i.letter"
>
{{i.letter}}
</view>
</template>
</view>
<view class="right-box">
</view>
</view>
</template>
<script type='text/ecmascript-6'>
import popupmixin from './popupmixin'
export default {
mixins: [popupmixin],
name: 'CarBrand',
data () {
return {
letter: 'A',
viewKey: Date.now()
}
},
mounted () {
},
methods: {
async getList (searchValue) {
const { userInfo, params } = this,
{ cacheData } = params
this.currentId = ''
if (cacheData && cacheData.length) {
this.initData(cacheData)
if (searchValue) this.handleSearch(searchValue)
return
}
const data = await uni.$api.popupApi.getCarBrandList()
this.updateParams(params, data || [])
},
initData (carData) {
let { params: { idKey }, data: { customer, carInfo }, sceneType } = this,
letterList = Array.from(new Set([...carData.map((e) => e.letter)])),
carModelList = letterList.map(e => {
let list = []
carData.map(i => {
if (e === i.letter) {
i.childs_list = i.childs;
list.push(i)
}
})
return {
letter: e,
list,
}
})
this.list = carModelList
this.$emit('onComplete')
},
handleSearch (searchValue) {
if (!searchValue) {
this.searchStatus = false
this.letter = 'A'
} else {
searchValue = searchValue.toUpperCase()
let { list } = this,
carBrand = JSON.parse(JSON.stringify(list))
let arr = [];
carBrand.map(c => {
c.list.map(i => {
let childs_list = [],
i_name = i.name.toUpperCase()
i.childs_list.map((k) => {
let k_name = k.name.toUpperCase()
if (k_name.indexOf(searchValue) != -1) {
childs_list.push(k);
}
});
if (i_name.indexOf(searchValue) != -1 || childs_list.length > 0) {
i.childs_list = childs_list.length > 0 ? childs_list : i.childs_list;
arr.push(i);
}
})
})
let letterList = Array.from(new Set([...arr.map((e) => e.letter)]));
let searchList = letterList.map((l) => {
let _list = [];
arr.map((i) => {
if (l === i.letter) {
_list.push(i);
}
})
return {
letter: l,
list: _list,
}
})
this.searchList = searchList
this.searchStatus = true
}
},
async chooseSubBrand (that, item, jindex, cindex, index) {
if(that.children && that.children.length) return
uni.showLoading({
mask: true
})
const data = await uni.$api.popupApi.getCarSeriesList({
brandId: item.id,
childBrandId: that.id
})
uni.hideLoading()
this.listData[index].list[cindex].childs_list[jindex].children = data
this.viewKey = Date.now()
},
async chooseSeries (k, jindex, cindex, index, kindex) {
if (k.children && k.children.length) return
uni.showLoading({
mask: true
})
const data = await uni.$api.popupApi.getCarTypeList({
carSeriesId: k.id
})
uni.hideLoading()
this.listData[index].list[cindex].childs_list[jindex].children[kindex].children = data
this.viewKey = Date.now()
},
chooseCarType (s, c) {
let chooseItem = {
vehicleBrandId: c.id,
vehicleBrandName: c.name,
vehicleSubBrandId: s.brandId,
vehicleSubBrandName: s.brandName,
vehicleSeriesId: s.seriesId,
vehicleSeriesName: s.seriesName,
vehicleShapeId: s.id,
vehicleShapeName: s.name
}
this.currentId = s.id
this.$emit('choose', chooseItem)
},
checkActive (j) {
let { currentId, data, params } = this
return currentId ?
j.id == currentId : j.id == data[params.idKey]
},
}
}
</script>
<style scoped lang='scss'>
.car-model-box {
position: relative;
height: 100%;
width: 100%;
.scroll-view {
height: 100%;
}
.letter-list {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 0;
color: #888888;
font-size: toRpx(28);
line-height: toRpx(28);
padding: 0 toRpx(18);
text-align: center;
}
.item-box {
margin-bottom: toRpx(32);
.letter-title {
color: #888888;
font-size: toRpx(28);
height: toRpx(40);
background: #f5f7fa;
padding-left: toRpx(48);
}
.car-model {
margin: 0 toRpx(48);
.brand-name {
color: #333333;
font-size: toRpx(32);
line-height: toRpx(44);
margin: toRpx(16) 0;
}
.sub-brand-name {
color: #888888;
font-size: toRpx(28);
line-height: toRpx(40);
width: 100%;
flex-shrink: 0;
border-bottom: toRpx(2) solid #888;
}
}
}
.brand-list {
// display: grid;
// grid-template-columns: repeat(4, 1fr);
display: flex;
// gap: toRpx(32) 0;
flex-wrap: wrap;
.subtitle {
width: 100%;
flex-shrink: 0;
}
.subtitle-one {
margin: toRpx(10) 0;
}
.subtitle-two {
color: #000;
font-size: toRpx(36);
font-weight: 500;
}
.sub-item {
width: 100%;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
display: flex;
flex-wrap: wrap;
gap: toRpx(32);
margin-top: toRpx(20);
align-items: stretch;
}
.item {
width: calc((100% - #{toRpx(96)}) / 4);
justify-content: center;
min-height: toRpx(72);
border-radius: toRpx(8);
border: toRpx(2) solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
padding: toRpx(10);
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
}
.block {
width: 100%;
height: toRpx(24);
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -282,17 +282,17 @@ export default { ...@@ -282,17 +282,17 @@ export default {
.step-box { .step-box {
height: toRpx(64); height: toRpx(64);
justify-content: center; justify-content: center;
gap: 0 96rpx; gap: 0 toRpx(96);
position: relative; position: relative;
margin-bottom: 16rpx; margin-bottom: toRpx(16);
.step { .step {
height: 64rpx; height: toRpx(64);
border-radius: 12rpx; border-radius: toRpx(12);
background: #f2f2f2; background: #f2f2f2;
justify-content: center; justify-content: center;
padding: 0 32rpx; padding: 0 toRpx(32);
color: #666666; color: #666666;
font-size: 28rpx; font-size: toRpx(28);
} }
.step-active { .step-active {
background: #dee7ff; background: #dee7ff;
...@@ -304,8 +304,8 @@ export default { ...@@ -304,8 +304,8 @@ export default {
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
content: ''; content: '';
width: 16rpx; width: toRpx(16);
height: 2rpx; height: toRpx(2);
background: #cccccc; background: #cccccc;
} }
} }
......
<template>
<view class="gearbox-list">
<template v-for="(i, index) in list">
<view
:key="index"
@click="choose(i)"
:class="['item flex', { active: currentId ? i.value == currentId : i.value == data[params.idKey] }]"
>
<view class="sprite-icon icon-tag-checked"></view>
<template v-if="!i.type">
{{ i.value }}
</template>
<template v-else>
<input
type="text"
v-model="i.value"
class="input"
:placeholder="i.label"
>
</template>
</view>
</template>
</view>
</template>
<script type="text/ecmascript-6">
import popupmixin from './popupmixin'
export default {
mixins: [popupmixin],
name: 'Gearbox',
inject: ['userInfo'],
data () {
return {
}
},
mounted () {
},
methods: {
async getList () {
const { params } = this
this.currentId = ''
let data = [
{
value: 'MT变速箱'
},
{
value: 'AMT变速箱'
},
{
value: 'AT变速箱'
},
{
value: 'CVT变速箱'
},
{
value: 'DCT变速箱'
},
{
label: '自定义',
value: '',
type: 'input'
}
]
this.updateParams(params, data)
},
initData (list) {
const { params: { idKey }, data } = this
console.log(data[idKey])
if (data[idKey]) {
this.currentId = data[idKey]
this.$emit('choose', data[idKey])
let index = list.findIndex(item => item.value == data[idKey])
if(index == -1) list[list.length - 1].value = data[idKey]
}
this.list = list
this.$emit('onComplete')
},
handleSearch (searchValue) {
this.list = []
this.getList(searchValue, true)
},
choose (i) {
this.currentId = i.value
this.$emit('choose', i.value)
}
}
}
</script>
<style scoped lang="scss">
.gearbox-list {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: toRpx(32);
margin: 0 toRpx(48);
.item {
justify-content: center;
height: toRpx(72);
border-radius: toRpx(8);
border: toRpx(2) solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
.input{
width: 100%;
height: 100%;
text-align: center;
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
<template>
<view class="seat-list">
<template v-for="(i, index) in list">
<view
:key="index"
@click="choose(i)"
:class="['item flex', { active: currentId != null ? i.optionId == currentId : i.optionId == data[params.idKey] }]"
>
<view class="sprite-icon icon-tag-checked"></view>
{{ i.optionLabel }}
</view>
</template>
</view>
</template>
<script type="text/ecmascript-6">
import popupmixin from './popupmixin'
export default {
mixins: [popupmixin],
name: 'Options',
inject: ['userInfo'],
data () {
return {
}
},
mounted () {
},
methods: {
async getList () {
const { params } = this
this.currentId = '-1'
this.updateParams(params, params.options)
},
initData (list) {
const { params: { idKey }, data } = this
if (data[idKey] != null) {
this.currentId = data[idKey]
this.$emit('choose', data[idKey])
}
this.list = list
this.$emit('onComplete')
},
choose (i) {
this.currentId = i.optionId
this.$emit('choose', i)
}
}
}
</script>
<style scoped lang="scss">
.seat-list {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: toRpx(32);
margin: 0 toRpx(48);
.item {
justify-content: center;
height: toRpx(72);
border-radius: toRpx(8);
border: toRpx(2) solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
...@@ -21,6 +21,12 @@ ...@@ -21,6 +21,12 @@
* 18: 座位数 * 18: 座位数
* 19: 客户档案 * 19: 客户档案
* 20: 战败客户档案 * 20: 战败客户档案
* 21: 客户类型
* 22: 证件类型
* 23: 购车类型
* 24: 车辆使用性质
* 25: 选择品牌车系
* 26: 变速箱类型
*/ */
const componentConfig = { const componentConfig = {
...@@ -239,6 +245,108 @@ const componentConfig = { ...@@ -239,6 +245,108 @@ const componentConfig = {
searchValue: '', searchValue: '',
noData: false, noData: false,
defeat: true defeat: true
} },
21: {
name: 'Options',
title: '客户类型',
nullTips: '请选择客户类型',
idKey: 'customerType',
hideSearch: true,
loadComplete: false,
options: [{
optionId: 1,
optionLabel: '个人'
}, {
optionId: 2,
optionLabel: '企业'
}, {
optionId: 3,
optionLabel: '个人(港澳)'
}, {
optionId: 4,
optionLabel: '个人(台)'
}, {
optionId: 5,
optionLabel: '个人(军官)'
}]
},
22: {
name: 'Options',
title: '证件类型',
nullTips: '请选择证件类型',
idKey: 'cardType',
hideSearch: true,
loadComplete: false,
options: [{
optionId: 1,
optionLabel: '身份证'
}, {
optionId: 2,
optionLabel: '统一社会信息代码'
}, {
optionId: 3,
optionLabel: '港澳返乡证'
}, {
optionId: 4,
optionLabel: '台胞证'
}, {
optionId: 5,
optionLabel: '军官证'
}, {
optionId: 7,
optionLabel: '护照'
}]
},
23: {
name: 'Options',
title: '购车类型',
nullTips: '请选择购车类型',
idKey: 'buyCarType',
hideSearch: true,
loadComplete: false,
options: [{
optionId: 0,
optionLabel: '贷款车'
}, {
optionId: 1,
optionLabel: '全款车'
}]
},
24: {
name: 'Options',
title: '车辆使用性质',
nullTips: '请选择车辆使用性质',
idKey: 'vehicleNature',
hideSearch: true,
loadComplete: false,
options: [{
optionId: 0,
optionLabel: '营运'
}, {
optionId: 1,
optionLabel: '非营运'
}]
},
25: {
name: 'CarBrand',
title: '选择品牌车系',
placeholder: '查找',
idKey: 'vehicleShapeId',
nullTips: '请选择品牌车系',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false,
hideSearch: true,
popupStyle: 'height:90vh;'
},
26: {
name: 'Gearbox',
title: '变速箱类型',
nullTips: '请选择变速箱类型',
idKey: 'gearbox',
hideSearch: true,
loadComplete: false
},
} }
export default { componentConfig } export default { componentConfig }
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
@onCancel="cancel" @onCancel="cancel"
@onReset="reset" @onReset="reset"
:showReset="popupType === 15" :showReset="popupType === 15"
:hideFooter="componentObject[popupType].hideFooter"
:popupStyle="componentObject[popupType].popupStyle || ''"
> >
<view class="popup-title flex"> <view class="popup-title flex">
{{ title }} {{ title }}
...@@ -44,7 +46,11 @@ ...@@ -44,7 +46,11 @@
</view> </view>
</view> </view>
</template> </template>
<view :class="['popup-body', { 'hide-search': componentObject[popupType].hideSearch }]"> <view :class="['popup-body',
{'hide-footer': componentObject[popupType].hideFooter },
{'hide-search': componentObject[popupType].hideSearch },
{'hide-footer-search':componentObject[popupType].hideFooter && componentObject[popupType].hideSearch }
]">
<scroll-view <scroll-view
scroll-y scroll-y
:class="['popup-scroll-view', { show: componentObject[popupType].loadComplete }]" :class="['popup-scroll-view', { show: componentObject[popupType].loadComplete }]"
...@@ -100,6 +106,10 @@ import AgeRange from './components/AgeRange.vue' ...@@ -100,6 +106,10 @@ import AgeRange from './components/AgeRange.vue'
import City from './components/City.vue' import City from './components/City.vue'
import Seat from './components/Seat.vue' import Seat from './components/Seat.vue'
import Customer from './components/Customer.vue' import Customer from './components/Customer.vue'
import Options from './components/Options.vue'
import CarBrand from './components/CarBrand.vue'
import Gearbox from './components/Gearbox.vue'
export default { export default {
components: { components: {
Popup, Popup,
...@@ -119,6 +129,9 @@ export default { ...@@ -119,6 +129,9 @@ export default {
City, City,
Seat, Seat,
Customer, Customer,
Options,
CarBrand,
Gearbox
}, },
name: '', name: '',
props: { props: {
...@@ -202,7 +215,7 @@ export default { ...@@ -202,7 +215,7 @@ export default {
sceneType () { sceneType () {
const { sceneType } = uni.$storage.get('userInfo') const { sceneType } = uni.$storage.get('userInfo')
return sceneType return sceneType
} },
}, },
mounted () { mounted () {
}, },
...@@ -250,7 +263,7 @@ export default { ...@@ -250,7 +263,7 @@ export default {
if (!autoClose) this.$refs.popup.close() if (!autoClose) this.$refs.popup.close()
return return
} }
if (chooseContent) { if (chooseContent != null) {
if (Array.isArray(chooseContent) && !chooseContent.length && componentObject[popupType].nullTips) throw componentObject[popupType].nullTips if (Array.isArray(chooseContent) && !chooseContent.length && componentObject[popupType].nullTips) throw componentObject[popupType].nullTips
this.$emit('onConfirm', { this.$emit('onConfirm', {
chooseContent, chooseContent,
...@@ -381,6 +394,15 @@ export default { ...@@ -381,6 +394,15 @@ export default {
padding-top: 0; padding-top: 0;
} }
} }
.hide-footer {
height: calc(100% - #{toRpx(184)});
}
.hide-footer-search {
height: calc(100% - #{toRpx(104)});
.popup-scroll-view {
padding-top: 0;
}
}
.popup-footer { .popup-footer {
padding: toRpx(64) 0; padding: toRpx(64) 0;
justify-content: center; justify-content: center;
...@@ -412,6 +434,11 @@ export default { ...@@ -412,6 +434,11 @@ export default {
justify-content: center; justify-content: center;
} }
} }
.car-popup {
.popup-box {
height: 90vh;
}
}
.right-box { .right-box {
width: 46vw; width: 46vw;
height: 100vh; height: 100vh;
......
<template> <template>
<uni-popup ref="popup" :type="position" :is-mask-click="maskClick" :animation="animation"> <uni-popup ref="popup" :type="position" :is-mask-click="maskClick" :animation="animation">
<view :class="['popup-box', { 'right-box': position == 'right' }]"> <view :class="['popup-box', { 'right-box': position == 'right' }]" :style="popupStyle">
<slot></slot> <slot></slot>
<view class="popup-footer flex" v-if="showReset"> <template v-if="!hideFooter">
<view class="popup-btn-three popup-cancel" @click="cancel">{{ cancelText }}</view> <view class="popup-footer flex" v-if="showReset">
<view class="popup-btn-three popup-reset" @click="reset">{{ resetText }}</view> <view class="popup-btn-three popup-cancel" @click="cancel">{{ cancelText }}</view>
<view class="popup-btn-three popup-confirm" @click="confirm">{{ confirmText }}</view> <view class="popup-btn-three popup-reset" @click="reset">{{ resetText }}</view>
</view> <view class="popup-btn-three popup-confirm" @click="confirm">{{ confirmText }}</view>
<view class="popup-footer flex" v-else> </view>
<view class="popup-btn popup-cancel" @click="cancel">{{ cancelText }}</view> <view class="popup-footer flex" v-else>
<view class="popup-btn popup-confirm" @click="confirm">{{ confirmText }}</view> <view class="popup-btn popup-cancel" @click="cancel">{{ cancelText }}</view>
</view> <view class="popup-btn popup-confirm" @click="confirm">{{ confirmText }}</view>
</view>
</template>
</view> </view>
</uni-popup> </uni-popup>
</template> </template>
...@@ -47,7 +49,12 @@ export default { ...@@ -47,7 +49,12 @@ export default {
showReset: { showReset: {
type: Boolean, type: Boolean,
default: false default: false
} },
popupStyle: {
type: String,
default: ''
},
hideFooter:Boolean
}, },
......
...@@ -186,6 +186,7 @@ export default { ...@@ -186,6 +186,7 @@ export default {
padding: 0 toRpx(40); padding: 0 toRpx(40);
flex-shrink: 0; flex-shrink: 0;
position: relative; position: relative;
background-color: #eef4fe;
&:first-of-type { &:first-of-type {
padding-left: toRpx(80); padding-left: toRpx(80);
} }
......
...@@ -218,7 +218,7 @@ export default { ...@@ -218,7 +218,7 @@ export default {
positionTypeList: [], positionTypeList: [],
valueKey: '', valueKey: '',
totalPrice: 0, totalPrice: 0,
validateState:true, validateState: true,
// 产品槽位配置,用于循环渲染产品组件 // 产品槽位配置,用于循环渲染产品组件
productSlots: { productSlots: {
frontGear: true, frontGear: true,
...@@ -285,7 +285,12 @@ export default { ...@@ -285,7 +285,12 @@ export default {
// 防止从补录进来4s店收款为禁用 // 防止从补录进来4s店收款为禁用
const cell = this.formList[2].find(item => item.value == 'payeeType') const cell = this.formList[2].find(item => item.value == 'payeeType')
if (cell) { if (cell) {
cell.current = 1 // 编辑订单时,使用已有的payeeType值,新建订单时使用默认值1
if (!this.orderObj.id) {
cell.current = 1
} else {
cell.current = this.orderObj.payeeType
}
cell.radioList[1].disabled = false cell.radioList[1].disabled = false
} }
this.getConfig() this.getConfig()
...@@ -385,21 +390,23 @@ export default { ...@@ -385,21 +390,23 @@ export default {
inputBlur(e, val) { inputBlur(e, val) {
console.log(e, val) console.log(e, val)
this.orderObj.customer[val.value] = this.orderObj[val.value] this.orderObj.customer[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写 // VIN车架号动态校验:车架号字段,动态转换为大写
let standNoVal = this.orderObj.standNo; let standNoVal = this.orderObj.standNo
if (val.value === 'standNo' && standNoVal) { if (val.value === 'standNo' && standNoVal) {
this.orderObj.standNo = formatVinInput(standNoVal) this.orderObj.standNo = formatVinInput(standNoVal)
validateVin(this.orderObj.standNo).then(result => { validateVin(this.orderObj.standNo)
console.log("validateVin",result); .then(result => {
let { valid } = result.data; console.log('validateVin', result)
this.validateState = valid let { valid } = result.data
// 校验成功,所有提示已在公共方法中处理 this.validateState = valid
console.log('车架号校验成功:', result) // 校验成功,所有提示已在公共方法中处理
}).catch(err => { console.log('车架号校验成功:', result)
console.log("validateVinErr",result); })
}) .catch(err => {
} console.log('validateVinErr', result)
})
}
}, },
// 校验必填等规则 // 校验必填等规则
checkRequired() { checkRequired() {
...@@ -476,22 +483,22 @@ export default { ...@@ -476,22 +483,22 @@ export default {
// 提交 // 提交
async submit() { async submit() {
// VIN车架号-动态校验 // VIN车架号-动态校验
const carVin = this.orderObj.standNo const carVin = this.orderObj.standNo
console.log("validateState",this.validateState); console.log('validateState', this.validateState)
if (carVin) { if (carVin) {
// 前置判断 // 前置判断
if (carVin.length !== 17) { if (carVin.length !== 17) {
uni.showToast({title:'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',icon:'none'}) uni.showToast({ title: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)', icon: 'none' })
return false return false
} }
// 根据接口校验结果判断 // 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) { if (carVin.length === 17 && !this.validateState) {
uni.showToast({title:'车架号校验不匹配,请核对后重新输入',icon:'none'}) uni.showToast({ title: '车架号校验不匹配,请核对后重新输入', icon: 'none' })
return false return false
} }
} }
if (!(await this.checkDailyReport())) { if (!(await this.checkDailyReport())) {
const { orderCreateType } = this const { orderCreateType } = this
const obj = utils.deepClone(this.orderObj) const obj = utils.deepClone(this.orderObj)
......
...@@ -595,35 +595,38 @@ export default { ...@@ -595,35 +595,38 @@ export default {
this.dateKey.staffCount = Date.now() this.dateKey.staffCount = Date.now()
}, },
handleBlur (e, i) { handleBlur (e, i) {
let { value } = e.detail let { value } = e.detail,
{ orderObj, userInfo } = this,
key = i.value
if (value) { if (value) {
let { orderObj, userInfo } = this let numbers = value.match(/\d+/g)
let key = i.value,
numbers = value.match(/\d+/g)
numbers = numbers ? numbers.join('') : '' numbers = numbers ? numbers.join('') : ''
if (numbers.length > 1) numbers = numbers.replace(/^0+/, '') if (numbers.length > 1) numbers = numbers.replace(/^0+/, '')
this.orderObj[key] = Math.min(Math.max(Number(numbers), 0), 100).toString() this.orderObj[key] = Math.min(Math.max(Number(numbers), 0), 100).toString()
this.dateKey[key] = Date.now() this.dateKey[key] = Date.now()
if ( } else {
this.isNotEmpty(orderObj.recordStaffCount) && this.orderObj[key] = ''
this.isNotEmpty(value) && this.dateKey[key] = Date.now()
orderObj.recordStaffCount != value && }
orderObj.lastStaffUuid && if (
userInfo.uuid != orderObj.lastStaffUuid this.isNotEmpty(orderObj.recordStaffCount) &&
) { this.isNotEmpty(value) &&
this.noticeObj = { orderObj.recordStaffCount != value &&
title: '重要提示', orderObj.lastStaffUuid &&
text: `今日驻店人数与 ${orderObj.lastStaffName} 提交不一致,再次确认!不一致提交日报时,今日驻店人数将被清空。`, userInfo.uuid != orderObj.lastStaffUuid
type: 'warning', ) {
buttons: [ this.noticeObj = {
{ title: '重要提示',
text: '确定', text: `今日驻店人数与 ${orderObj.lastStaffName} 提交不一致,再次确认!不一致提交日报时,今日驻店人数将被清空。`,
type: 'primary', type: 'warning',
} buttons: [
] {
} text: '确定',
this.$nextTick(() => this.$refs.reportNotice.open()) type: 'primary',
}
]
} }
this.$nextTick(() => this.$refs.reportNotice.open())
} }
}, },
isNotEmpty (value) { isNotEmpty (value) {
...@@ -635,15 +638,19 @@ export default { ...@@ -635,15 +638,19 @@ export default {
) )
}, },
handleCarInputBlur (e, i, item, index) { handleCarInputBlur (e, i, item, index) {
let { value } = e.detail let { value } = e.detail,
{ key, max } = i
if (value) { if (value) {
let { key, max } = i, let numbers = value.match(/\d+/g)
numbers = value.match(/\d+/g)
numbers = numbers ? numbers.join('') : '' numbers = numbers ? numbers.join('') : ''
if (numbers.length > 1) numbers = numbers.replace(/^0+/, '') if (numbers.length > 1) numbers = numbers.replace(/^0+/, '')
item[key] = Math.min(Math.max(Number(numbers), 0), max).toString() item[key] = Math.min(Math.max(Number(numbers), 0), max).toString()
this.dateKey[`${key}_${index}`] = Date.now() this.dateKey[`${key}_${index}`] = Date.now()
} else {
item[key] = ''
this.dateKey[`${key}_${index}`] = Date.now()
} }
console.log(item[key])
}, },
async submit () { async submit () {
uni.showLoading({ uni.showLoading({
...@@ -660,7 +667,7 @@ export default { ...@@ -660,7 +667,7 @@ export default {
orderObj.sceneType = 1 orderObj.sceneType = 1
orderObj.brandDataList = carBandList orderObj.brandDataList = carBandList
if (orderObj.pickerValue == 0) { if (orderObj.pickerValue == 0) {
if (orderObj.staffCount == null) throw { if (['', null].includes(orderObj.staffCount)) throw {
message: '今日驻店人数(按店)', message: '今日驻店人数(按店)',
refId: 'staffCount' refId: 'staffCount'
} }
......
...@@ -147,14 +147,14 @@ module.exports = { ...@@ -147,14 +147,14 @@ module.exports = {
background: '#EAF1FF' background: '#EAF1FF'
} }
}, },
// 0待补单;2提单成功;3提单失败 // 0待补单;2提单成功;3提单失败,4已退单
equityStatus: { equityStatus: {
0: { 2: {
text: '已完成', text: '已完成',
color: '#2cca74', color: '#2cca74',
background: '#eaf9f1' background: '#eaf9f1'
}, },
2: { 0: {
text: '待补录', text: '待补录',
color: '#F7A431', color: '#F7A431',
background: '#FFF5E6' background: '#FFF5E6'
...@@ -163,7 +163,8 @@ module.exports = { ...@@ -163,7 +163,8 @@ module.exports = {
text: '提单失败', text: '提单失败',
color: '#f24724', color: '#f24724',
background: '#fdece9' background: '#fdece9'
} },
4: { text: '已退单', color: '#999999', background: 'rgba(153, 153, 153, 0.1)' }
}, },
// 订单状态 1 待跟进, 2 不升级, 3 待支付,4 已支付,6 已评价 , 9 已撤销 // 订单状态 1 待跟进, 2 不升级, 3 待支付,4 已支付,6 已评价 , 9 已撤销
statusList: [ statusList: [
...@@ -211,7 +212,7 @@ module.exports = { ...@@ -211,7 +212,7 @@ module.exports = {
4: { text: '已支付', color: '#2CCA74', background: '#EAF9F1' }, 4: { text: '已支付', color: '#2CCA74', background: '#EAF9F1' },
5: { text: '已完成', color: '#F7A431', background: '#FFF5E6' }, 5: { text: '已完成', color: '#F7A431', background: '#FFF5E6' },
'-1': { text: '战败', color: '#F24724', background: '#FDECE9' }, '-1': { text: '战败', color: '#F24724', background: '#FDECE9' },
9: { text: '已撤销', color: '#999999', background: ' #9999991a;' }, 9: { text: '已撤销', color: '#999999', background: 'rgba(153, 153, 153, 0.1)' },
11: { text: '已失效', color: '#F7A431', background: '#FFF5E6' }, 11: { text: '已失效', color: '#F7A431', background: '#FFF5E6' },
6: { text: '已退款', color: '#F7A431', background: '#FFF5E6' } 6: { text: '已退款', color: '#F7A431', background: '#FFF5E6' }
} }
......
...@@ -508,7 +508,6 @@ export default { ...@@ -508,7 +508,6 @@ export default {
}, },
// 输入框失去焦点事件 // 输入框失去焦点事件
inputBlur (e, val) { inputBlur (e, val) {
console.log("SSSSSS");
console.log(e, val) console.log(e, val)
if (val.value == 'price') { if (val.value == 'price') {
this.orderObj[val.value] = parseFloat(this.orderObj[val.value]) > 2000000 ? 2000000 : this.orderObj[val.value] this.orderObj[val.value] = parseFloat(this.orderObj[val.value]) > 2000000 ? 2000000 : this.orderObj[val.value]
......
...@@ -680,35 +680,38 @@ export default { ...@@ -680,35 +680,38 @@ export default {
this.dateKey.staffCount = Date.now() this.dateKey.staffCount = Date.now()
}, },
handleBlur (e, i) { handleBlur (e, i) {
let { value } = e.detail let { value } = e.detail,
{ orderObj, userInfo } = this,
key = i.value
if (value) { if (value) {
let { orderObj, userInfo } = this let numbers = value.match(/\d+/g)
let key = i.value,
numbers = value.match(/\d+/g)
numbers = numbers ? numbers.join('') : '' numbers = numbers ? numbers.join('') : ''
if (numbers.length > 1) numbers = numbers.replace(/^0+/, '') if (numbers.length > 1) numbers = numbers.replace(/^0+/, '')
this.orderObj[key] = Math.min(Math.max(Number(numbers), 0), 100).toString() this.orderObj[key] = Math.min(Math.max(Number(numbers), 0), 100).toString()
this.dateKey[key] = Date.now() this.dateKey[key] = Date.now()
console.log(key) console.log(key)
if ( } else {
this.isNotEmpty(orderObj.recordStaffCount) && this.orderObj[key] = ''
orderObj.recordStaffCount != value && this.dateKey[key] = Date.now()
orderObj.lastStaffUuid && }
userInfo.uuid != orderObj.lastStaffUuid if (
) { this.isNotEmpty(orderObj.recordStaffCount) &&
this.noticeObj = { orderObj.recordStaffCount != value &&
title: '重要提示', orderObj.lastStaffUuid &&
text: `今日驻店人数与 ${orderObj.lastStaffName} 提交不一致,再次确认!不一致提交日报时,今日驻店人数将被清空。`, userInfo.uuid != orderObj.lastStaffUuid
type: 'warning', ) {
buttons: [ this.noticeObj = {
{ title: '重要提示',
text: '确定', text: `今日驻店人数与 ${orderObj.lastStaffName} 提交不一致,再次确认!不一致提交日报时,今日驻店人数将被清空。`,
type: 'primary', type: 'warning',
} buttons: [
] {
} text: '确定',
this.$nextTick(() => this.$refs.reportNotice.open()) type: 'primary',
}
]
} }
this.$nextTick(() => this.$refs.reportNotice.open())
} }
}, },
isNotEmpty (value) { isNotEmpty (value) {
...@@ -720,43 +723,45 @@ export default { ...@@ -720,43 +723,45 @@ export default {
) )
}, },
handleCarInputBlur (e, i, item, index) { handleCarInputBlur (e, i, item, index) {
const { orderObj, let { orderObj,
userInfo, userInfo,
carBandList carBandList
} = this } = this,
let { value } = e.detail { value } = e.detail,
{ key, max } = i
if (value) { if (value) {
let { key, max } = i, let numbers = value.match(/\d+/g)
numbers = value.match(/\d+/g)
numbers = numbers ? numbers.join('') : '' numbers = numbers ? numbers.join('') : ''
if (numbers.length > 1) numbers = numbers.replace(/^0+/, '') if (numbers.length > 1) numbers = numbers.replace(/^0+/, '')
item[key] = Math.min(Math.max(Number(numbers), 0), max).toString() item[key] = Math.min(Math.max(Number(numbers), 0), max).toString()
this.dateKey[`${key}_${index}`] = Date.now() this.dateKey[`${key}_${index}`] = Date.now()
if (['deliveryCount', 'notDeliveryCount'].includes(key) && orderObj.onBreak == 'N') { } else {
let checkName = `${key}Record`, item[key] = ''
checkValue = carBandList[index][checkName] this.dateKey[`${key}_${index}`] = Date.now()
if ( }
this.isNotEmpty(item[key]) && if (['deliveryCount', 'notDeliveryCount'].includes(key) && orderObj.onBreak == 'N') {
this.isNotEmpty(carBandList[index][checkName]) && let checkName = `${key}Record`,
checkValue != value && checkValue = carBandList[index][checkName]
orderObj.lastStaffUuid && if (
userInfo.uuid != orderObj.lastStaffUuid) { this.isNotEmpty(item[key]) &&
let context = i.label this.isNotEmpty(carBandList[index][checkName]) &&
this.noticeObj = { checkValue != value &&
title: '重要提示', orderObj.lastStaffUuid &&
text: `${context}与 ${orderObj.lastStaffName} 提交不一致,再次确认!不一致提交日报时,${context}将被清空。`, userInfo.uuid != orderObj.lastStaffUuid) {
type: 'warning', let context = i.label
buttons: [ this.noticeObj = {
{ title: '重要提示',
text: '确定', text: `${context}与 ${orderObj.lastStaffName} 提交不一致,再次确认!不一致提交日报时,${context}将被清空。`,
type: 'primary', type: 'warning',
} buttons: [
] {
} text: '确定',
this.$nextTick(() => this.$refs.reportNotice.open()) type: 'primary',
}
]
} }
this.$nextTick(() => this.$refs.reportNotice.open())
} }
console.log(key)
} }
}, },
async submit () { async submit () {
...@@ -770,7 +775,7 @@ export default { ...@@ -770,7 +775,7 @@ export default {
orderObj.sceneType = 0 orderObj.sceneType = 0
orderObj.brandDataList = carBandList orderObj.brandDataList = carBandList
if (orderObj.pickerValue == 0) { if (orderObj.pickerValue == 0) {
if (orderObj.staffCount == null) throw { if (['', null].includes(orderObj.staffCount)) throw {
message: '今日驻店人数(按店)', message: '今日驻店人数(按店)',
refId: 'staffCount' refId: 'staffCount'
} }
......
<template>
<view
class="upload-content"
:key="viewKey"
>
<view class="upload-box">
<view class="label">发票或收据</view>
<view class="upload-item">
<template v-if="imgObj.retrofitInvoice">
<image
class="img"
:src="imgObj.retrofitInvoice"
@click="previewMedia(imgObj.retrofitInvoice)"
/>
<view class="del flex">
<uni-icons
type="closeempty"
:size="10"
color="#fff"
@click="delImage('retrofitInvoice')"
></uni-icons>
</view>
</template>
<template v-else>
<view
class="upload-component"
@click="chooseImage('retrofitInvoice')"
>
<uni-icons
type="plusempty"
:size="22"
color="#347BFF"
class="icon"
></uni-icons>
<view class="text">上传照片</view>
</view>
</template>
</view>
</view>
<view class="upload-box">
<view class="label">加改装部位照片</view>
<view class="upload-item">
<template v-if="imgObj.retrofit">
<image
class="img"
:src="imgObj.retrofit"
@click="previewMedia(imgObj.retrofit)"
/>
<view class="del flex">
<uni-icons
type="closeempty"
:size="10"
color="#fff"
@click="delImage('retrofit')"
></uni-icons>
</view>
</template>
<template v-else>
<view
class="upload-component"
@click="chooseImage('retrofit')"
>
<uni-icons
type="plusempty"
:size="22"
color="#347BFF"
class="icon"
></uni-icons>
<view class="text">上传照片</view>
</view>
</template>
</view>
</view>
</view>
</template>
<script type='text/ecmascript-6'>
import { uploadFile } from '@/utils/ossUpload.js'
import permision from '@/js_sdk/wa-permission/permission.js'
export default {
name: 'EquityUpload',
props: {
externalData: null,
},
watch: {
externalData: {
handler (val) {
let { imgObj } = val
if (Object.keys(this.imgObj).length) return
this.imgObj = {
retrofitInvoice: imgObj.retrofitInvoice || '',
retrofit: imgObj.retrofit || ''
}
},
deep: true,
immediate: true
}
},
data () {
return {
viewKey: Date.now(),
imgObj: {}
}
},
mounted () {
},
methods: {
previewMedia (urls, index = 0) {
uni.previewImage({
current: index,
urls: Array.isArray(urls) ? urls : [urls],
})
},
delImage (key) {
this.imgObj[key] = ''
this.viewKey = Date.now()
},
async chooseImage (key) {
let _this = this
try {
// #ifdef APP-PLUS
const photoLibrary = await permision.requestAndroidPermission('android.permission.READ_EXTERNAL_STORAGE')
const camera = await permision.requestAndroidPermission('android.permission.CAMERA')
const isOnline = await uni.$isNetWork()
if (photoLibrary != 1) throw '您的设备不支持相册功能或未授权访问,请前往设置中开启相册权限'
if (camera != 1) throw '您的设备不支持摄像头功能或未授权访问,请前往设置中开启摄像头权限'
if (!isOnline) throw '当前无网络连接,请连接网络后重试'
// #endif
uni.chooseImage({
count: 1,
async success (res) {
uni.showLoading({ title: '上传中...', mask: true })
const url = await uploadFile(res.tempFiles[0], res.tempFilePaths[0])
_this.imgObj[key] = url
_this.viewKey = Date.now()
uni.hideLoading()
},
fail (err) {
uni.hideLoading()
if (err.errMsg.indexOf('cancel') === -1) {
return uni.showToast({
title: '图片上传失败',
icon: 'none'
})
}
},
})
} catch (error) {
uni.hideLoading()
return uni.showToast({
title: error,
icon: 'none'
})
}
},
}
}
</script>
<style scoped lang='scss'>
.upload-content {
padding: toRpx(32) toRpx(32) 0;
.upload-box {
display: flex;
margin-bottom: toRpx(32);
.label {
width: toRpx(168);
flex-shrink: 0;
margin-right: toRpx(32);
}
.value {
gap: toRpx(16);
flex-wrap: wrap;
}
.upload-item {
width: toRpx(192);
height: toRpx(192);
border-radius: toRpx(12);
background: #f5f8ff;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #999999;
font-size: toRpx(20);
position: relative;
.del {
position: absolute;
width: toRpx(32);
height: toRpx(32);
background: #00000080;
border-radius: 100%;
top: toRpx(8);
right: toRpx(4);
justify-content: center;
}
.upload-component {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.icon {
font-weight: 700;
margin-bottom: toRpx(22);
}
.img {
width: 100%;
height: 100%;
}
.text {
width: 80%;
text-align: center;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<view class="equity-tire">
<GlCell
:formList="[formList]"
:formData="tireObj"
@handleLabelTips="handleLabelTips"
>
<template #tireHtml>
<view class="tire-box">
<template v-for="(i,index) in tireList">
<view
class="tire-item"
:key="index"
>
<view class="label flex">
{{i.name}}
<template v-if="index == 0">
<view
class="tips"
@click="handleLabelTips(i)"
>位置示例</view>
</template>
</view>
<view class="content">
<GlCell
:formList="[i.list]"
:formData="tireObj"
:index="index"
:cellBoxStyle="cellBoxStyle"
/>
</view>
</view>
</template>
</view>
</template>
</GlCell>
</view>
</template>
<script type='text/ecmascript-6'>
import { TIRE_FORM_LIST, TIRE_LIST } from './contant'
import utils from '@/utils/utils'
import GlCell from '@/components/Form/GlCell.vue'
export default {
name: 'EquityTire',
props: {
externalData: null,
},
components: {
GlCell,
},
data () {
return {
formList: utils.deepClone(TIRE_FORM_LIST),
tireList: utils.deepClone(TIRE_LIST),
cellBoxStyle: 'background: #f5f7fa;',
tireObj: {}
}
},
watch: {
externalData: {
handler (val) {
const keyList = [
'tireBrand', 'tireScale',
'leftFrontDTO', 'leftFrontBatch',
'rightFrontDTO', 'rightFrontBatch',
'leftRearDTO', 'leftRearBatch',
'rightRearDTO', 'rightRearBatch'
]
keyList.map(key => {
this.tireObj[key] = val[key]
})
},
deep: true,
immediate: true
}
},
mounted () {
},
methods: {
handleLabelTips (item) {
let { tipsUrl } = item
uni.previewImage({
urls: [tipsUrl]
})
},
}
}
</script>
<style scoped lang='scss'>
.tire-box {
display: grid;
grid-template-columns: repeat(2, 1fr);
padding: 0 toRpx(32);
gap: toRpx(16) toRpx(32);
.tire-item {
.label {
height: toRpx(68);
color: #999999;
font-size: toRpx(26);
.tips {
color: #4673ff;
font-size: toRpx(24);
margin-left: toRpx(8);
}
}
.content {
border-radius: toRpx(16);
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<view
class="upload-content"
:key="viewKey"
>
<view class="upload-box">
<view class="label">购车发票</view>
<view class="upload-item">
<template v-if="imgObj.invoice">
<image
class="img"
:src="imgObj.invoice"
@click="previewMedia(imgObj.invoice)"
/>
<view class="del flex">
<uni-icons
type="closeempty"
:size="10"
color="#fff"
@click="delImage('invoice')"
></uni-icons>
</view>
</template>
<template v-else>
<view
class="upload-component"
@click="chooseImage('invoice')"
>
<uni-icons
type="plusempty"
:size="22"
color="#347BFF"
class="icon"
></uni-icons>
<view class="text">上传照片</view>
</view>
</template>
</view>
</view>
<view class="upload-box">
<view class="label">行驶证或车辆合格证</view>
<view class="value flex">
<view class="upload-item">
<template v-if="imgObj.driveFront">
<image
class="img"
:src="imgObj.driveFront"
@click="previewMedia(imgObj.driveFront)"
/>
<view class="del flex">
<uni-icons
type="closeempty"
:size="10"
color="#fff"
@click="delImage('driveFront')"
></uni-icons>
</view>
</template>
<template v-else>
<view
class="upload-component"
@click="chooseImage('driveFront')"
>
<uni-icons
type="plusempty"
:size="22"
color="#347BFF"
class="icon"
></uni-icons>
<view class="text">行驶证主页/车辆合格证</view>
</view>
</template>
</view>
<view class="upload-item">
<template v-if="imgObj.driveBack">
<image
class="img"
:src="imgObj.driveBack"
@click="previewMedia(imgObj.driveBack)"
/>
<view class="del flex">
<uni-icons
type="closeempty"
:size="10"
color="#fff"
@click="delImage('driveBack')"
></uni-icons>
</view>
</template>
<template v-else>
<view
class="upload-component"
@click="chooseImage('driveBack')"
>
<uni-icons
type="plusempty"
:size="22"
color="#347BFF"
class="icon"
></uni-icons>
<view class="text">行驶证副页/车辆合格证</view>
</view>
</template>
</view>
</view>
</view>
<view class="upload-box">
<view class="label">合同购买时里程数</view>
<view class="upload-item">
<template v-if="imgObj.contract">
<image
class="img"
:src="imgObj.contract"
@click="previewMedia(imgObj.contract)"
/>
<view class="del flex">
<uni-icons
type="closeempty"
:size="10"
color="#fff"
@click="delImage('contract')"
></uni-icons>
</view>
</template>
<template v-else>
<view
class="upload-component"
@click="chooseImage('contract')"
>
<uni-icons
type="plusempty"
:size="22"
color="#347BFF"
class="icon"
></uni-icons>
<view class="text">上传照片</view>
</view>
</template>
</view>
</view>
<view class="upload-box">
<view class="label">其他</view>
<view class="value flex">
<template v-if="imgObj.other.length < 9">
<view
class="upload-item"
@click="chooseImage('other',true)"
>
<uni-icons
type="plusempty"
:size="22"
color="#347BFF"
class="icon"
></uni-icons>
<view>上传照片最多9张</view>
</view>
</template>
<template v-if="imgObj.other.length">
<template v-for="(i,index) in imgObj.other">
<view
class="upload-item"
:key="index"
>
<image
class="img"
:src="i"
@click="previewMedia(imgObj.other,index)"
/>
<view class="del flex">
<uni-icons
type="closeempty"
:size="10"
color="#fff"
@click="delImage('other',index , true)"
></uni-icons>
</view>
</view>
</template>
</template>
</view>
</view>
</view>
</template>
<script type='text/ecmascript-6'>
import { uploadFile } from '@/utils/ossUpload.js'
import permision from '@/js_sdk/wa-permission/permission.js'
export default {
name: 'EquityUpload',
props: {
externalData: null,
},
watch: {
externalData: {
handler (val) {
let { imgObj } = val
if(Object.keys(this.imgObj).length) return
this.imgObj = {
invoice: imgObj.invoice || '',
driveFront: imgObj.driveFront || '',
driveBack: imgObj.driveBack || '',
contract: imgObj.contract || '',
other: imgObj.other || []
}
},
deep: true,
immediate: true
}
},
data () {
return {
viewKey: Date.now(),
imgObj: { }
}
},
mounted () {
},
methods: {
previewMedia (urls, index = 0) {
uni.previewImage({
current: index,
urls: Array.isArray(urls) ? urls : [urls],
})
},
delImage (key, index, isArray) {
if (isArray) this.imgObj[key].splice(index, 1)
else this.imgObj[key] = ''
this.viewKey = Date.now()
},
async chooseImage (key, isArray) {
let _this = this
try {
// #ifdef APP-PLUS
const photoLibrary = await permision.requestAndroidPermission('android.permission.READ_EXTERNAL_STORAGE')
const camera = await permision.requestAndroidPermission('android.permission.CAMERA')
const isOnline = await uni.$isNetWork()
if (photoLibrary != 1) throw '您的设备不支持相册功能或未授权访问,请前往设置中开启相册权限'
if (camera != 1) throw '您的设备不支持摄像头功能或未授权访问,请前往设置中开启摄像头权限'
if (!isOnline) throw '当前无网络连接,请连接网络后重试'
// #endif
uni.chooseImage({
count: 1,
async success (res) {
uni.showLoading({ title: '上传中...', mask: true })
const url = await uploadFile(res.tempFiles[0], res.tempFilePaths[0])
if (isArray) _this.imgObj[key].push(url)
else _this.imgObj[key] = url
_this.viewKey = Date.now()
uni.hideLoading()
},
fail (err) {
uni.hideLoading()
if (err.errMsg.indexOf('cancel') === -1) {
return uni.showToast({
title: '图片上传失败',
icon: 'none'
})
}
},
})
} catch (error) {
uni.hideLoading()
return uni.showToast({
title: error,
icon: 'none'
})
}
},
}
}
</script>
<style scoped lang='scss'>
.upload-content {
padding: 0 toRpx(32);
.upload-box {
display: flex;
margin-bottom: toRpx(32);
.label {
width: toRpx(168);
flex-shrink: 0;
margin-right: toRpx(32);
}
.value {
gap: toRpx(16);
flex-wrap: wrap;
}
.upload-item {
width: toRpx(192);
height: toRpx(192);
border-radius: toRpx(12);
background: #f5f8ff;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #999999;
font-size: toRpx(20);
position: relative;
.del {
position: absolute;
width: toRpx(32);
height: toRpx(32);
background: #00000080;
border-radius: 100%;
top: toRpx(8);
right: toRpx(4);
justify-content: center;
}
.upload-component {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.icon {
font-weight: 700;
margin-bottom: toRpx(22);
}
.img {
width: 100%;
height: 100%;
}
.text {
width: 80%;
text-align: center;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<uni-popup
ref="centerPopupRef"
type="center"
:is-mask-click="false"
animation
class="center-popup"
>
<view class="box">
<view class="title flex">
<view class="text">车架号复核</view>
<view
class="icon-close-box flex"
@click="close"
>
<uni-icons
class="icon-close"
type="closeempty"
:size="20"
color="#1A1A1A"
></uni-icons>
</view>
</view>
<view class="content flex">
<view class="tips">请核对车架号是否正确,如信息有误后期将无法申请补偿服务!</view>
<view class="input-box flex">
<view class="input">
<view class="label">车架号</view>
<input type="text" maxlength="17" v-model="obj.vin" />
</view>
<view class="edit"></view>
</view>
<view class="footer-box">
</view>
</view>
</view>
</uni-popup>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'CenterPopup',
props: {
list: Array,
title: String,
tag: String,
id: [Number, String],
isLine: Boolean
},
data () {
return {
}
},
mounted () {
},
methods: {
open () {
this.$refs.centerPopupRef.open();
},
close () {
this.$refs.centerPopupRef.close();
this.$emit('cancel')
},
choose: uni.$throttle(function (index) {
this.$emit('choose', index)
this.$refs.centerPopupRef.close();
}, 200)
}
}
</script>
<style scoped lang='scss'>
.center-popup {
z-index: 99 !important;
}
.box {
width: 848rpx;
height: 608rpx;
border-radius: 32rpx;
background: linear-gradient(180deg, #e6f0ff 0%, #ffffff 100%);
.title {
width: 100%;
height: toRpx(160);
// background: url('@/assets/images/boutique/customer-type-bg.webp') no-repeat;
background-size: 100% 100%;
position: relative;
.text {
font-weight: 500;
font-size: toRpx(40);
color: #1a1a1a;
position: absolute;
left: 64rpx;
top: 50%;
transform: translateY(-50%);
}
.icon-close-box {
height: 100%;
margin-left: auto;
padding: 0 toRpx(48);
font-weight: 700;
}
}
.content {
padding: 0 toRpx(64);
width: 100%;
.tips {
color: #666666;
font-size: 32rpx;
line-height: 48rpx;
}
.input-box {
margin: 48rpx 0 16rpx;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
import dayjs from "dayjs"
const energyProFormList = [
{
label: '服务年限',
value: 'servicePeriod',
type: 'input',
readonly: true,
suffix: '年',
},
{
label: '车辆登记日期',
value: 'vehicleRegistrationDate',
type: 'single-calendar',
endDate: dayjs().subtract(1, 'day').format('YYYY-MM-DD')
},
{
label: '车型排量',
value: 'vehicleDisplacement',
type: 'input',
suffix: 'L',
inputType: 'digit',
inputLimit: {
type: 'digit',
minVal: 0,
maxVal: 100
},
},
{
label: '原厂质保',
value: 'warranty',
cellHtml: 'warranty'
},
{
label: '合同购买时里程数',
value: 'mileage',
type: 'input',
suffix: 'KM',
inputType: 'digit',
inputLimit: {
type: 'digit',
minVal: 0
},
}
]
// 权益表单
const equityProFormList = [
{
label: '服务年限',
value: 'servicePeriod',
type: 'input',
readonly: true,
suffix: '年',
},
{
label: '无忧保障服务费',
value: 'actualSalesPrice',
placeholder: '非必填',
type: 'input',
inputType: 'digit',
inputLimit: {
type: 'digit',
maxVal: 100000,
minVal: 0
},
maxlength: '9',
},
{
label: '无忧卡卡号',
value: 'card',
type: 'input',
maxlength: '6',
noBorder: true,
noCellHeight: true,
isJudgeShow: true,
isShowObj: {
attr: 'entityCardFlag',
list: ['Y']
}
}
]
// 延保配置服务项目
const extendServiceFormList = [
{
label: '服务年限',
value: 'servicePeriod',
type: 'input',
readonly: true,
suffix: '年',
cellStyle: 'height: var(--fontSize90);'
},
{
value: 'displacementPower',
rowHtml: 'displacementPower',
hidden: true
},
{
label: '购车发票日期',
value: 'buyDate',
type: 'single-calendar',
endDate: dayjs().subtract(1, 'day').format('YYYY-MM-DD')
},
{
label: '原厂质保开始日期',
value: 'qualityBeginDate',
type: 'single-calendar',
},
{
label: '原厂质保年限',
value: 'warrantyPeriod',
type: 'input',
},
{
label: '原厂质保公里(万公里)',
value: 'warrantyKm',
type: 'input',
},
{
label: '合同购买时的公里数',
value: 'mileage',
type: 'input',
}
]
// 燃油车4大件
const oilProFormList = [
{
label: '服务年限',
value: 'servicePeriod',
type: 'input',
readonly: true,
suffix: '年',
},
{
label: '车辆登记日期',
value: 'vehicleRegistrationDate',
type: 'single-calendar',
endDate: dayjs().format('YYYY-MM-DD')
},
{
label: '车辆使用性质',
value: 'vehicleNatureName',
type: 'select',
key: 'vehicleNature'
},
{
label: '变速箱类型',
value: 'gearbox',
type: 'select',
key: 'gearbox'
},
{
label: '车型排量',
value: 'vehicleDisplacement',
type: 'input',
suffix: 'L',
inputLimit: {
type: 'digit',
minVal: 0,
maxVal: 100
},
},
{
label: '原厂质保',
value: 'warranty',
},
{
label: '合同购买时里程数',
value: 'mileage',
type: 'input',
suffix: 'KM',
inputLimit: {
type: 'digit',
minVal: 0
},
}
]
const displacementPowerSwitch = [
{
label: '排量',
value: 0
},
{
label: '功率',
value: 1
}
]
const TIRE_FORM_LIST = [
{
label: '轮胎品牌',
value: 'tireBrand',
maxlength: '20',
type: 'input',
},
{
label: '轮胎规格',
value: 'tireScale',
maxlength: '20',
type: 'input',
labelTips: '位置示例',
tipsUrl: 'https://img02.glsx.com.cn/weapp/resource/app-zyzs/equity/tire-tips-1.webp'
},
{
hidden: true,
rowHtml: 'tireHtml'
}
]
const TIRE_LIST = [
{
name: '左前胎',
tipsUrl: 'https://img02.glsx.com.cn/weapp/resource/app-zyzs/equity/tire-tips-2.webp',
list: [
{
label: '轮胎DOT号',
value: 'leftFrontDTO',
type: 'input',
maxlength: '20',
},
{
label: '轮胎生产批次',
value: 'leftFrontBatch',
type: 'input',
maxlength: '20',
}
]
},
{
name: '右前胎',
list: [
{
label: '轮胎DOT号',
value: 'rightFrontDTO',
type: 'input',
maxlength: '20',
},
{
label: '轮胎生产批次',
value: 'rightFrontBatch',
type: 'input',
maxlength: '20',
}
]
},
{
name: '左后胎',
list: [
{
label: '轮胎DOT号',
value: 'leftRearDTO',
type: 'input',
maxlength: '20',
},
{
label: '轮胎生产批次',
value: 'leftRearBatch',
type: 'input',
maxlength: '20',
}
]
},
{
name: '右后胎',
list: [
{
label: '轮胎DOT号',
value: 'rightRearDTO',
type: 'input',
maxlength: '20',
},
{
label: '轮胎生产批次',
value: 'rightRearBatch',
type: 'input',
maxlength: '20',
}
]
}
]
export {
energyProFormList,
equityProFormList,
extendServiceFormList,
oilProFormList,
displacementPowerSwitch,
TIRE_FORM_LIST,
TIRE_LIST
}
<template> <template>
<view class="order-management"> <view class="order-management">
<view class="search-box"> <view class="search-box">
<input class="search-input" placeholder-class="placeholder" v-model="customerName" confirm-type="search" @confirm="search" placeholder="输入客户姓名/商品名称/订单编号/手机号搜索" /> <input class="search-input" placeholder-class="placeholder" v-model="customerName" confirm-type="search" @confirm="search" placeholder="输入客户姓名搜索" />
<view class="clear flex" @click="clear"> <view class="clear flex" @click="clear">
<uni-icons type="closeempty" size="16" v-if="customerName"></uni-icons> <uni-icons type="closeempty" size="16" v-if="customerName"></uni-icons>
</view> </view>
...@@ -20,6 +20,15 @@ ...@@ -20,6 +20,15 @@
<view class="sprite-icon icon-filter"></view> <view class="sprite-icon icon-filter"></view>
</view> --> </view> -->
</view> </view>
<view class="px-48">
<view class="flex tips align-center justify-between" v-if="showTips">
<view class="flex align-center">
<view class="sprite-icon icon-equityTip"></view>
为保障客户权益,请尽快处理!
</view>
<view class="sprite-icon icon-equityClose" @click="showTips = false"></view>
</view>
</view>
<z-paging ref="paging" :fixed="false" paging-class="paging-class px-48" :loading-full-fixed="false" :auto-show-system-loading="true" :show-scrollbar="false" v-model="dataList" @query="queryList" :default-page-size="10"> <z-paging ref="paging" :fixed="false" paging-class="paging-class px-48" :loading-full-fixed="false" :auto-show-system-loading="true" :show-scrollbar="false" v-model="dataList" @query="queryList" :default-page-size="10">
<EquityCard v-for="(item, index) in dataList" :key="index" :orderCardDetail="item" @toggle-goods-list="handleToggleGoodsList" @jump="jump" @refresh="search()" @openPay="openPay"></EquityCard> <EquityCard v-for="(item, index) in dataList" :key="index" :orderCardDetail="item" @toggle-goods-list="handleToggleGoodsList" @jump="jump" @refresh="search()" @openPay="openPay"></EquityCard>
...@@ -87,8 +96,8 @@ export default { ...@@ -87,8 +96,8 @@ export default {
tabList: [ tabList: [
{ tabName: '全部', num: 0, value: null }, { tabName: '全部', num: 0, value: null },
{ tabName: '待补录', num: 0, value: 0 }, { tabName: '待补录', num: 0, value: 0 },
{ tabName: '提单失败', num: 0, value: 2 }, { tabName: '提单失败', num: 0, value: 3 },
{ tabName: '已完成', num: 0, value: 3 } { tabName: '已完成', num: 0, value: 2 }
], ],
tabIndex: 0, tabIndex: 0,
activeIndex: 0, activeIndex: 0,
...@@ -111,7 +120,8 @@ export default { ...@@ -111,7 +120,8 @@ export default {
abnormalPages: 1, abnormalPages: 1,
normalPages: 1, normalPages: 1,
checkListObj: {}, checkListObj: {},
localUserInfo: null localUserInfo: null,
showTips: true
} }
}, },
mounted() { mounted() {
...@@ -245,7 +255,7 @@ export default { ...@@ -245,7 +255,7 @@ export default {
pageNum: pageNo, pageNum: pageNo,
customerName: this.customerName, customerName: this.customerName,
merchantId: localUserInfo.shopMerchantId, merchantId: localUserInfo.shopMerchantId,
orderStatus: '' orderStatus: this.searchObj.orderStatus
} }
uni.$api.equityApi uni.$api.equityApi
...@@ -307,7 +317,7 @@ export default { ...@@ -307,7 +317,7 @@ export default {
.order-management { .order-management {
height: 100%; height: 100%;
.paging-class { .paging-class {
height: calc(100% - #{toRpx(288)}); height: calc(100% - #{toRpx(380)});
} }
.px-48 { .px-48 {
padding: 0 toRpx(48); padding: 0 toRpx(48);
...@@ -343,8 +353,8 @@ export default { ...@@ -343,8 +353,8 @@ export default {
.clear { .clear {
position: absolute; position: absolute;
right: toRpx(18); right: toRpx(18);
top: toRpx(10); top: toRpx(40);
height: 100%; height: toRpx(72);
padding: 0 48rpx; padding: 0 48rpx;
} }
...@@ -446,155 +456,6 @@ export default { ...@@ -446,155 +456,6 @@ export default {
} }
} }
.tips {
display: flex;
align-items: center;
justify-content: center;
font-size: toRpx(28);
width: 100%;
height: toRpx(76);
border-radius: 16px;
opacity: 1;
background: #fef5ea;
margin: toRpx(24) 0;
color: #ff9d0a;
&-text {
margin-top: toRpx(4);
}
.icon-study-tips {
margin-right: toRpx(8);
}
.waitinputorder-btn {
width: toRpx(136);
height: toRpx(50);
border-radius: toRpx(48);
opacity: 1;
background: #ffffff;
color: #4673ff;
font-size: toRpx(24);
font-weight: 500;
text-align: center;
line-height: toRpx(50);
}
}
.waitinputorderPopup .popup-content {
.waitinputorder-tab-container {
width: toRpx(488);
border-radius: toRpx(64);
opacity: 1;
background: #f5f7fa;
}
.waitinputorder-tab-buttons {
display: flex;
background-color: #f5f5f5;
border-radius: 24rpx;
overflow: hidden;
margin-bottom: 20rpx;
}
.waitinputorder-tab-button {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
font-size: toRpx(28);
font-weight: 500;
color: #333;
position: relative;
width: toRpx(236);
height: toRpx(56);
border-radius: toRpx(40);
&.active {
background-color: #000;
color: #fff;
}
.question-icon {
margin-left: 8rpx;
opacity: 0.6;
}
}
}
.order_no_box {
height: calc(67vh - #{toRpx(364)});
.order-gap {
display: grid;
grid-template-columns: 1fr 1fr;
gap: toRpx(36);
}
.order_no_item {
border-radius: toRpx(16);
opacity: 1;
border: toRpx(2) solid #dce0e6;
padding: toRpx(24) toRpx(32);
background: #f5f7fa;
position: relative;
.message {
.item {
margin-bottom: toRpx(12);
&:last-child {
margin-bottom: 0;
}
}
.label {
color: #999ea8;
font-size: toRpx(24);
font-weight: 400;
width: toRpx(120);
margin-right: toRpx(24);
}
.value {
color: #333333;
font-size: toRpx(24);
font-weight: 400;
}
}
.checked {
position: absolute;
top: 0;
right: 0;
}
}
.checkActive {
border: toRpx(2) solid #4673ff;
background: #4673ff1a;
}
.copy-btn {
display: flex;
align-items: center;
margin-left: auto;
color: #808291;
.copy {
margin-right: toRpx(8);
margin-left: toRpx(20);
}
}
.nothing {
width: 100%;
height: toRpx(228);
flex-direction: column;
margin-top: toRpx(76);
font-size: toRpx(24);
color: #999999;
box-sizing: border-box;
&.big-height {
height: toRpx(234);
}
.icon {
width: toRpx(288);
height: toRpx(144);
margin-bottom: toRpx(4);
}
}
}
.footer-box { .footer-box {
width: 100%; width: 100%;
height: toRpx(164); height: toRpx(164);
...@@ -619,39 +480,17 @@ export default { ...@@ -619,39 +480,17 @@ export default {
margin-left: toRpx(32); margin-left: toRpx(32);
} }
} }
} .tips {
::v-deep .waitinputorderPopup .uni-popup__wrapper { height: toRpx(72);
border-radius: toRpx(32) toRpx(32) 0 0; border-radius: toRpx(16);
opacity: 1; background: #e0e8ff;
width: 100%; color: #2c66f7;
height: 67vh; font-size: toRpx(28);
background-color: #fff !important; font-weight: 400;
.popup-top-box { padding: toRpx(0) toRpx(34);
padding: toRpx(32) toRpx(52); margin-bottom: toRpx(24);
} .icon-equityTip {
} margin-right: toRpx(14);
::v-deep .abnormalTipsPopup .uni-popup__wrapper {
border-radius: toRpx(32) toRpx(32) 0 0;
opacity: 1;
width: 100%;
height: 51vh;
background-color: #fff !important;
.ul {
height: 100%;
.title {
font-weight: 600;
font-size: toRpx(26);
color: #282829;
margin-bottom: toRpx(8);
}
.li {
font-size: toRpx(26);
color: #282829;
margin-bottom: toRpx(8);
}
.last {
margin-bottom: toRpx(32);
} }
} }
} }
......
...@@ -270,7 +270,8 @@ export default { ...@@ -270,7 +270,8 @@ export default {
.quotationPage(params) .quotationPage(params)
.then(result => { .then(result => {
console.log(result) console.log(result)
this.$refs.paging.complete(result.list) let tempList = this.dealListData(result.list || [])
this.$refs.paging.complete(tempList)
}) })
.catch(err => { .catch(err => {
this.$refs.paging.complete(false) this.$refs.paging.complete(false)
...@@ -316,6 +317,20 @@ export default { ...@@ -316,6 +317,20 @@ export default {
}, },
jumpSuccess(params) { jumpSuccess(params) {
this.$emit('jump', 'OrderDetail', params) this.$emit('jump', 'OrderDetail', params)
},
dealListData(arr) {
if (!arr) {
return arr
}
var attrList = ['equityPrice', 'quotedPrice', 'quotedPriceUpdate', 'refundAmount']
arr.forEach(item => {
attrList.forEach(k => {
if (item[k]) {
item[k] = (item[k] / 100).toFixed(2)
}
})
})
return arr
} }
} }
} }
...@@ -361,8 +376,8 @@ export default { ...@@ -361,8 +376,8 @@ export default {
.clear { .clear {
position: absolute; position: absolute;
right: toRpx(18); right: toRpx(18);
top: toRpx(10); top: toRpx(40);
height: 100%; height: toRpx(72);
padding: 0 48rpx; padding: 0 48rpx;
} }
......
<template>
<view class="previewList">
<view class="previewList-box">
<view class="common-title">合同列表</view>
<view class="box">
<scroll-view class="scroll-view" scroll-y="true">
<view class="box-content">
<view class="box-shell">
<view class="flex align-item cell-item justify-between" v-for="item in list" :key="item.contractNo">
<view>{{ item.goodName ? '合同:' + item.goodName : '合同' + item.label }}</view>
<view class="flex align-item">
<view class="sprite-icon icon-preview" @click.stop="handlePreviewContract(item)"></view>
<view class="sprite-icon icon-previewDownLoad ml-36" @click.stop="handlePreviewContract(item, 'download')"></view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
import utils from '@/utils/utils'
export default {
name: 'PreviewList',
props: {
transmissionOfData: {
type: Object,
default: () => null
}
},
data() {
return {
list: []
}
},
computed: {
userInfo() {
return uni.$storage.get('userInfo') || {}
}
},
mounted() {
this.initData()
},
methods: {
initData() {
console.log('initData', this.transmissionOfData)
this.list = this.transmissionOfData.paramsData
},
handleDownload(url) {
if (!url) {
uni.showToast({ title: '没有合同', icon: 'none' })
return
}
uni.downloadFile({
url: url,
success: res => {
if (res.statusCode === 200) {
uni.showToast({ title: '保存成功', icon: 'none' })
var filePath = res.tempFilePath
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function (res) {
console.log('打开文档成功')
}
})
}
}
})
},
handlePreviewContract(item, type) {
let params = {
contractNo: item.contractNo
}
uni.showLoading({
title: '加载中...',
mask: true
})
uni.$api.equityApi
.printContract(params)
.then(res => {
console.log(res)
uni.hideLoading()
const url = res.url || res
if (type == 'download') {
this.handleDownload(url)
} else {
const fileName = this.getFileNameFromUrl(res.url || res)
const type = 3
console.log(url, fileName, type)
// 跳转到预览页面
uni.navigateTo({
url: `/pages/common/filePreview?fileUrl=${encodeURIComponent(url)}&fileType=${type}&fileName=${encodeURIComponent(fileName)}`
})
}
})
.catch(err => {
uni.hideLoading()
})
},
// 从URL获取文件名
getFileNameFromUrl(url) {
return url.split('/').pop().split('?')[0] || '未知文件'
},
getFileTypeFromUrl(url) {
const ext = url.split('.').pop().toLowerCase()
return ext === 'pdf' ? 'pdf' : 'image'
}
}
}
</script>
<style scoped lang="scss">
.previewList {
height: 100%;
position: relative;
.previewList-box {
height: 100%;
position: relative;
}
.box {
height: calc(100% - #{toRpx(120)});
padding-bottom: toRpx(24);
.scroll-view {
height: 100%;
.box-content {
padding: 0 toRpx(48);
.box-shell {
width: 100%;
border-radius: toRpx(16);
background: #ffffff;
padding: toRpx(32);
margin-top: toRpx(16);
.cell-item {
padding: toRpx(28) 0;
border-bottom: toRpx(1) solid #f7f7f6;
}
}
}
}
}
.btns {
position: absolute;
width: 100%;
bottom: 0;
padding: 24rpx 128rpx;
gap: 32rpx;
.save {
background: #3b73ff1a;
color: #4673ff;
font-size: 28rpx;
font-weight: 500;
}
}
.btn {
display: flex;
align-items: center;
justify-content: center;
width: toRpx(1130);
height: toRpx(80);
color: #fff;
border-radius: toRpx(48);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
}
}
</style>
<template>
<view class="order">
<view :class="['order-box']">
<view class="common-title">客户签字</view>
<view class="box">
<scroll-view class="scroll-view" scroll-y="true">
<view class="box-content">
<view class="box-shell pt-32">
<view class="descTextTitle">尊敬的客户,您好!</view>
<view class="h3 descText">本人自愿在门店购买保险。门店已就新车投保项目及服务进行了说明,本人完全理解相关项目的服务流程及细则。</view>
</view>
<view class="box-shell">
<view class="tips descText">请在确认以上信息后,在下方的签字区内签字确认,感谢您的配合!</view>
<view class="title descTextTitle">签字处</view>
<view class="sign-box">
<l-signature disableScroll ref="signatureRef" :penColor="penColor" :penSize="penSize" :openSmooth="openSmooth" @touchstart="onSignatureTouch"></l-signature>
<view v-if="showPlaceHoder" class="placehoder">签字区</view>
<!-- <view @click="fullScreen" class="full_icon flex_scb sprite-icon icon-fullScreen">
</view> -->
<view @click.stop="onClick('clear')" class="delete_icon flex_scb sprite-icon icon-sign_del"></view>
</view>
</view>
</view>
</scroll-view>
<view class="btns flex">
<view class="btn save" @click="back">稍后处理</view>
<view @click="submit" class="btn">已完成</view>
</view>
</view>
</view>
<NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup>
</view>
</template>
<script>
import utils from '@/utils/utils'
import { UpdateOrderInfo, popupTypeEnum, payTypeList, titleList } from '../contant'
import NoticePopup from '@/components/NoticePopup.vue'
import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
import { interceptionMixin } from '@/mixin/index'
export default {
name: 'SignName',
mixins: [interceptionMixin],
components: {
NoticePopup
},
props: {
transmissionOfData: {
type: Object,
default: () => null
}
},
data() {
return {
showUpload: false,
showTips: true,
titleList,
formList: utils.deepClone(UpdateOrderInfo),
valueKey: '',
externalData: [],
popupType: 0,
baseConfigData: {},
landscape: false,
requiredList: [], // 录单设置的必填项
orderObj: {
owner: '',
phone: '',
salesType: '0',
carVin: '',
certificateNo: '',
notes: ''
},
title: 'Hello',
penColor: 'red',
penSize: 5,
url: '',
openSmooth: false,
showPlaceHoder: true
}
},
computed: {
userInfo() {
return uni.$storage.get('userInfo') || {}
}
},
watch: {
transmissionOfData: {
handler(newVal, oldVal) {
if (newVal) {
console.log(newVal, 'newVal')
} else {
console.log(oldVal, 'oldVal')
}
}
}
},
mounted() {
this.initData()
},
methods: {
initData() {
console.log('initData', this.transmissionOfData)
},
// 提交
async submit() {
if (await this.checkDailyReport()) return
this.$refs.signatureRef.canvasToTempFilePath({
success: async res => {
// 是否为空画板 无签名
console.log(res.isEmpty)
// 生成图片的临时路径
// H5 生成的是base64
uni.showLoading({
title: '上传中...',
mask: true
})
console.log(res, 'res')
let url = await uploadFile(res.tempFilePath)
uni.hideLoading()
let params = {
orderId: this.transmissionOfData.paramsData.orderId,
customerNameUrl: url
}
console.log(params, 'params')
uni.showLoading({
title: '提交中...',
mask: true
})
uni.$api.equityApi
.updateCustomerNameUrlAPI(params)
.then(result => {
uni.hideLoading()
console.log(result)
setTimeout(() => {
this.$emit('jump', 'EquityManagement', {})
}, 500)
})
.catch(err => {
uni.hideLoading()
})
},
fail: err => {
uni.hideLoading()
}
})
},
back() {
// 配置弹窗按钮
this.$refs.notice.buttonsList = [
{
text: '确认退出',
type: 'default',
callback: () => {
this.transmissionOfData = null
this.$refs.notice.close()
this.$emit('jump', 'EquityManagement', {})
}
},
{
text: '继续编辑',
type: 'primary',
callback: () => {
this.$refs.notice.close()
}
}
]
// 打开弹窗
this.$refs.notice.open()
},
onClick(type) {
if (type == 'openSmooth') {
this.openSmooth = !this.openSmooth
return
}
if (this.$refs.signatureRef) this.$refs.signatureRef[type]()
},
fullScreen() {
this.landscape = !this.landscape
},
onSignatureTouch(val) {
console.log(val, 'val')
// this.showPlaceHoder = val
// this.$refs.signatureRef.isEmpty
}
}
}
</script>
<style scoped lang="scss">
.order {
height: 100%;
position: relative;
&-box {
visibility: visible;
height: 100%;
}
.hide {
opacity: 0;
visibility: hidden;
}
.upload-box {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
}
.box {
height: calc(100% - #{toRpx(120)});
.scroll-view {
// height: calc(100% - #{toRpx(148)});
}
}
.box-content {
padding: 0 toRpx(48);
}
.box-shell {
width: 100%;
border-radius: toRpx(16);
background: #ffffff;
padding: toRpx(32);
margin-top: toRpx(16);
}
.btns {
position: absolute;
bottom: 0;
width: 100%;
left: 0;
padding: 24rpx 128rpx;
gap: 32rpx;
.save {
background: #3b73ff1a;
color: #4673ff;
font-size: 28rpx;
font-weight: 500;
}
}
.btn {
display: flex;
align-items: center;
justify-content: center;
width: toRpx(1130);
height: toRpx(80);
color: #fff;
border-radius: toRpx(48);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
}
.h3 {
text-indent: 2em;
}
.descTextTitle {
font-weight: 500;
font-size: toRpx(34);
color: #333333;
line-height: toRpx(48);
margin-bottom: toRpx(20);
}
.descText {
font-size: toRpx(28);
color: #333333;
}
.title {
margin-top: toRpx(32);
margin-bottom: toRpx(24);
}
.sign-box {
position: relative;
width: 100%;
height: toRpx(600);
border-radius: toRpx(12);
background: #f4f5f7;
// 全屏样式
&.landscape {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
border-radius: 0;
z-index: 999999;
background: #f4f5f7;
}
}
.full_icon {
position: absolute;
right: toRpx(26);
// top: var(--fontSize16);
top: toRpx(26);
z-index: 10000;
transition: all 0.3s ease;
}
.delete_icon {
position: absolute;
right: toRpx(26);
// top: var(--fontSize16);
bottom: toRpx(26);
z-index: 10000;
}
.placehoder {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-size: toRpx(32);
font-weight: 500;
color: #dfdfdf;
}
</style>
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
<upload-proof-of-payment @back="showUpload = false" @confirm="uploadConfirm" /> <upload-proof-of-payment @back="showUpload = false" @confirm="uploadConfirm" />
</view> </view>
</template> </template>
<!-- 支付弹框 -->
<OrderPay ref="OrderPay" @jumpSuccess="jumpSuccess" />
<NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup> <NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup>
</view> </view>
</template> </template>
...@@ -40,20 +38,15 @@ import utils from '@/utils/utils' ...@@ -40,20 +38,15 @@ import utils from '@/utils/utils'
import GlCell from '../../../../components/Form/GlCell.vue' import GlCell from '../../../../components/Form/GlCell.vue'
import { UpdateOrderInfo, popupTypeEnum, payTypeList, titleList } from '../contant' import { UpdateOrderInfo, popupTypeEnum, payTypeList, titleList } from '../contant'
import { interceptionMixin } from '@/mixin/index' import { interceptionMixin } from '@/mixin/index'
import UploadProofOfPayment from './UploadProofOfPayment.vue'
import NoticePopup from '@/components/NoticePopup.vue' import NoticePopup from '@/components/NoticePopup.vue'
import dayjs from 'dayjs' import { validateVin, formatVinInput } from '@/utils/vinVaildate'
import OrderPay from './OrderPay.vue'
import NP from 'number-precision'
export default { export default {
name: 'CreateOrder', name: 'CreateOrder',
mixins: [interceptionMixin], mixins: [interceptionMixin],
components: { components: {
GlCell, GlCell,
// OrderPopup, // OrderPopup,
UploadProofOfPayment, // UploadProofOfPayment,
OrderPay,
NoticePopup NoticePopup
}, },
props: { props: {
...@@ -72,7 +65,8 @@ export default { ...@@ -72,7 +65,8 @@ export default {
externalData: [], externalData: [],
popupType: 0, popupType: 0,
baseConfigData: {}, baseConfigData: {},
requiredList: [], // 录单设置的必填项 requiredList: [],
validateState: true, // 录单设置的必填项
orderObj: { orderObj: {
owner: '', owner: '',
phone: '', phone: '',
...@@ -130,8 +124,19 @@ export default { ...@@ -130,8 +124,19 @@ export default {
}, },
// 输入框失去焦点事件 // 输入框失去焦点事件
inputBlur(e, val) { inputBlur(e, val) {
console.log(e, val) console.log(e, val, val.value === 'carVin')
this.orderObj[val.value] = this.orderObj[val.value] if (val.value === 'carVin') {
validateVin(this.orderObj.carVin).then(result => {
console.log('validateVin', result)
let { valid } = result.data
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
this.orderObj.carVin = formatVinInput(this.orderObj.carVin)
})
} else {
this.orderObj[val.value] = this.orderObj[val.value]
}
}, },
// 校验必填等规则 // 校验必填等规则
checkRequired() { checkRequired() {
...@@ -158,10 +163,10 @@ export default { ...@@ -158,10 +163,10 @@ export default {
// 如果是customerPhone,添加phoneRex校验 // 如果是customerPhone,添加phoneRex校验
if (item.value === 'phone' && !phoneRex.test(value)) throw `请输入正确的${item.label}` if (item.value === 'phone' && !phoneRex.test(value)) throw `请输入正确的${item.label}`
} }
if (orderObj.carVin) { // if (orderObj.carVin) {
const vinRex = /^(?=.*[A-Za-z])[A-Za-z0-9]{17}$/ // const vinRex = /^(?=.*[A-Za-z])[A-Za-z0-9]{17}$/
if (!vinRex.test(orderObj.carVin)) throw '请输入正确的车架号' // if (!vinRex.test(orderObj.carVin)) throw '请输入正确的车架号'
} // }
if (orderObj.certificateNo && orderObj.certificateNo.length != 18) throw '请输入正确的18位证件号' if (orderObj.certificateNo && orderObj.certificateNo.length != 18) throw '请输入正确的18位证件号'
return true return true
} catch (error) { } catch (error) {
...@@ -176,6 +181,18 @@ export default { ...@@ -176,6 +181,18 @@ export default {
// 提交 // 提交
async submit() { async submit() {
if (!this.checkRequired() || (await this.checkDailyReport())) return if (!this.checkRequired() || (await this.checkDailyReport())) return
if (this.orderObj.carVin) {
// 前置判断
if (this.orderObj.carVin.length !== 17) {
uni.showToast({ title: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)', icon: 'none' })
return false
}
// 根据接口校验结果判断
if (this.orderObj.carVin.length === 17 && !this.validateState) {
uni.showToast({ title: '车架号校验不匹配,请核对后重新输入', icon: 'none' })
return false
}
}
let params = { let params = {
id: this.orderObj.id, id: this.orderObj.id,
notes: this.orderObj.notes || '', notes: this.orderObj.notes || '',
......
...@@ -49,6 +49,8 @@ import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup. ...@@ -49,6 +49,8 @@ import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.
import EquityManagement from './components/EquityManagement.vue' import EquityManagement from './components/EquityManagement.vue'
import CreateEquity from './components/CreateEquity.vue' import CreateEquity from './components/CreateEquity.vue'
import SignName from './components/SignName.vue'
import PreviewList from './components/PreviewList.vue'
export default { export default {
mixins: [interceptionMixin], mixins: [interceptionMixin],
...@@ -65,7 +67,9 @@ export default { ...@@ -65,7 +67,9 @@ export default {
StudyPopup, StudyPopup,
StudyCenterPermissionPopup, StudyCenterPermissionPopup,
EquityManagement, EquityManagement,
CreateEquity CreateEquity,
SignName,
PreviewList
}, },
data() { data() {
return { return {
......
## 1.5.7(2025-11-24)
- fix: 修复uniappx 安卓打包报错问题
## 1.5.5(2025-09-18)
- fix: 修复uniappx 微信小程序 横屏时报错
## 1.5.4(2025-09-18)
- fix: 修复uniappx 微信小程序 删除离屏canvas报错
## 1.5.3(2025-08-31)
- feat: 兼容uniappx鸿蒙next
## 1.5.2(2025-04-01)
- fix: 修复`钉钉小程序`无法生成图片的问题
## 1.5.1(2025-03-28)
- fix: uniapp app 缺少,导致报错
## 1.5.0(2025-03-28)
- fix: uniappx 微信小程序的`landscape`报错
## 1.4.9(2025-03-27)
- fix: uniapp 缺少,导致报错
## 1.4.8(2025-03-26)
- fix: uniappx app `change`事件不生效的问题
## 1.4.7(2025-03-25)
- feat: 增加`change`事件
## 1.4.6(2024-07-18)
- chore: 更新文档
## 1.4.5(2024-07-17)
- chore: 删除多余console
## 1.4.4(2024-07-15)
- fix: 修复`钉钉小程序`无法生成图片的问题
## 1.4.3(2024-07-15)
- fix: 修复`钉钉小程序`无法使用的问题
## 1.4.2(2024-07-04)
- fix: 修复`vue2`因类型问题无法使用
## 1.4.1(2024-07-04)
- fix: 修复`uvue`因类型问题无法使用
## 1.4.0(2024-05-21)
- fix: 修复`nvue`因重复`width`和`height`重复导致无法使用
## 1.3.9(2024-04-11)
- feat: 增加`preferToDataURL`porps,是否优先使用`toDataURL`生成图片,在支持`toDataURL`的环境优先使用,会生成base64的图片
## 1.3.8(2024-04-10)
- fix: 修复因兼容抖音导致微信小程序图片不完整
## 1.3.7(2024-04-10)
- fix: 修复uniapp x(web)无法生图的问题
- feat: 支持uniapp x(web on pc)
## 1.3.6(2024-04-09)
- fix: 修复抖音小程序无法生成图片
## 1.3.5(2024-04-01)
- feat: 支持uniapp x ios(app-js)
## 1.3.4(2024-03-11)
- feat: app-vue,app-nvue支持生成图片时传`destWidth`,`destHeight`
## 1.3.3(2024-03-07)
- fix: 修复因小数导致mask无法生成
## 1.3.2(2024-03-06)
- fix: 修复app-vue多重复命名变量导致无法使用
## 1.3.1(2024-03-04)
- fix: 缺少this导致云打包失败
## 1.3.0(2024-02-28)
- feat: 支持uniapp x web
## 1.2.9(2024-02-21)
- fix: 修复微信小程序IOS会断断续续的问题
## 1.2.8(2023-12-21)
- fix: 修复redo函数漏了`,`
## 1.2.7(2023-12-19)
- fix: 修复因非uniapp x默认引入了uts文件,导入无法运行
## 1.2.6(2023-12-18)
- feat: 增加支持uniapp x
## 1.2.5(2023-10-11)
- fix: 修复PC浏览不生效的问题
## 1.2.4(2023-08-28)
- feat: 增加 `disabled`
## 1.2.3(2023-08-26)
- fix: 修复app-nvue 无法生成图片
## 1.2.2(2023-08-24)
- fix: 修复app端获取`boundingBox`尺寸异常
## 1.2.1(2023-08-23)
- fix: 修复因画板尺寸有小数导致`boundingBox`失效
## 1.2.0(2023-08-22)
- fix: vue3 app 无法在第一时间获取到 `getSystemInfoSync` 函数,故在生命周期里获取
## 1.1.9(2023-08-18)
- fix: 排除`backgroundColor`为`transparent`的参数,因为会导致生成空白图片
## 1.1.8(2023-08-16)
- chore: 去掉多余的console.log
## 1.1.7(2023-08-09)
- fix: 修复 支付宝无法生成的问题
## 1.1.6(2023-08-03)
- fix: 多了个 return
## 1.1.5(2023-07-27)
- fix: 修复 微信小程序PC端无法绘制问题
## 1.1.4(2023-07-21)
- fix: 修复 APP 报 `requestAnimationFrame` 的问题
## 1.1.3(2023-07-20)
- fix: 修复 性能较一般的手机 手写会卡顿的问题
## 1.1.2(2023-07-18)
- fix: 修复 非 canvas 2d 微信小程序 无法生成图片
## 1.1.1(2023-07-04)
- feat: 增加 `boundingBox` 属性,只生成有笔画的内容区域,从而缩小图片的尺寸节省空间
## 1.1.0(2023-06-20)
- feat: 增加 `canvasToTempFilePath` 质量参数
## 1.0.9(2023-06-13)
- fix: 修复大屏设备上,画板会被离屏canvas挡住的情况
## 1.0.8(2023-06-12)
- fix: 修复vue2 rendrejs 导入问题
## 1.0.7(2023-06-09)
- fix: 修复vue3 rendrejs 找到不节点问题
## 1.0.6(2023-05-23)
- chore: stylus 改为 scss
## 1.0.5(2023-05-16)
- fix: 修复转临时路径出错
## 1.0.4(2023-04-17)
- chore: 删除多余字符
## 1.0.3(2023-04-15)
- BUG: QQ小程序可以使用,会有报错但不影响使用
## 1.0.2(2023-04-15)
- feat: 支持横屏
- BUG: QQ小程序无法使用,为UNI官方问题,插件所需要的API传this都会报错。
## 1.0.1(2023-04-03)
- fix: 销毁时报错
## 1.0.0(2022-10-27)
- feat: 增加背景色
- feat: 修复 app canvasToTempFilePath 无操作只能执行一次的问题
## 0.8.0(2022-08-22)
- feat: 增加beforeDelay 延时初始化,可用于手写板在弹窗里时
## 0.7.0(2022-08-16)
- fix: 修复缺少 canvasWidth
## 0.6.0(2022-07-16)
- fix: 修复 success is no defined
## 0.5.0(2022-07-09)
- feat: canvasToTempFilePath success 增加返回 isEmpty
- fix: 修复 微信小程序 canvasToTempFilePath 无效问题
## 0.4.0(2022-07-04)
- fix: 生成图片缺少最后一笔
## 0.3.0(2022-05-24)
- chore: 支持多端 H5 小程序 APP APP-NVUE
## 0.2.0(2021-07-09)
- chore: 统一命名规范,无须主动引入组件
- fix: 修复错位问题
## 0.1.0(2021-03-07)
- 首次上传
- 撤消、清空、保存、模拟压感等功能
const uniPlatform = uni.getSystemInfoSync().uniPlatform
export const uniContext = (canvasId, context) => {
let ctx = uni.createCanvasContext(canvasId, context)
if (!ctx.uniDrawImage) {
ctx.uniDrawImage = ctx.drawImage
ctx.drawImage = (image, ...agrs) => {
ctx.uniDrawImage(image.src, ...agrs)
}
}
if (!ctx.getImageData) {
ctx.getImageData = (x, y, width, height) => {
return new Promise((resolve, reject) => {
// #ifdef MP || VUE2
if (context.proxy) context = context.proxy
// #endif
uni.canvasGetImageData({
canvasId,
x,
y,
width:parseInt(width),
height:parseInt(height),
success(res) {
resolve(res)
},
fail(error) {
reject(error)
}
}, context)
})
}
} else {
ctx._getImageData = ctx.getImageData
ctx.getImageData = (x, y, width, height) => {
return new Promise((resolve, reject) => {
ctx._getImageData({
x,
y,
width: parseInt(width) ,
height:parseInt(height),
success(res) {
resolve(res)
},
fail(error) {
reject(error)
}
})
})
}
}
return ctx
}
class Image {
constructor() {
this.currentSrc = null
this.naturalHeight = 0
this.naturalWidth = 0
this.width = 0
this.height = 0
this.tagName = 'IMG'
}
onerror() {}
onload() {}
set src(src) {
this.currentSrc = src
uni.getImageInfo({
src,
success: (res) => {
this.naturalWidth = this.width = res.width
this.naturalHeight = this.height = res.height
this.onload()
},
fail: () => {
this.onerror()
}
})
}
get src() {
return this.currentSrc
}
}
export const createImage = () => {
return new Image()
}
export function useCurrentPage() {
const pages = getCurrentPages();
return pages[pages.length - 1];
}
export const toDataURL = (canvasId, context, options = {}) => {
// #ifdef MP-QQ
// context = context.$scope
// #endif
// #ifdef MP-ALIPAY
context = ''
// #endif
return new Promise((resolve, reject) => {
let {
canvas,
width,
height,
destWidth = 0,
destHeight = 0,
x = 0,
y = 0,
preferToDataURL
} = options
const {
pixelRatio
} = uni.getSystemInfoSync()
// #ifdef MP-ALIPAY
const isDD = typeof dd != 'undefined'
if (!isDD && (!destWidth || !destHeight)) {
destWidth = width * pixelRatio;
destHeight = height * pixelRatio;
width = destWidth;
height = destHeight;
x = x * pixelRatio
y = y * pixelRatio
}
// #endif
const params = {
...options,
canvasId,
id: canvasId,
// #ifdef MP-ALIPAY
x,
y,
width,
height,
destWidth,
destHeight,
// #endif
canvas,
success: (res) => {
// 钉钉小程序 不存在tempFilePath
resolve(res.tempFilePath || res.filePath)
},
fail: (err) => {
reject(err)
}
}
// 抖音小程序canvas 2d不支持canvasToTempFilePath
if (canvas && canvas.toDataURL && preferToDataURL) {
let next = true
const devtools = uni.getSystemInfoSync().platform == 'devtools'
// #ifdef MP-TOUTIAO
next = uni.getSystemInfoSync().platform != 'devtools'
if (!next) {
console.warn('[lime-signature] 抖音开发工具不支持bbox')
}
// #endif
if ((x || y) && next) {
const offCanvas = uni.createOffscreenCanvas({
type: '2d'
});
const ctx = offCanvas.getContext("2d");
const destWidth = Math.floor(width * pixelRatio)
const destHeight = Math.floor(height * pixelRatio)
offCanvas.width = destWidth // canvas.width;
offCanvas.height = destHeight // canvas.height;
// ctx.scale(pixelRatio, pixelRatio)
// ctx.drawImage(canvas, Math.floor(x*pixelRatio), Math.floor(y*pixelRatio), destWidth, destHeight, 0,0, destWidth, destHeight);
// 抖音不能在drawImage使用canvas
const image = canvas.createImage()
image.onload = () => {
ctx.drawImage(image, Math.floor(x * pixelRatio), Math.floor(y * pixelRatio),
destWidth, destHeight, 0, 0, destWidth, destHeight)
const tempFilePath = offCanvas.toDataURL();
resolve(tempFilePath)
if (params.success) {
params.success({
tempFilePath
})
}
}
image.src = canvas.toDataURL()
} else {
const tempFilePath = canvas.toDataURL()
resolve(tempFilePath)
if (params.success) {
params.success({
tempFilePath
})
}
}
} else if (canvas && canvas.toTempFilePath) {
canvas.toTempFilePath(params)
} else {
uni.canvasToTempFilePath(params, context)
}
})
}
\ No newline at end of file \ No newline at end of file
export default {
styles: String,
disableScroll: {
type: Boolean,
default: true
},
type: {
type: String,
default: '2d'
},
// 画笔颜色
penColor: {
type: String,
default: 'black'
},
penSize: {
type: Number,
default: 2
},
// 画板背景颜色
backgroundColor: String,
backgroundImage: String,
// 笔锋
openSmooth: Boolean,
// 画笔最小值
minLineWidth: {
type: Number,
default: 2
},
// 画笔最大值
maxLineWidth: {
type: Number,
default: 6
},
// 画笔达到最小宽度所需最小速度(px/ms),取值范围1.0-10.0,值越小,画笔越容易变细,笔锋效果会比较明显,可以自行调整查看效果,选出自己满意的值。
minSpeed: {
type: Number,
default: 1.5
},
// 相邻两线宽度增(减)量最大百分比,取值范围1-100,为了达到笔锋效果,画笔宽度会随画笔速度而改变,如果相邻两线宽度差太大,过渡效果就会很突兀,使用maxWidthDiffRate限制宽度差,让过渡效果更自然。可以自行调整查看效果,选出自己满意的值。
maxWidthDiffRate: {
type: Number,
default: 20
},
// 限制历史记录数,即最大可撤销数,传入0则关闭历史记录功能
maxHistoryLength: {
type: Number,
default: 20
},
beforeDelay: {
type: Number,
default: 0
},
landscape: {
type: Boolean
},
boundingBox: {
type: Boolean
},
disabled: {
type: Boolean
},
preferToDataURL: Boolean,
pixelRatio: Number
}
\ No newline at end of file \ No newline at end of file
// #ifdef APP-VUE
// import { Signature } from '@signature'
import {
Signature
} from './signature.js'
import {
isTransparent
} from './utils'
export default {
data() {
return {
canvasid: null,
signature: null,
observer: null,
options: {},
saveCount: 0,
}
},
mounted() {
this.$nextTick(this.init)
},
methods: {
checkAndEmitEmptyStatus() {
setTimeout(()=>{
if (this.signature) {
const isEmpty = this.signature.isEmpty()
this.emit({
isEmpty
})
}
},0)
},
init() {
const el = this.$refs.limeSignature || this.$ownerInstance.$el;
this.canvas = document.createElement('canvas')
this.canvas.style = 'width: 100%; height: 100%;'
el.appendChild(this.canvas)
this.signature = new Signature({
el: this.canvas
})
this.signature.pen.setOption(this.options)
const width = this.signature.canvas.get('width')
const height = this.signature.canvas.get('height')
this.canvas?.addEventListener('touchend', this.checkAndEmitEmptyStatus.bind(this))
this.emit({
changeSize: {
width,
height
}
})
},
redo(v) {
if (v && this.signature) {
this.signature.redo()
this.checkAndEmitEmptyStatus()
}
},
undo(v) {
if (v && this.signature) {
this.signature.undo()
this.checkAndEmitEmptyStatus()
}
},
clear(v) {
if (v && this.signature) {
this.signature.clear()
this.checkAndEmitEmptyStatus()
}
},
destroy() {
if (this.canvas) {
this.canvas?.removeEventListener('touchend', this.checkAndEmitEmptyStatus.bind(this))
this.canvas.remove()
}
},
mask(param={}) {
if (this.signature) {
let {destWidth=0, destHeight=0} = JSON.parse(param)
let canvas = document.createElement('canvas')
const ctx = canvas.getContext('2d');
const pixelRatio = this.signature.canvas.get('pixelRatio')
let width = this.signature.canvas.get('width')
let height = this.signature.canvas.get('height')
let context = this.signature.canvas.get('context')
canvas.width = width * pixelRatio
canvas.height = height * pixelRatio
const imageData = context.getImageData(0, 0, width * pixelRatio, height * pixelRatio);
for (let i = 0; i < imageData.data.length; i += 4) {
// 判断当前像素是否透明
const isTransparent = imageData.data[i + 3] === 0;
if (isTransparent) {
// 将透明像素设置为黑色背景
imageData.data[i] = 0;
imageData.data[i + 1] = 0;
imageData.data[i + 2] = 0;
} else {
// 将非透明像素设置为白色内容
imageData.data[i] = 255;
imageData.data[i + 1] = 255;
imageData.data[i + 2] = 255;
}
}
ctx.putImageData(imageData, 0, 0);
if(destWidth&&destHeight){
const _canvas = document.createElement('canvas')
_canvas.width = destWidth
_canvas.height = destHeight
const _context = _canvas.getContext('2d')
_context.drawImage(canvas, 0, 0, destWidth, destHeight)
canvas.remove()
canvas = _canvas
}
this.emit({
save: canvas.toDataURL()
})
canvas.remove()
}
},
save(param) {
let {
fileType = 'png',
quality = 1,
n,
destWidth = 0,
destHeight = 0,
} = JSON.parse(param)
const type = `image/${fileType}`.replace(/jpg/, 'jpeg');
if (n !== this.saveCount) {
this.saveCount = n;
const {
backgroundColor,
backgroundImage,
landscape,
boundingBox
} = this.options
const flag = landscape || backgroundColor || boundingBox||destWidth&&destHeight
const image = this.signature.canvas.get('el').toDataURL(!flag && type, !flag && quality)
if (flag) {
let canvas = document.createElement('canvas')
const pixelRatio = this.signature.canvas.get('pixelRatio')
let width = this.signature.canvas.get('width')
let height = this.signature.canvas.get('height')
let x = 0
let y = 0
const next = () => {
const size = [width, height]
if (landscape) {
size.reverse()
}
canvas.width = size[0] * pixelRatio
canvas.height = size[1] * pixelRatio
const param = [x, y, width, height, 0, 0, width, height].map(item => item * pixelRatio)
const context = canvas.getContext('2d')
if (landscape) {
context.translate(0, width * pixelRatio)
context.rotate(-Math.PI / 2)
}
if (backgroundColor && !isTransparent(backgroundColor)) {
context.fillStyle = backgroundColor
context.fillRect(0, 0, width * pixelRatio, height * pixelRatio)
}
const drawImage = () => {
// param
context.drawImage(this.signature.canvas.get('el'), ...param)
if(destWidth&&destHeight){
const _canvas = document.createElement('canvas')
_canvas.width = destWidth
_canvas.height = destHeight
const _context = _canvas.getContext('2d')
_context.drawImage(canvas, 0, 0, destWidth, destHeight)
canvas.remove()
canvas = _canvas
}
this.emit({
save: canvas.toDataURL(type, quality)
})
canvas.remove()
}
if (backgroundImage) {
const img = new Image();
img.onload = () => {
context.drawImage(img, ...param)
drawImage()
}
img.src = backgroundImage
}
if (!backgroundImage) {
drawImage()
}
}
if (boundingBox) {
const res = this.signature.getContentBoundingBox()
width = res.width
height = res.height
x = res.startX
y = res.startY
next()
} else {
next()
}
} else {
this.emit({
save: image
})
}
}
},
isEmpty(v) {
if (v && this.signature) {
const isEmpty = this.signature.isEmpty()
this.emit({
isEmpty
})
}
},
emit(event) {
this.$ownerInstance.callMethod('onMessage', {
detail: {
data: [{
event
}]
}
})
},
update(v) {
if (v) {
if (this.signature) {
this.options = v
this.signature.pen.setOption(v)
} else {
this.options = v
}
}
}
}
}
// #endif
\ No newline at end of file \ No newline at end of file
// @ts-nocheck
import { LimeSignatureOptions, LimeSignaturePoint, LimeSignatureLine } from '../../index.uts'
let points : LimeSignatureLine = []
let undoStack : LimeSignatureLine[] = [];
let redoStack : LimeSignatureLine[] = [];
let lastX = 0;
let lastY = 0;
// #ifdef APP-ANDROID || APP-IOS
type SignatureUniElement = UniElement
type SignatureCanvasContext = DrawableContext
// #endif
// #ifdef APP-HARMONY
type SignatureUniElement = UniCanvasElement
type SignatureCanvasContext = CanvasRenderingContext2D
// #endif
export class Signature {
el : SignatureUniElement
ctx : SignatureCanvasContext
options : LimeSignatureOptions = {
penColor: 'black',
openSmooth: true,
disableScroll: true,
disabled: false,
penSize: 2,
minLineWidth: 2,
maxLineWidth: 6,
minSpeed: 1.5,
maxWidthDiffRate: 20,
maxHistoryLength: 20
} as LimeSignatureOptions
isEmpty : boolean = true
isDrawing : boolean = false
// historyList : LimeSignaturePoint[][] = []
// id : string
// instance : ComponentPublicInstance
touchstartCallbackWrapper: UniCallbackWrapper|null = null
touchmoveCallbackWrapper: UniCallbackWrapper|null= null
touchendCallbackWrapper: UniCallbackWrapper|null= null
change: ((isEmpty: boolean) => void)|null = null
constructor(el : SignatureUniElement) {
this.el = el
// #ifdef APP-ANDROID || APP-IOS
this.ctx = el.getDrawableContext() as DrawableContext
// #endif
// #ifdef APP-HARMONY
const dpr = uni.getDeviceInfo().devicePixelRatio ?? 1;
el.width = el.offsetWidth * dpr;
el.height = el.offsetHeight * dpr;
this.ctx = el.getContext('2d')
this.ctx.scale(dpr, dpr); // 仅需调用一次,当调用 reset 方法后需要再次 scale
// #endif
this.init()
}
onChange(cb: (isEmpty: boolean) => void){
this.change = cb
}
init() {
this.touchstartCallbackWrapper = this.el.addEventListener('touchstart', this.onTouchStart)
this.touchmoveCallbackWrapper = this.el.addEventListener('touchmove', this.onTouchMove)
this.touchendCallbackWrapper = this.el.addEventListener('touchend', this.onTouchEnd)
}
remove() {
if(this.touchstartCallbackWrapper == null) return
this.el.removeEventListener('touchstart', this.touchstartCallbackWrapper!)
this.el.removeEventListener('touchmove', this.touchmoveCallbackWrapper!)
this.el.removeEventListener('touchend', this.touchendCallbackWrapper!)
}
setOption(options : LimeSignatureOptions) {
this.options = options
}
disableScroll(event : UniTouchEvent) {
event.stopPropagation()
if (this.options.disableScroll) {
{
event.preventDefault()
}
}
}
getTouchLimeSignaturePoint(event : UniTouchEvent) : LimeSignaturePoint {
const rect = this.el.getBoundingClientRect()
const touche = event.touches[0];
const x = touche.clientX
const y = touche.clientY
// const force = touche.force
return {
x: x - rect.left,
y: y - rect.top
} as LimeSignaturePoint
}
onTouchStart: (event : UniTouchEvent) => void = (event : UniTouchEvent) =>{
if (this.options.disabled) {
return
}
this.disableScroll(event)
const { x, y } = this.getTouchLimeSignaturePoint(event)
this.isDrawing = true;
this.isEmpty = false
lastX = x
lastY = y
points.push({ x, y } as LimeSignaturePoint);
}
onTouchMove: (event : UniTouchEvent) => void = (event : UniTouchEvent) =>{
if (this.options.disabled || !this.isDrawing) {
return
}
this.disableScroll(event)
const { x, y } = this.getTouchLimeSignaturePoint(event)
const lineWidth = this.options.penSize
const strokeStyle = this.options.penColor
const point = { x, y } as LimeSignaturePoint
const last = { x: lastX, y: lastY } as LimeSignaturePoint
this.drawLine(point, last, lineWidth, strokeStyle)
lastX = x
lastY = y
points.push({ x, y, c: strokeStyle, w: lineWidth } as LimeSignaturePoint);
}
onTouchEnd: (event : UniTouchEvent) => void = (event : UniTouchEvent) =>{
this.disableScroll(event)
this.isDrawing = false;
undoStack.push(points);
redoStack = [] as LimeSignatureLine[];
points = [] as LimeSignaturePoint[];
this.change?.(this.isEmpty);
}
drawLine(point : LimeSignaturePoint, last : LimeSignaturePoint, lineWidth : number, strokeStyle : string) {
const ctx = this.ctx
ctx.lineWidth = lineWidth
ctx.strokeStyle = strokeStyle
ctx.lineCap = 'round'
ctx.lineJoin = 'round'
ctx.beginPath()
ctx.moveTo(last.x, last.y)
ctx.lineTo(point.x, point.y)
ctx.stroke()
ctx.closePath()
// ctx.update()
this._draw()
}
_clear() {
// #ifdef APP-ANDROID || APP-IOS
this.ctx.reset()
// #endif
// #ifdef APP-HARMONY
this.ctx.clearRect(0,0,100000,100000)
// #endif
}
_draw() {
// #ifdef APP-ANDROID || APP-IOS
this.ctx.update()
// #endif
}
// addHistory() { }
clear() {
// this.ctx.reset()
// this.ctx.update()
this._clear()
this._draw()
this.isEmpty = true
undoStack = [] as LimeSignatureLine[];
redoStack = [] as LimeSignatureLine[];
points = [] as LimeSignaturePoint[];
}
undo() {
if(redoStack.length == this.options.maxHistoryLength && this.options.maxHistoryLength != 0){
return
}
// this.ctx.reset()
this._clear()
if(undoStack.length > 0){
const lastPath : LimeSignatureLine = undoStack.pop()!;
redoStack.push(lastPath);
if(undoStack.length == 0){
this.isEmpty = true
// this.ctx.update()
this._draw()
return
}
for (let l = 0; l < undoStack.length; l++) {
for (let i = 1; i < undoStack[l].length; i++) {
const last = undoStack[l][i - 1]
const point = undoStack[l][i]
this.drawLine(point, last, point.w!, point.c!)
}
}
} else {
// this.ctx.update()
this._draw()
}
}
redo() {
if(redoStack.length < 1) return
const lastPath : LimeSignatureLine = redoStack.pop()!;
undoStack.push(lastPath);
this.isEmpty = false
for (let l = 0; l < undoStack.length; l++) {
for (let i = 1; i < undoStack[l].length; i++) {
const last = undoStack[l][i - 1]
const point = undoStack[l][i]
this.drawLine(point, last, point.w!, point.c!)
}
}
}
// restore() { }
}
\ No newline at end of file \ No newline at end of file
export interface SignaturePadProps {
/**
* 绘图样式(CSS样式字符串)
*/
styles: string
/**
* 画笔颜色
*/
penColor: string
/**
* 画笔粗细(像素)
*/
penSize: number
/**
* 背景颜色
*/
backgroundColor: string
/**
* 是否开启平滑绘制
*/
openSmooth: boolean
/**
* 最小笔触宽度
*/
minLineWidth: number
/**
* 最大笔触宽度
*/
maxLineWidth: number
/**
* 最小绘制速度(像素/秒)
*/
minSpeed: number
/**
* 最大宽度差异率
*/
maxWidthDiffRate: number
/**
* 历史记录最大长度
*/
maxHistoryLength: number
/**
* 是否禁止滚动穿透
*/
disableScroll: boolean
/**
* 组件是否禁用
*/
disabled: boolean
/**
* 是否横屏模式
*/
landscape: boolean
}
\ No newline at end of file \ No newline at end of file
export function compareVersion(v1, v2) {
v1 = v1.split('.')
v2 = v2.split('.')
const len = Math.max(v1.length, v2.length)
while (v1.length < len) {
v1.push('0')
}
while (v2.length < len) {
v2.push('0')
}
for (let i = 0; i < len; i++) {
const num1 = parseInt(v1[i], 10)
const num2 = parseInt(v2[i], 10)
if (num1 > num2) {
return 1
} else if (num1 < num2) {
return -1
}
}
return 0
}
function gte(version) {
let { SDKVersion } = uni.getSystemInfoSync()
// #ifdef MP-ALIPAY
SDKVersion = my.SDKVersion
// #endif
return compareVersion(SDKVersion, version) >= 0;
}
export function canIUseCanvas2d() {
// #ifdef MP-WEIXIN
return gte('2.9.0');
// #endif
// #ifdef MP-ALIPAY
return gte('2.7.0');
// #endif
// #ifdef MP-TOUTIAO
return gte('1.78.0');
// #endif
return false
}
export const wrapEvent = (e) => {
if (!e) return;
if (!e.preventDefault) {
e.preventDefault = function() {};
}
return e;
}
export const requestAnimationFrame = (cb) => {
setTimeout(cb, 30)
}
// #ifdef MP
export const prefix = () => {
// #ifdef MP-TOUTIAO
return tt
// #endif
// #ifdef MP-WEIXIN
return wx
// #endif
// #ifdef MP-BAIDU
return swan
// #endif
// #ifdef MP-ALIPAY
return my
// #endif
// #ifdef MP-QQ
return qq
// #endif
// #ifdef MP-360
return qh
// #endif
}
// #endif
/**
* base64转路径
* @param {Object} base64
*/
export function base64ToPath(base64) {
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || [];
return new Promise((resolve, reject) => {
// #ifdef MP
const p = prefix()
const fs = p.getFileSystemManager()
//自定义文件名
if (!format) {
reject(new Error('ERROR_BASE64SRC_PARSE'))
}
const time = new Date().getTime();
const filePath = `${p.env.USER_DATA_PATH}/${time}.${format}`;
fs.writeFile({
filePath,
data: base64.split(',')[1],
encoding: 'base64',
success() {
resolve(filePath)
},
fail(err) {
reject(err)
}
})
// #endif
// #ifdef APP-PLUS
const bitmap = new plus.nativeObj.Bitmap('bitmap' + Date.now())
bitmap.loadBase64Data(base64, () => {
if (!format) {
reject(new Error('ERROR_BASE64SRC_PARSE'))
}
const time = new Date().getTime();
const filePath = `_doc/uniapp_temp/${time}.${format}`
bitmap.save(filePath, {},
() => {
bitmap.clear()
resolve(filePath)
},
(error) => {
bitmap.clear()
reject(error)
})
}, (error) => {
bitmap.clear()
reject(error)
})
// #endif
})
}
export function sleep(delay) {
return new Promise(resolve => setTimeout(resolve, delay))
}
export function getRect(selector, options = {}) {
const typeDefault = 'boundingClientRect'
const { context, type = typeDefault} = options
return new Promise((resolve, reject) => {
const dom = uni.createSelectorQuery().in(context).select(selector);
const result = (rect) => {
if(rect) {
resolve(rect)
} else {
reject()
}
}
if(type == typeDefault) {
dom[type](result).exec()
} else {
dom[type]({
node: true,
size: true,
rect: true
}, result).exec()
}
});
};
export function isTransparent(color) {
// 判断颜色是否为 transparent
if (color === 'transparent') {
return true;
}
// 判断颜色是否为 rgba 的 a 为 0
if (color.startsWith('rgba')) {
const regex = /\d+(\.\d+)?/g;
const matches = color.match(regex);
if (matches !== null) {
const alpha = parseFloat(matches[3]);
if (alpha === 0) {
return true;
}
}
}
return false;
}
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!