|
@@ -8,7 +8,7 @@
|
|
|
@click-right="onClickRight"
|
|
|
>
|
|
|
<template #right>
|
|
|
- <div v-show="isShowVideo">{{$t('afterSales.closeTheCamera')}}</div>
|
|
|
+ <div v-show="isShowVideo">{{ $t("afterSales.closeTheCamera") }}</div>
|
|
|
</template>
|
|
|
</van-nav-bar>
|
|
|
<testForm
|
|
@@ -30,7 +30,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive, getCurrentInstance, onMounted } from "vue";
|
|
|
+import { ref, reactive, getCurrentInstance, onMounted, nextTick } from "vue";
|
|
|
import { showSuccessToast, showFailToast } from "vant";
|
|
|
import { useRoute } from "vue-router";
|
|
|
import testForm from "@/components/testForm/index.vue";
|
|
@@ -46,9 +46,24 @@ const formData = reactive({
|
|
|
data: {},
|
|
|
});
|
|
|
const rules = {
|
|
|
- productSn: [{ required: true, message: proxy.t('afterSales.pleaseEnterTheEquipmentSN') }],
|
|
|
- afterSalesPersonId: [{ required: true, message: proxy.t('afterSales.pleaseSelectAfterSalesPersonnel') }],
|
|
|
- remark: [{ required: true, message: proxy.t('afterSales.pleaseEnterTheAfterSalesReason') }],
|
|
|
+ productSn: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: proxy.t("afterSales.pleaseEnterTheEquipmentSN"),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ afterSalesPersonId: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: proxy.t("afterSales.pleaseSelectAfterSalesPersonnel"),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ remark: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: proxy.t("afterSales.pleaseEnterTheAfterSalesReason"),
|
|
|
+ },
|
|
|
+ ],
|
|
|
};
|
|
|
const formOption = reactive({
|
|
|
readonly: false, //用于控制整个表单是否只读
|
|
@@ -61,11 +76,11 @@ const formOption = reactive({
|
|
|
const formConfig = reactive([
|
|
|
{
|
|
|
type: "input",
|
|
|
- label: proxy.t('afterSales.equipmentSN'),
|
|
|
+ label: "产品Sn",
|
|
|
prop: "productSn",
|
|
|
isNeedBlurMethon: true,
|
|
|
blurMethon: (val) => {
|
|
|
- showScanData(val);
|
|
|
+ // showScanData(val);
|
|
|
},
|
|
|
isNeedRightBtn: true,
|
|
|
rightIcon: "scan",
|
|
@@ -73,21 +88,34 @@ const formConfig = reactive([
|
|
|
handleScanCode();
|
|
|
},
|
|
|
},
|
|
|
+
|
|
|
{
|
|
|
type: "input",
|
|
|
- label: proxy.t('afterSales.contractCode'),
|
|
|
- prop: "code",
|
|
|
+ label: proxy.t("afterSales.productName"),
|
|
|
+ prop: "productName",
|
|
|
readonly: true,
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- label: proxy.t('afterSales.productName'),
|
|
|
- prop: "productName",
|
|
|
+ label: "规格型号",
|
|
|
+ prop: "productSpec",
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ label: "客户名称",
|
|
|
+ prop: "productSpec",
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ label: proxy.t("afterSales.contractCode"),
|
|
|
+ prop: "code",
|
|
|
readonly: true,
|
|
|
},
|
|
|
{
|
|
|
type: "picker",
|
|
|
- label: proxy.t('afterSales.afterSalesPersonnel'),
|
|
|
+ label: "售后类型",
|
|
|
prop: "afterSalesPersonId",
|
|
|
itemType: "onePicker",
|
|
|
showPicker: false,
|
|
@@ -100,9 +128,33 @@ const formConfig = reactive([
|
|
|
{
|
|
|
type: "input",
|
|
|
itemType: "textarea",
|
|
|
- label: proxy.t('afterSales.afterSalesReason'),
|
|
|
+ label: "售后说明",
|
|
|
prop: "remark",
|
|
|
},
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ label: "客户联系人",
|
|
|
+ prop: "productSpec",
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ label: "客户联系方式",
|
|
|
+ prop: "productSpec",
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "picker",
|
|
|
+ label: proxy.t("afterSales.afterSalesPersonnel"),
|
|
|
+ prop: "afterSalesPersonId",
|
|
|
+ itemType: "onePicker",
|
|
|
+ showPicker: false,
|
|
|
+ fieldNames: {
|
|
|
+ text: "label",
|
|
|
+ value: "value",
|
|
|
+ },
|
|
|
+ data: [],
|
|
|
+ },
|
|
|
]);
|
|
|
const onClickLeft = () => history.back();
|
|
|
|
|
@@ -129,6 +181,15 @@ const getDetails = (id) => {
|
|
|
};
|
|
|
|
|
|
onMounted(() => {
|
|
|
+ nextTick(() => {
|
|
|
+ window.getVueMessage = (data) => {
|
|
|
+ if (data) {
|
|
|
+ // showSuccessToast(data);
|
|
|
+ formData.data.productSn = data;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
formData.data.afterSalesPersonId = getUserInfo().userId;
|
|
|
getDict();
|
|
|
if (route.query.id) {
|
|
@@ -139,7 +200,7 @@ onMounted(() => {
|
|
|
const onSubmit = () => {
|
|
|
proxy.post("/afterSalesRecord/add", formData.data).then(
|
|
|
() => {
|
|
|
- showSuccessToast(proxy.t('afterSales.operationSuccessful'));
|
|
|
+ showSuccessToast(proxy.t("afterSales.operationSuccessful"));
|
|
|
setTimeout(() => {
|
|
|
onClickLeft();
|
|
|
}, 500);
|
|
@@ -169,7 +230,7 @@ const decodeFromInputVideoFunc = (firstDeviceId) => {
|
|
|
(result, err) => {
|
|
|
if (result) {
|
|
|
codeReader.reset();
|
|
|
- showSuccessToast(proxy.t('afterSales.scanSuccess'));
|
|
|
+ showSuccessToast(proxy.t("afterSales.scanSuccess"));
|
|
|
isShowVideo.value = false;
|
|
|
showScanData(result.text);
|
|
|
}
|
|
@@ -182,28 +243,33 @@ const decodeFromInputVideoFunc = (firstDeviceId) => {
|
|
|
};
|
|
|
|
|
|
const handleScanCode = () => {
|
|
|
- codeReader
|
|
|
- .getVideoInputDevices()
|
|
|
- .then((videoInputDevices) => {
|
|
|
- // 默认获取第一个摄像头设备id
|
|
|
- let firstDeviceId = videoInputDevices[0].deviceId;
|
|
|
- // 获取第一个摄像头设备的名称
|
|
|
- const videoInputDeviceslablestr = JSON.stringify(
|
|
|
- videoInputDevices[0].label
|
|
|
- );
|
|
|
- if (videoInputDevices.length > 1) {
|
|
|
- // 判断是否后置摄像头
|
|
|
- if (videoInputDeviceslablestr.indexOf("back") > -1) {
|
|
|
- firstDeviceId = videoInputDevices[0].deviceId;
|
|
|
- } else {
|
|
|
- firstDeviceId = videoInputDevices[1].deviceId;
|
|
|
- }
|
|
|
- }
|
|
|
- decodeFromInputVideoFunc(firstDeviceId);
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.error(err, proxy.t('afterSales.error'));
|
|
|
- });
|
|
|
+ // codeReader
|
|
|
+ // .getVideoInputDevices()
|
|
|
+ // .then((videoInputDevices) => {
|
|
|
+ // // 默认获取第一个摄像头设备id
|
|
|
+ // let firstDeviceId = videoInputDevices[0].deviceId;
|
|
|
+ // // 获取第一个摄像头设备的名称
|
|
|
+ // const videoInputDeviceslablestr = JSON.stringify(
|
|
|
+ // videoInputDevices[0].label
|
|
|
+ // );
|
|
|
+ // if (videoInputDevices.length > 1) {
|
|
|
+ // // 判断是否后置摄像头
|
|
|
+ // if (videoInputDeviceslablestr.indexOf("back") > -1) {
|
|
|
+ // firstDeviceId = videoInputDevices[0].deviceId;
|
|
|
+ // } else {
|
|
|
+ // firstDeviceId = videoInputDevices[1].deviceId;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // decodeFromInputVideoFunc(firstDeviceId);
|
|
|
+ // })
|
|
|
+ // .catch((err) => {
|
|
|
+ // console.error(err, proxy.t('afterSales.error'));
|
|
|
+ // });
|
|
|
+ uni.postMessage({
|
|
|
+ data: {
|
|
|
+ type: "scanCode",
|
|
|
+ },
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const onClickRight = () => {
|