{"remainingRequest":"/data/jenkins/workspace/mer.mall2.baibaodun.cn/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/mer.mall2.baibaodun.cn/src/views/marketing/broadcast/room/creatRoom.vue?vue&type=script&lang=js","dependencies":[{"path":"/data/jenkins/workspace/mer.mall2.baibaodun.cn/src/views/marketing/broadcast/room/creatRoom.vue","mtime":1720764823960},{"path":"/data/jenkins/workspace/mer.mall2.baibaodun.cn/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/data/jenkins/workspace/mer.mall2.baibaodun.cn/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/mer.mall2.baibaodun.cn/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\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//\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// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权\n// +----------------------------------------------------------------------\n// | Author: CRMEB Team \n// +----------------------------------------------------------------------\nimport {\n liveMediaUploadlocalApi,\n liveRoomCreateApi,\n liveRoomInfoApi,\n liveRoomGoodslistApi,\n liveRoomGoodsonsaleApi,\n liveRoomDeletegoodsinroomApi,\n liveRoomEditApi,\n} from '@/api/marketing';\nexport default {\n name: 'CreatCoupon',\n data() {\n return {\n pickerOptions0: {\n disabledDate(time) {\n return time.getTime() < Date.now() - 8.64e7;\n },\n },\n pickerOptions: {\n disabledDate(time) {\n let curDate = new Date().getTime();\n let three = 180 * 24 * 3600 * 1000;\n let threeMonths = curDate - three;\n return time.getTime() > Date.now() || time.getTime() < threeMonths;\n },\n },\n tableData: {\n data: [],\n total: 0,\n },\n formData: {\n roomName: '',\n coverImg: '',\n startTime: '',\n endTime: '',\n anchorName: '',\n anchorWechat: '',\n subAnchorWechat: '',\n createrWechat: '',\n shareImg: '',\n feedsImg: '',\n isFeedsPublic: 1,\n type: 0,\n closeLike: 0,\n closeGoods: 0,\n closeComment: 0,\n closeReplay: 1,\n closeShare: 0,\n closeKf: 1,\n timeVal: [],\n coverImgLocal: '',\n feedsImgLocal: '',\n shareImgLocal: '',\n id: null,\n },\n listLoading: false,\n rules: {\n roomName: [\n { required: true, message: '请输入直播间名称', trigger: 'blur' },\n { min: 3, max: 17, message: '最短3个汉字,最长17个汉字,1个汉字相当于2个字符', trigger: 'blur' },\n ],\n anchorName: [\n { required: true, message: '请输入直播间名称', trigger: 'blur' },\n { min: 2, max: 15, message: '最短2个汉字,最长15个汉字,1个汉字相当于2个字符', trigger: 'blur' },\n ],\n anchorWechat: [{ required: true, message: '请输入主播微信号', trigger: 'blur' }],\n coverImgLocal: [{ required: true, message: '请选择上传背景图', trigger: 'change' }],\n feedsImgLocal: [{ required: true, message: '请上传频道封面图', trigger: 'change' }],\n shareImgLocal: [{ required: true, message: '请上传分享图', trigger: 'change' }],\n timeVal: [{ type: 'array', required: true, message: '请选择时间', trigger: 'change' }],\n tempRoute: {},\n },\n };\n },\n created() {\n this.tempRoute = Object.assign({}, this.$route);\n },\n computed: {\n //判断是否是详情\n isDetail() {\n return this.$route.params.type ? true : false;\n },\n },\n mounted() {\n this.setTagsViewTitle();\n if (this.$route.params.roomId) {\n this.getInfo();\n }\n },\n methods: {\n setTagsViewTitle() {\n const title = this.$route.params.roomId ? (this.isDetail ? '直播间详情' : '编辑直播间') : '添加直播间';\n const route = Object.assign({}, this.tempRoute, {\n title: this.$route.params.roomId ? `${title}-${this.$route.params.roomId}` : `${title}`,\n });\n this.$store.dispatch('tagsView/updateVisitedView', route);\n },\n // 上下架 goodsId, roomId 取的是微信返回的id\n onchangeIsShow(row) {\n liveRoomGoodsonsaleApi({ goodsId: row.goodsId, roomId: this.formData.roomId, onSale: row.onSale }).then(() => {\n this.$message.success('操作成功');\n if (this.isDetail) this.getList();\n });\n },\n // 删除goodsId取的是微信返回的id\n handleDelete(item, idx) {\n this.$modalSure('删除该直播商品吗?').then(() => {\n liveRoomDeletegoodsinroomApi(this.$route.params.roomId, item.goodsId).then(() => {\n this.$message.success('删除成功');\n if (this.isDetail) this.getList();\n });\n });\n },\n //详情\n getInfo() {\n this.listLoading = true;\n liveRoomInfoApi(this.$route.params.roomId)\n .then(async (res) => {\n if (res) {\n let info = JSON.parse(JSON.stringify(res));\n this.formData = info;\n this.formData.startTime = info.startTime;\n this.formData.endTime = info.endTime;\n this.formData.timeVal = [info.startTime, info.endTime];\n if (this.isDetail) this.getList();\n }\n this.listLoading = false;\n })\n .catch((res) => {\n this.listLoading = false;\n });\n },\n // 点击商品图\n modalPicTap(num, tit) {\n const _this = this;\n if (_this.isDetail) return;\n this.$modalUpload(\n async function (img) {\n if (img) {\n _this.formData[tit] = img[0].sattDir;\n switch (tit) {\n case 'coverImgLocal':\n _this.formData.coverImg = await _this.getImgData(_this.formData[tit]);\n break;\n case 'feedsImgLocal':\n _this.formData.feedsImg = await _this.getImgData(_this.formData[tit]);\n break;\n default:\n _this.formData.shareImg = await _this.getImgData(_this.formData[tit]);\n }\n }\n },\n num,\n 'content',\n );\n },\n // 传入图片地址调接口,获取到微信mediaId码\n getImgData(file) {\n return new Promise((resolve, reject) => {\n liveMediaUploadlocalApi({ imagePath: file, type: 'image' }).then((res) => {\n resolve(res.mediaId);\n });\n });\n },\n // 具体日期\n onchangeTime(e) {\n this.$set(this.formData, 'timeVal', e);\n },\n submitForm(formName) {\n this.$refs[formName].validate((valid) => {\n if (valid) {\n this.formData.startTime = this.formData.timeVal ? this.formData.timeVal[0] : '';\n this.formData.endTime = this.formData.timeVal ? this.formData.timeVal[1] : '';\n if (this.$route.params.roomId) this.formData.id = this.$route.params.roomId;\n this.$route.params.roomId\n ? liveRoomEditApi(this.formData)\n .then((res) => {\n this.$message.success('编辑成功');\n this.$router.push({ path: `/marketing/broadcast/room` });\n })\n .catch(() => {\n this.btnLoading = false;\n })\n : liveRoomCreateApi(this.formData)\n .then((res) => {\n this.$message.success('添加成功');\n this.$router.push({ path: `/marketing/broadcast/room` });\n })\n .catch(() => {\n this.btnLoading = false;\n });\n } else {\n console.log('error submit!!');\n return false;\n }\n });\n },\n // 直播间商品列表\n getList() {\n liveRoomGoodslistApi(this.$route.params.roomId).then((res) => {\n this.tableData.data = res;\n });\n },\n },\n};\n",null]}