activityEdit.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <view class="addactiyity-container">
  3. <van-form>
  4. <van-field
  5. :value="formatRsLable(formData.selectResearchers[0].researcherId)"
  6. is-link
  7. readonly
  8. clickable
  9. name="picker"
  10. label="研究员"
  11. type="textarea"
  12. rows="1"
  13. autosize
  14. placeholder="选择研究员"
  15. @click.native="clickRsChoose(0,'raiEdit')"
  16. />
  17. <van-field
  18. :value="formatterLabelTime(formData.selectResearchers[0].startTime)"
  19. is-link
  20. readonly
  21. clickable
  22. name="datetimePicker"
  23. label="开始时间"
  24. placeholder="选择开始时间"
  25. @click.native="clickTimeChoose(0, 'start')"
  26. />
  27. <van-field
  28. :value="formatterLabelTime(formData.selectResearchers[0].endTime)"
  29. is-link
  30. readonly
  31. clickable
  32. name="datetimePicker"
  33. label="结束时间"
  34. placeholder="选择结束时间"
  35. @click.native="clickTimeChoose(0, 'end')"
  36. />
  37. <van-field
  38. :value="formData.activityType"
  39. is-link
  40. readonly
  41. clickable
  42. name="picker"
  43. label="活动类型"
  44. placeholder="选择活动类型"
  45. disabled
  46. />
  47. <van-field
  48. :value="formData.roadshowType"
  49. v-if="['路演', '公开会议', '沙龙'].includes(formData.activityType)"
  50. is-link
  51. readonly
  52. clickable
  53. name="picker"
  54. :label="`${dynamic_prefix}形式`"
  55. :placeholder="`选择${dynamic_prefix}形式`"
  56. @click.native="isRoadshowTypePicker = true"
  57. />
  58. <van-field
  59. :value="formData.roadshowPlatform"
  60. v-if="['路演', '公开会议', '沙龙'].includes(formData.activityType) && formData.roadshowType === '线上'"
  61. clickable
  62. :label="`${dynamic_prefix}平台`"
  63. :placeholder="`输入${dynamic_prefix}平台(eg:进门财经、腾讯会议)`"
  64. @change="bindInputHandle('roadshowPlatform', $event)"
  65. />
  66. <van-field
  67. :value="formData.roadshowCity"
  68. v-if="['路演', '公开会议', '沙龙'].includes(formData.activityType) && formData.roadshowType === '线下'"
  69. is-link
  70. readonly
  71. clickable
  72. :label="`${dynamic_prefix}城市`"
  73. :placeholder="`选择${dynamic_prefix}城市`"
  74. @click.native="clickAreaChoose"
  75. />
  76. <van-field :value="formData.companyName" v-if="['路演'].includes(formData.activityType)" is-link readonly clickable label="客户名称" placeholder="客户名称" @click.native="goSearchCompany" />
  77. <view class="company-info" v-if="formData.activityType === '路演' && formData.companyId && companyInfo">
  78. <!-- 权益角色看权益信息 -->
  79. <template>
  80. <p>客户状态:{{ companyInfo.Status }}</p>
  81. <p>所属行业:{{ companyInfo.IndustryName }}</p>
  82. <p>行业权限:{{ companyInfo.PermissionName }}</p>
  83. <p>累计互动次数:{{ companyInfo.ReportReadTotal }}</p>
  84. </template>
  85. </view>
  86. <van-field
  87. :value="formData.meetingTheme"
  88. v-if="['公开会议', '沙龙'].includes(formData.activityType)"
  89. clickable
  90. label="会议主题"
  91. type="textarea"
  92. rows="1"
  93. autosize
  94. placeholder="请输入会议主题"
  95. @change="bindInputHandle('meetingTheme', $event)"
  96. />
  97. <van-field
  98. :value="formData.partnersName"
  99. v-if="['公开会议'].includes(formData.activityType)"
  100. clickable
  101. label="合作方名称"
  102. type="textarea"
  103. rows="1"
  104. autosize
  105. placeholder="请输入合作方名称(多个合作方用','隔开)"
  106. @change="bindInputHandle('partnersName', $event)"
  107. />
  108. <van-field
  109. :value="formData.activityClass"
  110. v-if="['报告电话会'].includes(formData.activityType)"
  111. is-link
  112. readonly
  113. clickable
  114. label="活动类别"
  115. placeholder="请选择活动类别"
  116. @click.native="isActivityClassPicker = true"
  117. />
  118. <!-- 追加后的研究员 -->
  119. <view class="add-user-list" v-for="addindex in addResearchersIdx" :key="addindex" v-if="addResearchersIdx.length">
  120. <view class="del-cont" @click="delResearcherHandle(addindex)">
  121. <van-icon name="close" />
  122. </view>
  123. <van-field
  124. :value="formatRsLable(formData.selectResearchers[addindex].researcherId)"
  125. is-link
  126. readonly
  127. clickable
  128. name="picker"
  129. label="研究员"
  130. placeholder="选择研究员"
  131. @click.native="clickRsChoose(addindex)"
  132. :disabled="edit_id"
  133. />
  134. <van-field
  135. :value="formatterLabelTime(formData.selectResearchers[addindex].startTime)"
  136. is-link
  137. readonly
  138. clickable
  139. name="datetimePicker"
  140. label="开始时间"
  141. placeholder="选择开始时间"
  142. :formatter="formatterLabelTime"
  143. @click.native="clickTimeChoose(addindex, 'start')"
  144. />
  145. <van-field
  146. :value="formatterLabelTime(formData.selectResearchers[addindex].endTime)"
  147. is-link
  148. readonly
  149. clickable
  150. name="datetimePicker"
  151. label="结束时间"
  152. placeholder="选择结束时间"
  153. :formatter="formatterLabelTime"
  154. @click.native="clickTimeChoose(addindex, 'end')"
  155. />
  156. </view>
  157. <view class="add-user-btn" @click="addResearcherHandle" v-if="['路演'].includes(formData.activityType)"> <van-icon name="add-o" />添加研究员 </view>
  158. </van-form>
  159. <div class="submit-bot">
  160. <van-button type="primary" plain color="#3385FF" class="btn" size="small" block round @click="cancelHandle">取消</van-button>
  161. <van-button type="primary" color="#3385FF" class="btn" size="small" block round @click="submitHandle">确定</van-button>
  162. </div>
  163. <!-- 选择活动类型 -->
  164. <van-popup :show="isActivityPicker" position="bottom">
  165. <van-picker show-toolbar :columns="activiytyTypes" :default-index="activiytyTypes.indexOf(formData.activityType)" @confirm="confirmActivityType" @cancel="isActivityPicker = false" />
  166. </van-popup>
  167. <!-- 选择活动类别 -->
  168. <van-popup :show="isActivityClassPicker" position="bottom">
  169. <van-picker show-toolbar :columns="telTypeList" :default-index="telTypeList.indexOf(formData.activityClass)" @confirm="confirmActivityClass" @cancel="isActivityClassPicker = false" />
  170. </van-popup>
  171. <!-- 选择路演形式 -->
  172. <van-popup :show="isRoadshowTypePicker" position="bottom">
  173. <van-picker show-toolbar :columns="['线上', '线下']" :default-index="['线上', '线下'].indexOf(formData.roadshowType)" @confirm="confirmRoadshowType" @cancel="isRoadshowTypePicker = false" />
  174. </van-popup>
  175. <!-- 选择研究员 -->
  176. <van-popup :show="isResearcherPicker" position="bottom">
  177. <!-- 内部会议可多选研究员,且只有ficc会有内部会议 -->
  178. <template v-if="!['路演', '沙龙','公开会议'].includes(formData.activityType)">
  179. <view class="select-rs-header">
  180. <text class="cancel" @click="cancelResearcher">取消</text>
  181. <text class="ensure" @click="confirmResearcher">确认</text>
  182. </view>
  183. <van-tree-select :items="ficcReasearcherList" :main-active-index="rs_picker.firstindex" :active-id="rs_picker.id" @click-nav="clickFirstHandle" @click-item="clickItemHandle" />
  184. </template>
  185. <template v-else>
  186. <van-cascader
  187. v-if="isResearcherPicker"
  188. v-model="this.formData.selectResearchers[this.selectRsIndex].researcherId"
  189. title="请选择研究员"
  190. active-color="#3385FF"
  191. :options="researcherList"
  192. @close="isResearcherPicker = false"
  193. @finish="chooseResearcher"
  194. />
  195. </template>
  196. </van-popup>
  197. <!-- 选择时间 -->
  198. <van-popup :show="isTimePicker" position="bottom">
  199. <van-datetime-picker
  200. :value="pickerForm.time"
  201. type="datetime"
  202. :formatter="formatterPickerTime"
  203. @confirm="confirmTime"
  204. @cancel="
  205. () => {
  206. isTimePicker = false;
  207. pickerForm.time = '';
  208. }
  209. "
  210. />
  211. </van-popup>
  212. <!-- 选择地区 -->
  213. <van-popup :show="isAreaPicker" position="bottom">
  214. <van-area :value="pickerForm.area" :area-list="areaList" :columns-num="isRaiRole ? 3 : 2" @confirm="confirmArea" @cancel="isAreaPicker = false" />
  215. </van-popup>
  216. </view>
  217. </template>
  218. <script>
  219. import { addActivity, editActivity } from "@/api/roadshow/index.js";
  220. import { getDefaultOption } from "./common.js";
  221. import mixin from "./mixin.js";
  222. const moment = require("../utils/_moment.js");
  223. moment.locale("zh-cn");
  224. export default {
  225. mixins: [mixin],
  226. data() {
  227. return {};
  228. },
  229. methods: {
  230. /* 设置默认状态 */
  231. initSetState(options) {
  232. const { RoleTypeCode } = JSON.parse(uni.getStorageSync("userInfo")) || null;
  233. const { defaultActivityType, activityTypeList, startTime, endTime } = getDefaultOption(RoleTypeCode, 2);
  234. this.activiytyTypes = activityTypeList;
  235. this.formData.activityType = defaultActivityType;
  236. this.formData.selectResearchers = [
  237. {
  238. researcherId: "",
  239. startTime: startTime,
  240. endTime: endTime,
  241. },
  242. ];
  243. if (this.isRaiRole) {
  244. this.formData.activityType = "路演";
  245. } /* else{
  246. delete this.areaList.county_list
  247. } */
  248. /* 编辑时回显表单 */
  249. if (options.edit_id) {
  250. const { form, edit_id, edit_rs_id } = options;
  251. this.formData = { ...this.formData, ...JSON.parse(form) };
  252. this.edit_id = Number(edit_id);
  253. this.edit_rs_id = Number(edit_rs_id);
  254. }
  255. console.log(this.formData);
  256. uni.setNavigationBarTitle({
  257. title: this.edit_id ? "修改活动" : "添加活动",
  258. });
  259. },
  260. },
  261. onLoad(options) {
  262. this.initSetState(options);
  263. this.getOpenerEventChannel().on("emitBackData", (data) => {
  264. this.initSetState(data);
  265. });
  266. },
  267. onShow() {
  268. this.getResearcherList();
  269. this.getTelType();
  270. if (uni.getStorageSync("roadshow_compantyId")) {
  271. this.formData.companyId = Number(uni.getStorageSync("roadshow_compantyId"));
  272. this.formData.englishCompany = Number(uni.getStorageSync("roadshow_isEnglishCompany"));
  273. this.getCompanyInfo();
  274. uni.removeStorageSync("roadshow_compantyId");
  275. uni.removeStorageSync("roadshow_isEnglishCompany");
  276. }
  277. },
  278. };
  279. </script>
  280. <style lang="scss" scoped>
  281. .addactiyity-container {
  282. padding-bottom: 200rpx;
  283. .add-user-btn {
  284. background-color: #fff;
  285. margin-top: 20rpx;
  286. padding: 20rpx 0;
  287. color: #3385ff;
  288. display: flex;
  289. align-items: center;
  290. justify-content: center;
  291. }
  292. .del-cont {
  293. font-size: 50rpx;
  294. color: #f00;
  295. display: flex;
  296. justify-content: flex-end;
  297. padding: 10rpx 30rpx;
  298. }
  299. .submit-bot {
  300. position: fixed;
  301. left: 0;
  302. right: 0;
  303. bottom: 0;
  304. z-index: 99;
  305. height: 140rpx;
  306. padding: 0 150rpx;
  307. background-color: #fff;
  308. display: flex;
  309. align-items: center;
  310. justify-content: center;
  311. padding-bottom: constant(safe-area-inset-bottom);
  312. padding-bottom: env(safe-area-inset-bottom);
  313. box-shadow: 0px -2px 6px rgba(110, 119, 141, 0.07);
  314. .btn {
  315. // width: 100%;
  316. width: 260rpx;
  317. height: 60rpx;
  318. margin-right: 30rpx;
  319. }
  320. }
  321. .select-rs-header {
  322. display: flex;
  323. align-items: center;
  324. justify-content: space-between;
  325. padding: 30rpx 20rpx;
  326. .cancel {
  327. color: #969799;
  328. }
  329. .ensure {
  330. color: #576b95;
  331. }
  332. }
  333. }
  334. </style>
  335. <style lang="scss">
  336. .addactiyity-container {
  337. .van-tree-select {
  338. .van-tree-select__item--active {
  339. color: #1989fa !important;
  340. }
  341. .van-sidebar-item--selected {
  342. border-color: #1989fa !important;
  343. }
  344. }
  345. .van-tree-select__item {
  346. font-weight: normal;
  347. }
  348. .company-info {
  349. background: #d5e6ff;
  350. padding: 10rpx 30rpx;
  351. margin-bottom: 20rpx;
  352. view {
  353. margin: 12rpx 0;
  354. color: #666;
  355. text-indent: -140rpx;
  356. margin-left: 140rpx;
  357. }
  358. }
  359. }
  360. </style>