310 lines
8.9 KiB
JavaScript
310 lines
8.9 KiB
JavaScript
var t;
|
|
(t = getApp()),
|
|
Page({
|
|
data: {
|
|
highe: wx.getSystemInfoSync().windowHeight + 180,
|
|
inputShowed: !1,
|
|
inputVal: "",
|
|
amapPlugin: null,
|
|
covers: [],
|
|
address: [],
|
|
scrollH: 356,
|
|
dk: 1,
|
|
ok: 0,
|
|
type: 2,
|
|
files: [],
|
|
imgs: [],
|
|
content: "",
|
|
latitude: "",
|
|
longitude: "",
|
|
address: "",
|
|
name: "",
|
|
beizhu: "",
|
|
cxjg: "",
|
|
orderid: "",
|
|
showPrivacy: !1,
|
|
},
|
|
uploadimg: function () {
|
|
if (wx.getStorageSync("uid")) {
|
|
var e = this.data.files,
|
|
a = {
|
|
url:
|
|
t.util.url("entry/wxapp/scqiniu") +
|
|
"&m=" +
|
|
t.siteInfo.m +
|
|
"&ids=uptp",
|
|
path: e,
|
|
};
|
|
e.length > 0
|
|
? ((t.globalData.files = []), this.uploadimgs(a))
|
|
: this.ok(),
|
|
this.setData({ ok: 1 });
|
|
}
|
|
},
|
|
handleAgreePrivacyAuthorization() {
|
|
this.setData({ showPrivacy: !1 }),
|
|
wx.showToast({
|
|
title: "感谢您的同意,请开始使用~",
|
|
icon: "none",
|
|
duration: 2e3,
|
|
});
|
|
},
|
|
handleOpenPrivacyContract() {
|
|
wx.openPrivacyContract({
|
|
success: () => {},
|
|
fail: () => {},
|
|
complete: () => {},
|
|
});
|
|
},
|
|
uploadimgs: function (e) {
|
|
var a = this,
|
|
i = e.i ? e.i : 0,
|
|
o = e.success ? e.success : 0,
|
|
n = e.fail ? e.fail : 0;
|
|
wx.showLoading({ title: "上传中.." }),
|
|
console.log("上传图片路径", e.path[i]),
|
|
wx.uploadFile({
|
|
url: e.url,
|
|
filePath: e.path[i],
|
|
name: "file",
|
|
formData: null,
|
|
success: (e) => {
|
|
o++, console.log(e), console.log(i);
|
|
var a = e.data.replace("\r\n", "");
|
|
1 != a
|
|
? (t.globalData.files = t.globalData.files.concat(a))
|
|
: wx.showToast({
|
|
title: "图片" + (i + 1) + "违规",
|
|
icon: "success",
|
|
duration: 2e3,
|
|
});
|
|
},
|
|
fail: (t) => {
|
|
n++, console.log("fail:" + i + "fail:" + n), wx.hideLoading();
|
|
},
|
|
complete: () => {
|
|
console.log(i),
|
|
++i == e.path.length
|
|
? (console.log("执行完毕"),
|
|
console.log(t.globalData.files),
|
|
console.log("成功:" + o + " 失败:" + n),
|
|
a.setData({ imgs: t.globalData.files }),
|
|
wx.hideLoading(),
|
|
a.ok())
|
|
: (console.log(i),
|
|
(e.i = i),
|
|
(e.success = o),
|
|
(e.fail = n),
|
|
a.uploadimgs(e));
|
|
},
|
|
});
|
|
},
|
|
ok: function (e) {
|
|
var a = this;
|
|
if (5 == a.data.type || a.data.imgs[0])
|
|
if (5 != a.data.type || a.data.cxjg) {
|
|
wx.showLoading({ title: "完成中.." });
|
|
var i = {
|
|
uid: wx.getStorageSync("uid"),
|
|
imgs: a.data.imgs,
|
|
orderid: a.data.orderid,
|
|
content: a.data.content,
|
|
type: a.data.type,
|
|
typeid: a.data.typeid,
|
|
beizhu: a.data.beizhu,
|
|
cxjg: a.data.cxjg,
|
|
};
|
|
t.getdata(i, "rengong").then((t) => {
|
|
wx.hideLoading(),
|
|
console.log("回调数据搜索:", t),
|
|
a.setData({ ok: 0, files: [], imgs: [], content: "" }),
|
|
wx.showModal({
|
|
title: "温馨提示",
|
|
content: "已经在提交~",
|
|
success: function (t) {
|
|
t.confirm
|
|
? a.setData({ dk: 0 })
|
|
: t.cancel && console.log("用户点击取消");
|
|
},
|
|
});
|
|
});
|
|
} else
|
|
wx.showModal({
|
|
title: "温馨提示",
|
|
content: "请输入结果",
|
|
success: function (t) {},
|
|
});
|
|
else
|
|
wx.showModal({
|
|
title: "温馨提示",
|
|
content: "请上传结果图片",
|
|
success: function (t) {},
|
|
});
|
|
},
|
|
tuikuan: function (e) {
|
|
var a = this;
|
|
if (a.data.beizhu) {
|
|
wx.showLoading({ title: "完成中.." });
|
|
var i = {
|
|
uid: wx.getStorageSync("uid"),
|
|
orderid: a.data.orderid,
|
|
typeid: a.data.typeid,
|
|
type: 0,
|
|
beizhu: a.data.beizhu,
|
|
};
|
|
t.getdata(i, "rengong").then((t) => {
|
|
wx.hideLoading(),
|
|
console.log("回调数据搜索:", t),
|
|
a.setData({ ok: 0, files: [], imgs: [], content: "" }),
|
|
wx.showModal({
|
|
title: "温馨提示",
|
|
content: "已经退款~",
|
|
success: function (t) {
|
|
t.confirm
|
|
? a.setData({ dk: 0 })
|
|
: t.cancel && console.log("用户点击取消");
|
|
},
|
|
});
|
|
});
|
|
} else
|
|
wx.showModal({
|
|
title: "温馨提示",
|
|
content: "请填写退款备注",
|
|
success: function (t) {},
|
|
});
|
|
},
|
|
onShow: function (t) {
|
|
wx.getPrivacySetting({
|
|
success: (t) => {
|
|
console.log(t),
|
|
t.needAuthorization && this.setData({ showPrivacy: !0 });
|
|
},
|
|
fail: () => {},
|
|
complete: () => {},
|
|
});
|
|
},
|
|
onLoad: function (t) {
|
|
wx.getStorageSync("uid") || getApp().wxlogin(),
|
|
this.setData({
|
|
orderid: t.orderid,
|
|
type: t.type,
|
|
typeid: t.type,
|
|
vin: t.vin,
|
|
}),
|
|
this.getDetail(t.orderid);
|
|
const e = this;
|
|
wx.getSystemInfo({
|
|
success: function (t) {
|
|
e.setData({
|
|
scrollH: t.windowHeight - 44 - (t.windowWidth / 750) * 400,
|
|
});
|
|
},
|
|
});
|
|
},
|
|
getDetail: function (e) {
|
|
var a = this,
|
|
i = { typeid: a.data.typeid, orderid: e };
|
|
t.getdata(i, "rengongid").then((t) => {
|
|
console.log("回调数据:", t),
|
|
t && a.setData({ cardata: t.data, orderid: e });
|
|
});
|
|
},
|
|
chaping: function () {
|
|
var t = this;
|
|
setTimeout(function () {
|
|
let e = null;
|
|
wx.createInterstitialAd &&
|
|
((e = wx.createInterstitialAd({ adUnitId: t.data.capingtId })),
|
|
e.onLoad(() => {}),
|
|
e.onError((t) => {}),
|
|
e.onClose(() => {})),
|
|
e &&
|
|
e.show().catch((t) => {
|
|
console.error(t);
|
|
});
|
|
}, 3e3);
|
|
},
|
|
chooseImage: function (e) {
|
|
let a = this;
|
|
a.data.files.length >= 120
|
|
? t.showToast("最多上传120张图片")
|
|
: wx.chooseImage({
|
|
count: 120 - a.data.files.length,
|
|
sizeType: ["original"],
|
|
sourceType: ["album", "camera"],
|
|
success: function (t) {
|
|
a.setData({ files: a.data.files.concat(t.tempFilePaths) });
|
|
},
|
|
});
|
|
},
|
|
previewImage: function (t) {
|
|
wx.previewImage({ current: t.currentTarget.id, urls: this.data.files });
|
|
},
|
|
xszImage: function (t) {
|
|
wx.previewImage({
|
|
current: t.currentTarget.id,
|
|
urls: [t.currentTarget.id],
|
|
});
|
|
},
|
|
fuzhi: function (t) {
|
|
wx.setClipboardData({
|
|
data: t.currentTarget.id,
|
|
success(t) {
|
|
wx.getClipboardData({
|
|
success(t) {
|
|
wx.showModal({
|
|
title: "提示",
|
|
content: "复制成功",
|
|
success: function (t) {
|
|
t.confirm
|
|
? console.log("确定")
|
|
: t.cancel && console.log("取消");
|
|
},
|
|
}),
|
|
console.log(t.data);
|
|
},
|
|
});
|
|
},
|
|
});
|
|
},
|
|
deleteImage: function (t) {
|
|
const e = t.currentTarget.dataset.index;
|
|
let a = this.data.files;
|
|
a.splice(e, 1), this.setData({ files: a });
|
|
},
|
|
trim: function (t) {
|
|
return t ? t.toString().replace(/(^\s*)|(\s*$)/g, "") : t;
|
|
},
|
|
showInput() {
|
|
this.setData({ inputShowed: !0 });
|
|
},
|
|
hideInput() {
|
|
this.setData({ inputVal: "", inputShowed: !1 }), wx.hideKeyboard();
|
|
},
|
|
clearInput() {
|
|
this.setData({ inputVal: "" });
|
|
},
|
|
inputTyping: function (t) {
|
|
this.setData({ inputVal: t.detail.value });
|
|
},
|
|
qxdaka: function (t) {
|
|
this.setData({ content: "" }), wx.navigateBack({ delta: 0 });
|
|
},
|
|
bindInput: function (t) {
|
|
const e = t.detail.value;
|
|
this.getPoiAround(e);
|
|
},
|
|
conInput: function (t) {
|
|
this.setData({ content: t.detail.value }), console.log(t.detail.value);
|
|
},
|
|
gameInput: function (t) {
|
|
this.setData({ orderid: t.detail.value }), console.log(t.detail.value);
|
|
},
|
|
beizhuInput: function (t) {
|
|
this.setData({ beizhu: t.detail.value }), console.log(t.detail.value);
|
|
},
|
|
cxjgInput: function (t) {
|
|
this.setData({ cxjg: t.detail.value }), console.log(t.detail.value);
|
|
},
|
|
});
|