index.vue 12 KB

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