{"remainingRequest":"/Users/admin/projects/dms/src/dealer_admin/node_modules/babel-loader/lib/index.js!/Users/admin/projects/dms/src/dealer_admin/node_modules/cache-loader/dist/cjs.js??ref--0-0!/Users/admin/projects/dms/src/dealer_admin/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/admin/projects/dms/src/dealer_admin/src/views/dealer/list/index.vue?vue&type=script&lang=js","dependencies":[{"path":"/Users/admin/projects/dms/src/dealer_admin/src/views/dealer/list/index.vue","mtime":1713161556000},{"path":"/Users/admin/projects/dms/src/dealer_admin/babel.config.js","mtime":1713161556000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["\"use strict\";\n\nvar _interopRequireWildcard3 = require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\nvar _interopRequireDefault = require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\nrequire(\"core-js/modules/es6.function.name\");\nvar _objectSpread2 = _interopRequireDefault(require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/objectSpread2.js\"));\nvar _interopRequireWildcard2 = _interopRequireDefault(require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/interopRequireWildcard.js\"));\nvar _regeneratorRuntime2 = _interopRequireDefault(require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/regeneratorRuntime.js\"));\nrequire(\"regenerator-runtime/runtime\");\nvar _asyncToGenerator2 = _interopRequireDefault(require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar API = _interopRequireWildcard3(require(\"@/api/dealer.js\"));\nvar _waves = _interopRequireDefault(require(\"@/directive/waves\"));\nvar _utils = require(\"@/utils\");\nvar _Pagination = _interopRequireDefault(require(\"@/components/Pagination\"));\nvar _dealer2 = _interopRequireDefault(require(\"../apply/components/dealer.vue\"));\nvar _filters = require(\"@/filters\");\nvar _loginModal = _interopRequireDefault(require(\"./components/loginModal.vue\"));\nvar _IndustrySelect = _interopRequireDefault(require(\"@/views/components/IndustrySelect.vue\"));\nvar _inventory_modal = _interopRequireDefault(require(\"./components/inventory_modal.vue\"));\nvar _form = _interopRequireDefault(require(\"../apply/components/form.vue\"));\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n// waves directive\n// import Detail from './components/detail.vue';\nvar _default = exports.default = {\n  name: \"DealerInvite\",\n  components: {\n    Pagination: _Pagination.default,\n    //Detail,\n    Dealer: _dealer2.default,\n    LoginModal: _loginModal.default,\n    IndustrySelect: _IndustrySelect.default,\n    InventoryModal: _inventory_modal.default,\n    Form: _form.default\n  },\n  directives: {\n    waves: _waves.default\n  },\n  data: function data() {\n    return {\n      list: [],\n      total: 0,\n      listLoading: false,\n      listQuery: {\n        page: 1,\n        limit: 10,\n        status: 3,\n        stat: '',\n        search: ''\n      },\n      dealerLevelMap: {},\n      exportLoading: false,\n      inventoryPrice: 0\n    };\n  },\n  created: function created() {\n    this.$forceUpdate();\n    this.init();\n    this.getDealerLevelMap();\n  },\n  methods: {\n    init: function init() {\n      this.getList();\n      this.getInventoryStatistic();\n    },\n    getList: function () {\n      var _getList = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {\n        var res, _res$result, total, list;\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {\n          while (1) switch (_context.prev = _context.next) {\n            case 0:\n              this.listLoading = true;\n              _context.next = 3;\n              return API.list(this.listQuery);\n            case 3:\n              res = _context.sent;\n              _res$result = res.result, total = _res$result.total, list = _res$result.list;\n              this.total = total;\n              this.list = [];\n              this.list = list;\n              this.listLoading = false;\n              this.getDetailStatistic();\n            case 10:\n            case \"end\":\n              return _context.stop();\n          }\n        }, _callee, this);\n      }));\n      function getList() {\n        return _getList.apply(this, arguments);\n      }\n      return getList;\n    }(),\n    getDetailStatistic: function () {\n      var _getDetailStatistic = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {\n        var i, l;\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {\n          while (1) switch (_context2.prev = _context2.next) {\n            case 0:\n              i = 0, l = this.list.length;\n            case 1:\n              if (!(i < l)) {\n                _context2.next = 7;\n                break;\n              }\n              _context2.next = 4;\n              return this.getDealerDetailInfo(this.list[i]._id, i);\n            case 4:\n              i++;\n              _context2.next = 1;\n              break;\n            case 7:\n            case \"end\":\n              return _context2.stop();\n          }\n        }, _callee2, this);\n      }));\n      function getDetailStatistic() {\n        return _getDetailStatistic.apply(this, arguments);\n      }\n      return getDetailStatistic;\n    }(),\n    getDealerDetailInfo: function () {\n      var _getDealerDetailInfo = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3(dealer_id, index) {\n        var resData, statisticData, list, item;\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {\n          while (1) switch (_context3.prev = _context3.next) {\n            case 0:\n              _context3.next = 2;\n              return API.getDealerDetailInfo(dealer_id);\n            case 2:\n              resData = _context3.sent;\n              if (resData.__error == 0) {\n                statisticData = resData.result;\n                list = JSON.parse(JSON.stringify(this.list));\n                item = list[index];\n                item.nowMonthAmisMoney = statisticData.nowMonthAmisMoney;\n                item.nowMonthMoney = statisticData.nowMonthMoney;\n                item.nowMonthPercent = statisticData.nowMonthPercent;\n                item.nowYearAmisMoney = statisticData.nowYearAmisMoney;\n                item.nowYearMoney = statisticData.nowYearMoney;\n                item.nowYearPercent = statisticData.nowYearPercent;\n                item.inventoryPrice = statisticData.inventoryPrice;\n                list[index] = item;\n                this.list = [];\n                this.list = list;\n              }\n            case 4:\n            case \"end\":\n              return _context3.stop();\n          }\n        }, _callee3, this);\n      }));\n      function getDealerDetailInfo(_x, _x2) {\n        return _getDealerDetailInfo.apply(this, arguments);\n      }\n      return getDealerDetailInfo;\n    }(),\n    getInventoryStatistic: function () {\n      var _getInventoryStatistic = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {\n        var res;\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {\n          while (1) switch (_context4.prev = _context4.next) {\n            case 0:\n              _context4.next = 2;\n              return API.getInventoryStatistic(this.listQuery);\n            case 2:\n              res = _context4.sent;\n              console.log(\"res:\", res);\n              if (res.__error == 0) {\n                this.inventoryPrice = res.result;\n              }\n            case 5:\n            case \"end\":\n              return _context4.stop();\n          }\n        }, _callee4, this);\n      }));\n      function getInventoryStatistic() {\n        return _getInventoryStatistic.apply(this, arguments);\n      }\n      return getInventoryStatistic;\n    }(),\n    handleFilter: function handleFilter() {\n      this.listQuery.page = 1;\n      this.init();\n    },\n    getDealerLevelMap: function () {\n      var _getDealerLevelMap = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee5() {\n        var response, __error, msg, result;\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee5$(_context5) {\n          while (1) switch (_context5.prev = _context5.next) {\n            case 0:\n              _context5.next = 2;\n              return API.getDealerLevelMap();\n            case 2:\n              response = _context5.sent;\n              __error = response.__error, msg = response.msg, result = response.result;\n              if (__error == 0) {\n                this.dealerLevelMap = result.map;\n              }\n            case 5:\n            case \"end\":\n              return _context5.stop();\n          }\n        }, _callee5, this);\n      }));\n      function getDealerLevelMap() {\n        return _getDealerLevelMap.apply(this, arguments);\n      }\n      return getDealerLevelMap;\n    }(),\n    getDetail: function getDetail(id) {\n      var _this = this;\n      this.$nextTick(function () {\n        _this.$refs.detail.init(id);\n      });\n    },\n    lookDetail: function lookDetail(id) {\n      var _this2 = this;\n      this.$nextTick(function () {\n        _this2.$refs.dealer.init(id);\n      });\n    },\n    showInventoryModal: function showInventoryModal(id) {\n      var _this3 = this;\n      this.$nextTick(function () {\n        _this3.$refs.inventoryModal.init(id);\n      });\n    },\n    fromHandle: function fromHandle(id) {\n      var _this4 = this;\n      this.$nextTick(function () {\n        _this4.$refs.fromType.init(id);\n      });\n    },\n    exportExcel: function exportExcel() {\n      var _this5 = this;\n      this.exportLoading = true;\n      Promise.resolve().then(function () {\n        return (0, _interopRequireWildcard2.default)(require(\"@/vendor/Export2Excel\"));\n      }).then(function (excel) {\n        var tHeader = [\"公司中文名称\", \"公司英文名称\", \"专属销售人员\", \"行业\", \"等级\",\n        // \"返点\",\n        \"申请时间\", \"到期日期\", \"库存总额\", \"当月目标销售额\", \"当月实际完成销售额\", \"当月完成度\", \"当年目标销售额\", \"当年实际完成销售额\", \"当年完成度\"];\n        var filterVal = [\"china_name\", \"en_name\", \"dealer_invite\", \"industry\", \"level\",\n        // \"rebate\",\n        \"create_at\", \"expire_date\", \"inventoryPrice\", \"nowMonthAmisMoney\", \"nowMonthMoney\", \"nowMonthPercent\", \"nowYearAmisMoney\", \"nowYearMoney\", \"nowYearPercent\"];\n        var newList = _this5.list.map(function (e) {\n          //console.log(e);\n          return (0, _objectSpread2.default)({}, e);\n        });\n        console.log(\"newList:\", newList);\n        var data = _this5.formatJson(filterVal, newList);\n        console.log(\"data:\", data);\n        excel.export_json_to_excel({\n          header: tHeader,\n          data: data,\n          filename: \"经销商列表\"\n        });\n        _this5.exportLoading = false;\n      });\n    },\n    formatJson: function formatJson(filterVal, jsonData) {\n      var _this6 = this;\n      return jsonData.map(function (v) {\n        return filterVal.map(function (j) {\n          if (j === \"industry\") {\n            if (v[j]) {\n              return v[j].name;\n            }\n            return \"\";\n          } else if (j === \"level\") {\n            return _this6.dealerLevelMap[v[j]] && _this6.dealerLevelMap[v[j]] != undefined ? _this6.dealerLevelMap[v[j]] : '';\n          } else if (j === \"build_date\") {\n            if (v[j] && v[j] != undefined) {\n              return (0, _utils.parseTime)(v[j], \"{y}-{m}-{d} {h}:{i}\");\n            }\n            return \"\";\n          } else if (j == 'create_at' || j == 'expire_date') {\n            if (v[j] && v[j] != undefined) {\n              return (0, _utils.parseTime)(v[j], \"{y}-{m}-{d}\");\n            }\n            return \"\";\n          } else if (j == \"nowMonthAmisMoney\" || j == \"nowMonthMoney\" || j == \"nowYearAmisMoney\" || j == \"nowYearMoney\" || j == \"inventoryPrice\") {\n            return (0, _filters.priceNumFilter)(v[j]);\n          } else if (j == \"nowMonthPercent\" || j == \"nowYearPercent\") {\n            return v[j] + \"%\";\n          } else if (j == \"dealer_invite\") {\n            if (v.dealer_invite && v.dealer_invite.invite_user && v.dealer_invite.invite_user != undefined) {\n              return v.dealer_invite.invite_user.name;\n            } else {\n              return \"\";\n            }\n          } else {\n            return v[j];\n          }\n        });\n      });\n    },\n    showLoginModal: function showLoginModal(id) {\n      var _this7 = this;\n      this.$nextTick(function () {\n        _this7.$refs.loginModal.init(id);\n      });\n    }\n  }\n};",null]}