(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
  ["pages/index/groupCompany/cost/addCost"], {
      1748: function(e, t, n) {
          "use strict";
          n.r(t);
          var i = n("8a20"),
              o = n.n(i);
          for (var s in i)["default"].indexOf(s) < 0 && function(e) {
              n.d(t, e, (function() {
                  return i[e]
              }))
          }(s);
          t["default"] = o.a
      },
      2366: function(e, t, n) {},
      "47b9": function(e, t, n) {
          "use strict";
          n.d(t, "b", (function() {
              return o
          })), n.d(t, "c", (function() {
              return s
          })), n.d(t, "a", (function() {
              return i
          }));
          var i = {
                  uActionSheet: function() {
                      return n.e("uview-ui/components/u-action-sheet/u-action-sheet").then(n.bind(null, "b13b"))
                  }
              },
              o = function() {
                  var e = this.$createElement,
                      t = (this._self._c, this.imgList.length),
                      n = this.fileList.length;
                  this.$mp.data = Object.assign({}, {
                      $root: {
                          g0: t,
                          g1: n
                      }
                  })
              },
              s = []
      },
      "51e1": function(e, t, n) {
          "use strict";
          n.r(t);
          var i = n("47b9"),
              o = n("1748");
          for (var s in o)["default"].indexOf(s) < 0 && function(e) {
              n.d(t, e, (function() {
                  return o[e]
              }))
          }(s);
          n("f416");
          var c = n("f0c5"),
              u = Object(c["a"])(o["default"], i["b"], i["c"], !1, null, null, null, !1, i["a"], void 0);
          t["default"] = u.exports
      },
      "7b73": function(e, t, n) {
          "use strict";
          (function(e, t) {
              var i = n("4ea4");
              n("8886");
              i(n("66fd"));
              var o = i(n("51e1"));
              e.__webpack_require_UNI_MP_PLUGIN__ = n, t(o.default)
          }).call(this, n("bc2e")["default"], n("543d")["createPage"])
      },
      "8a20": function(e, t, n) {
          "use strict";
          (function(e, i) {
              Object.defineProperty(t, "__esModule", {
                  value: !0
              }), t.default = void 0;
              var o = n("76dd"),
                  s = n("dc92"),
                  c = n("0c59"),
                  u = n("8683"),
                  a = {
                      mixins: [u.commonF],
                      components: {
                          fixedApproval: function() {
                              n.e("components/fixedApproval").then(function() {
                                  return resolve(n("d3f7"))
                              }.bind(null, n)).catch(n.oe)
                          },
                          selectCustomer: function() {
                              Promise.all([n.e("common/vendor"), n.e("components/selectCustomer")]).then(function() {
                                  return resolve(n("5bcd"))
                              }.bind(null, n)).catch(n.oe)
                          }
                      },
                      data: function() {
                          return {
                              noClick: !0,
                              customer_id: "",
                              consume_time: "",
                              consume_type: "",
                              money: "",
                              theme:"",
                              remark: "",
                              file_ids: "",
                              BASE_IMG_URL: c.BASE_IMG_URL,
                              typeList: [],
                              index: null,
                              DefaultRemind: [],
                              remindPeople: [],
                              remindType: "consume",
                              imgList: [],
                              fileList: [],
                              uploadShow: !1,
                              uploadActions: [{
                                  id: 1,
                                  text: "拍照",
                                  color: "#03aa96"
                              }, {
                                  id: 2,
                                  text: "从相册中选择",
                                  color: "#03aa96"
                              }],
                              customerList: [],
                              customerIndex: null,
                              customerObj: {},
                              approvalPro: {},
                              isRequired: !1,
                              BASE_URL:c.BASE_URL,
                              agreement:[], //关联合同名称
                              agreementList:[],//关联合同
                              agreementIndex:0,
                              agreementId:'',
                          }
                      },
                      onLoad: function(e) {
                      var that = this;
                        console.log(e)
                          e.kehuid && (this.customer_id = e.kehuid, this.getKehu()), this.getType(), this.getProcess(),this.getAgreement();
                          setTimeout(function(){
                            if(e.agreementId) {
                              that.agreementId = e.agreementId
                              that.getAgreementId();
                            }
                          },400)
                      },
                      methods: {
                         
                          changeRequired: function(e) {
                              this.isRequired = e.detail.value
                          },
                          getProcess: function() {
                              var e = this;
                              (0, s.netApprovalProcess)({
                                  type: "consume"
                              }).then((function(t) {
                                  e.approvalPro = t.data
                              }))
                          },
                          getKehu: function() {
                              var e = this;
                              (0, o.netPrevCustomer)().then((function(t) {
                                  e.customerList = t.data, e.customer_id && e.customerList.forEach((function(t, n) {
                                      t.id == e.customer_id && (e.customerObj = t)
                                  }))
                              }))
                          },
                          changeCustomer: function(e) {
                              this.$refs.customerChild.init()
                          },
                          getCustomerinfo: function(e) {
                              this.customerObj = e
                          },
                          getType: function() {
                              var e = this;
                              (0, o.netSelect)().then((function(t) {
                                  e.typeList = t.data["消费方式"]
                              }))
                          },
                          changeTime: function(e) {
                              this.consume_time = e.detail.value
                          },
                          changeType: function(e) {
                              this.consume_type = this.typeList[e.detail.value]
                          },
                          uploadClick: function() {
                              this.uploadShow = !0
                          },
                          onCancel: function() {
                              this.uploadShow = !1
                          },
                          uploadType: function(t) {
                              var n = this;
                              0 == t ? e.chooseImage({
                                  sourceType: ["camera"],
                                  sizeType: ["compressed"],
                                  success: function(e) {
                                      var t = e.tempFilePaths;
                                      t.forEach((function(e) {
                                          n.uploadFile(e, 1)
                                      }))
                                  }
                              }) : 1 == t ? e.chooseImage({
                                  sourceType: ["album"],
                                  sizeType: ["compressed"],
                                  success: function(e) {
                                      var t = e.tempFilePaths;
                                      t.forEach((function(e) {
                                          n.uploadFile(e, 1)
                                      }))
                                  }
                              }) : i.chooseMessageFile({
                                  count: 1,
                                  type: "file",
                                  success: function(e) {
                                      var t = e.tempFiles[0];
                                      n.uploadFile(t, 2)
                                  },
                                  fail: function(e) {
                                      console.log(e)
                                  }
                              })
                          },
                          uploadFile: function(t, n) {
                              var i = this;
                              e.uploadFile({
                                  url: s.uploadUrl,
                                  name: "file",
                                  header: {
                                      token: e.getStorageSync("token")
                                  },
                                  filePath: 1 == n ? t : t.path,
                                  success: function(o) {
                                      var s = JSON.parse(o.data);
                                      i.uploadShow = !1, 1 == s.code ? 1 == n ? i.imgList.push(s.data) : (t = Object.assign({}, t, s.data), i.fileList.push(t)) : e.showToast({
                                          title: "上传失败",
                                          icon: "none"
                                      })
                                  },
                                  fail: function(e) {
                                      console.log(e)
                                  }
                              })
                          },
                          delImg: function(e) {
                              this.imgList.splice(e, 1)
                          },
                          delFile: function(e) {
                              this.fileList.splice(e, 1)
                          },
                          moreClick: function() {
                              e.navigateTo({
                                  url: "/pagesA/crm/selectMember/selectMember"
                              })
                          },

                          // 获取所有关联合同
                          getAgreement: function() {
                            let that = this;
                            wx.request({
                              url: that.BASE_URL + 'bill/getContractList',
                              data: {},
                              header: {
                                'content-type': 'application/json', // 默认值
                                'token': wx.getStorageSync('token'),
                              },
                              success (res) {
                                console.log(res.data,'合同列表')
                                let agreement = res.data.data.map(item => {
                                  return item.name
                                })
                                that.agreement = agreement;
                                that.agreementList = res.data.data;
                                that.agreementId = that.agreementList[that.agreementIndex].id;
                              }
                            })
                          },

                           // 选择关联合同
                           bindAgreement: function(e) {
                            let that = this;
                            let value = e.detail.value;
                            that.agreementIndex = value;
                            that.agreementId = that.agreementList[e.detail.value].id;
                          },

                          // 获取合同过来的合同名称并选中
                          getAgreementId: function() {
                            let that = this;
                            let agreementId = Number(that.agreementId);
                            let agreementIdList = that.agreementList.map(item => {
                              return item.id
                            })
                            let index = agreementIdList.indexOf(agreementId);
                            that.agreementIndex =  index;
                          },

                          saveFollow: function() {
                              var i = this.money,
                                  theme = this.theme,
                                  agreementId = this.agreementId,
                                  s = this.remark,
                                  c = this.imgList,
                                  u = (this.fileList, this.remindPeople);
                                  if (i)
                                  if (u && 0 != u.length || 0 != this.approvalPro.status) {
                                      var a = [];
                                      c.forEach((function(e) {
                                          a.push(e.id)
                                      }));
                                      var r = a.join(","),
                                          l = [];
                                      u.forEach((function(e) {
                                          l.push(e.id)
                                      }));
                                      var f = {
                                          customer_id: 0,
                                          // consume_time: t,
                                          consume_type: n,
                                          theme:theme,
                                          contract_id:agreementId,
                                          money: i,
                                          remark: s,
                                          file_ids: r,
                                          flow_staff_ids: 0 == this.approvalPro.status ? l.join(",") : ""
                                      };
                                      (0, o.netAddCost)(f).then((function(t) {
                                          e.showToast({
                                              title: t.msg,
                                              icon: "none"
                                          }), setTimeout((function() {
                                              e.navigateBack({
                                                  delta: 1
                                              })
                                          }), 2e3)
                                      }))
                                  } else e.showToast({
                                      title: "请选择流程审批人",
                                      icon: "none"
                                  });
                              else e.showToast({
                                  title: "请填写消费金额",
                                  icon: "none"
                              });
                          }
                      }
                  };
              t.default = a
          }).call(this, n("543d")["default"], n("bc2e")["default"])
      },
      f416: function(e, t, n) {
          "use strict";
          var i = n("2366"),
              o = n.n(i);
          o.a
      }
  },
  [
      ["7b73", "common/runtime", "common/vendor"]
  ],


]);