|
@@ -0,0 +1,87 @@
|
|
|
+const deleteMark = require("../../../../utils/deleteMark"),
|
|
|
+ _Http = getApp().globalData.http;
|
|
|
+let count = null;
|
|
|
+Component({
|
|
|
+ properties: {
|
|
|
+ endInsert: {
|
|
|
+ type: Function
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ region: ['', '', ''], //省市县选择
|
|
|
+ "content": {
|
|
|
+ "sat_orderclueid": 0,
|
|
|
+ "name": "",
|
|
|
+ "phonenumber": "",
|
|
|
+ "province": "",
|
|
|
+ "city": "",
|
|
|
+ "county": "",
|
|
|
+ "address": "",
|
|
|
+ "notes": "",
|
|
|
+ "cluesource": ""
|
|
|
+ },
|
|
|
+ disabled: true,
|
|
|
+ loading: false
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /* 提交 */
|
|
|
+ submit() {
|
|
|
+ if (this.data.disabled || this.data.loading) return;
|
|
|
+ if (!deleteMark.CheckPhoneNumber(this.data.content.phonenumber)) return;
|
|
|
+ this.setData({
|
|
|
+ loading: true
|
|
|
+ });
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "saletool.orderclue.web.orderclue",
|
|
|
+ "method": "edit",
|
|
|
+ content: this.data.content
|
|
|
+ }).then(res => {
|
|
|
+ this.setData({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ this.triggerEvent("endInsert");
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 输入框输入内容 */
|
|
|
+ inputChange(e) {
|
|
|
+ let text = e.type == 'input' ? e.detail.value : e.detail;
|
|
|
+ text = deleteMark.queryStr(text);
|
|
|
+ const {
|
|
|
+ label
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ this.setData({
|
|
|
+ ["content." + label]: text
|
|
|
+ })
|
|
|
+ if (['phonenumber', 'province', 'cluesource'].includes(label)) this.isDisabled();
|
|
|
+ },
|
|
|
+ /* 是否禁用 */
|
|
|
+ isDisabled() {
|
|
|
+ clearTimeout(count)
|
|
|
+ count = setTimeout(() => {
|
|
|
+ let {
|
|
|
+ phonenumber,
|
|
|
+ province,
|
|
|
+ cluesource
|
|
|
+ } = this.data.content;
|
|
|
+ this.setData({
|
|
|
+ disabled: !(phonenumber && province && cluesource)
|
|
|
+ })
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ /* 省市县选择器 */
|
|
|
+ bindRegionChange: function (e) {
|
|
|
+ let region = e.detail.value;
|
|
|
+ this.setData({
|
|
|
+ region,
|
|
|
+ "content.province": region[0],
|
|
|
+ "content.city": region[1],
|
|
|
+ "content.county": region[2],
|
|
|
+ })
|
|
|
+ this.isDisabled();
|
|
|
+ }
|
|
|
+ }
|
|
|
+})
|