report-add.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <view class="container qualifications" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0' }">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. ></tui-skeleton>
  10. <view class="remarks-content" v-else>
  11. <template v-if="handleType === '1'">
  12. <view class="list-view-title">
  13. <view class="list-view-h1"
  14. >机构名称:<text class="none">{{ reportInfo.name }}</text></view
  15. >
  16. </view>
  17. <view class="list-view-title">
  18. <view class="list-view-h1"
  19. >联系人:<text class="none">{{ reportInfo.linkMan }}</text></view
  20. >
  21. </view>
  22. </template>
  23. <template v-else>
  24. <view class="list-view-title">
  25. <view class="list-view-h1"
  26. >咨询人:<text class="none">{{ reportInfo.questionMan }}</text></view
  27. >
  28. </view>
  29. </template>
  30. <view class="list-view-title"> <view class="list-view-h1">报备商品:</view> </view>
  31. <view class="tui-remarks-content">
  32. <view class="tui-remarks-goods-input" v-if="handleGoods.length === 0" @click="handleShowGoodPopup">
  33. <view class="input-add"> <text class="iconfont icon-jiahao"></text> </view>
  34. <view class="input-text"> 点击添加客户咨询的商品 </view>
  35. </view>
  36. <view class="tui-remarks-showgoods" v-else>
  37. <view class="tui-remarks-goods" v-for="(pros, index) in handleGoods" :key="index">
  38. <view class="goods-image"> <image :src="pros.image" mode=""></image> </view>
  39. <view class="goods-main">
  40. <view class="name"> {{ pros.name }} </view>
  41. <view class="shop"> 供应商:{{ pros.shopName }} </view>
  42. </view>
  43. </view>
  44. <view class="tui-remarks-btn">
  45. <view class="btn delete" @click="handleClean">删除</view>
  46. <view class="btn update" @click="handleShowGoodPopup">更换</view>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="list-view-title">
  51. <view class="list-view-h1"><text>*</text>报备事由:</view>
  52. </view>
  53. <view class="remarks-textarea">
  54. <textarea
  55. class="textarea"
  56. v-if="handleType==='1'"
  57. v-model="reportClubParams.reportText"
  58. value=""
  59. placeholder="请输入其他需要说明的内容"
  60. maxlength="200"
  61. @input="conInput"
  62. />
  63. <textarea
  64. class="textarea"
  65. v-if="handleType==='2'"
  66. v-model="reportParams.reportText"
  67. value=""
  68. placeholder="请输入其他需要说明的内容"
  69. maxlength="200"
  70. @input="conInput"
  71. />
  72. <text class="limit-text">{{ min }}/{{ max }}</text>
  73. </view>
  74. </view>
  75. <view class="remarks-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  76. <view class="edit-button" @click="editButtonConfim">确定</view>
  77. </view>
  78. <!-- 商品列表弹窗 -->
  79. <cm-goodspopup
  80. ref="cmgoodspopup"
  81. v-if="isGoodspopup"
  82. :show="isGoodspopup"
  83. @handleChoiceaGoods="handleChoiceaGoodsData"
  84. >
  85. </cm-goodspopup>
  86. </view>
  87. </template>
  88. <script>
  89. import { mapState, mapMutations } from 'vuex'
  90. import authorize from '@/common/config/authorize.js'
  91. import cmGoodspopup from '../components/cm-goods-popup'
  92. export default {
  93. components: {
  94. cmGoodspopup
  95. },
  96. data() {
  97. return {
  98. isIphoneX: this.$store.state.isIphoneX,
  99. min: 0,
  100. max: 200,
  101. reportText: '',
  102. skeletonShow: true,
  103. isGoodspopup: false,
  104. handleGoods: [],
  105. handleType: '', // 1 机构添加报备 2 未注册客户添加报备
  106. reportClubParams: {
  107. serviceProviderId: 0,
  108. clubId: 0,
  109. productId: 0,
  110. reportText: ''
  111. },
  112. reportParams: {
  113. questionManId: 0,
  114. productId: 0,
  115. reportText: ''
  116. },
  117. reportInfo: {}
  118. }
  119. },
  120. onLoad(option) {
  121. console.log(option)
  122. this.handleType = option.type
  123. this.reportInfo = JSON.parse(option.reportInfo)
  124. if (this.handleType === '1') {
  125. // 机构新增报备
  126. this.reportClubParams.clubId = this.reportInfo.clubId
  127. } else {
  128. this.reportParams.questionManId = this.reportInfo.questionManId
  129. }
  130. this.initStorage()
  131. this.skeletonShow = false
  132. },
  133. methods: {
  134. ...mapMutations(['login']),
  135. async initStorage() {
  136. const userInfo = await this.$api.getStorage()
  137. this.reportClubParams.serviceProviderId = userInfo.serviceProviderId
  138. },
  139. editButtonConfim() {
  140. // 确定提交保存
  141. switch (this.handleType) {
  142. case '1': // 机构报备保存
  143. if (this.reportClubParams.reportText == '') {
  144. this.$util.msg('请输入报备事由', 2000)
  145. return
  146. }
  147. this.userClubReportSave()
  148. break
  149. case '2': // 咨询人报备保存
  150. if (this.reportParams.reportText == '') {
  151. this.$util.msg('请输入报备事由', 2000)
  152. return
  153. }
  154. this.userReportVisitorSave()
  155. break
  156. }
  157. },
  158. userClubReportSave() {
  159. // 机构报备保存
  160. this.UserService.userClubReportSave(this.reportClubParams)
  161. .then(response => {
  162. this.$util.msg('保存成功', 3000, true, 'success')
  163. this.isConfirmLoding = false
  164. setTimeout(() => {
  165. uni.navigateBack({
  166. delta: 1
  167. })
  168. }, 1000)
  169. })
  170. .catch(error => {
  171. this.$util.msg(error.msg, 2000)
  172. this.isConfirmLoding = false
  173. })
  174. },
  175. userReportVisitorSave() {
  176. // 未注册客户报备保存
  177. this.UserService.userReportVisitorSave(this.reportParams)
  178. .then(response => {
  179. this.$util.msg('保存成功', 3000, true, 'success')
  180. this.isConfirmLoding = false
  181. setTimeout(() => {
  182. uni.navigateBack({
  183. delta: 1
  184. })
  185. }, 1000)
  186. })
  187. .catch(error => {
  188. this.$util.msg(error.msg, 2000)
  189. this.isConfirmLoding = false
  190. })
  191. },
  192. handleShowGoodPopup() {
  193. // 显示添加商品弹窗
  194. this.isGoodspopup = true
  195. },
  196. handleClean() {
  197. //删除选择的商品
  198. this.handleGoods = []
  199. },
  200. handleChoiceaGoodsData(data) {
  201. this.handleGoods = []
  202. this.reportClubParams.productId = this.reportParams.productId = data.productId
  203. this.handleGoods.push(data)
  204. console.log('handleGoods', this.handleGoods)
  205. },
  206. conInput(e) {
  207. //备注文字字数限制
  208. let value = e.detail.value
  209. let len = parseInt(value.length)
  210. if (len > this.max) return
  211. this.min = len
  212. if (this.min == 200) {
  213. this.$util.msg('您输入的字数已达上限', 2000)
  214. }
  215. }
  216. },
  217. onShow() {}
  218. }
  219. </script>
  220. <style lang="scss">
  221. page {
  222. height: auto;
  223. background: #ffffff;
  224. }
  225. .remarks-content {
  226. width: 100%;
  227. height: auto;
  228. box-sizing: border-box;
  229. padding: 0 24rpx;
  230. padding-bottom: 80rpx;
  231. .list-view-title {
  232. width: 100%;
  233. height: auto;
  234. margin-bottom: 16rpx;
  235. margin-top: 40rpx;
  236. .list-view-h1 {
  237. line-height: 40rpx;
  238. font-size: $font-size-30;
  239. color: #333333;
  240. text-align: left;
  241. font-weight: bold;
  242. text {
  243. color: #ff2a2a;
  244. &.none {
  245. color: #999999;
  246. font-weight: normal;
  247. }
  248. }
  249. }
  250. }
  251. .remarks-textarea {
  252. width: 100%;
  253. height: 226rpx;
  254. padding: 16rpx;
  255. margin: 20rpx 0 0 0;
  256. border-radius: 6rpx;
  257. position: relative;
  258. border: 1px solid #b2b2b2;
  259. box-sizing: border-box;
  260. .textarea {
  261. width: 100%;
  262. height: 100%;
  263. line-height: 36rpx;
  264. font-size: $font-size-26;
  265. color: $text-color;
  266. z-index: 1;
  267. }
  268. .limit-text {
  269. position: absolute;
  270. right: 20rpx;
  271. bottom: 16rpx;
  272. line-height: 44rpx;
  273. font-size: $font-size-24;
  274. color: #b2b2b2;
  275. }
  276. }
  277. .tui-remarks-content {
  278. width: 100%;
  279. height: auto;
  280. margin-bottom: 24rpx;
  281. .tui-remarks-goods-input {
  282. width: 100%;
  283. height: 180rpx;
  284. box-sizing: border-box;
  285. background-color: #f7f7f7;
  286. padding: 26rpx;
  287. border-radius: 6rpx;
  288. .input-add {
  289. width: 128rpx;
  290. height: 128rpx;
  291. line-height: 128rpx;
  292. float: left;
  293. text-align: center;
  294. box-sizing: border-box;
  295. border: 1px dashed #b2b2b2;
  296. border-radius: 6rpx;
  297. .iconfont {
  298. font-size: 44rpx;
  299. color: #b2b2b2;
  300. }
  301. }
  302. .input-text {
  303. height: 128rpx;
  304. box-sizing: border-box;
  305. padding: 0 32rpx;
  306. line-height: 128rpx;
  307. text-align: left;
  308. font-size: 26rpx;
  309. color: #b2b2b2;
  310. float: left;
  311. }
  312. }
  313. .tui-remarks-showgoods {
  314. width: 100%;
  315. height: 180rpx;
  316. box-sizing: border-box;
  317. .tui-remarks-btn {
  318. width: 90rpx;
  319. height: 180rpx;
  320. float: right;
  321. .btn {
  322. width: 100%;
  323. height: 90rpx;
  324. float: left;
  325. line-height: 90rpx;
  326. text-align: center;
  327. font-size: 26rpx;
  328. &.delete {
  329. color: #f94b4b;
  330. }
  331. &.update {
  332. color: #1890f9;
  333. }
  334. }
  335. }
  336. .tui-remarks-goods {
  337. width: 612rpx;
  338. height: 180rpx;
  339. box-sizing: border-box;
  340. background-color: #f7f7f7;
  341. padding: 26rpx;
  342. border-radius: 6rpx;
  343. float: left;
  344. .goods-image {
  345. width: 128rpx;
  346. height: 128rpx;
  347. float: left;
  348. image {
  349. width: 128rpx;
  350. height: 128rpx;
  351. display: block;
  352. border-radius: 4rpx;
  353. }
  354. }
  355. .goods-main {
  356. width: 432rpx;
  357. height: 128rpx;
  358. box-sizing: border-box;
  359. padding-left: 32rpx;
  360. float: right;
  361. .name {
  362. width: 100%;
  363. height: 60rpx;
  364. box-sizing: border-box;
  365. line-height: 60rpx;
  366. color: #333333;
  367. text-overflow: ellipsis;
  368. overflow: hidden;
  369. display: -webkit-box;
  370. -webkit-line-clamp: 1;
  371. line-clamp: 1;
  372. -webkit-box-orient: vertical;
  373. font-size: 26rpx;
  374. }
  375. .shop {
  376. line-height: 60rpx;
  377. color: #999999;
  378. font-size: 26rpx;
  379. text-overflow: ellipsis;
  380. overflow: hidden;
  381. display: -webkit-box;
  382. -webkit-line-clamp: 1;
  383. line-clamp: 1;
  384. -webkit-box-orient: vertical;
  385. }
  386. }
  387. }
  388. }
  389. }
  390. .list-view {
  391. width: 100%;
  392. height: auto;
  393. margin-top: 20rpx;
  394. .list-view-text {
  395. width: 100%;
  396. float: left;
  397. .input {
  398. width: 500rpx;
  399. height: 50rpx;
  400. box-sizing: border-box;
  401. line-height: 50rpx;
  402. color: #333333;
  403. text-overflow: ellipsis;
  404. overflow: hidden;
  405. display: -webkit-box;
  406. -webkit-line-clamp: 1;
  407. line-clamp: 1;
  408. -webkit-box-orient: vertical;
  409. float: left;
  410. font-size: 26rpx;
  411. }
  412. .delbtn {
  413. width: 96rpx;
  414. height: 44rpx;
  415. border-radius: 8rpx;
  416. font-size: $font-size-24;
  417. color: #FF5B00;
  418. line-height: 44rpx;
  419. text-align: center;
  420. float: left;
  421. &.down {
  422. color: #1890f9;
  423. }
  424. }
  425. }
  426. }
  427. }
  428. .remarks-btn {
  429. width: 100%;
  430. padding-top: 20rpx;
  431. position: fixed;
  432. bottom: 0;
  433. left: 0;
  434. background-color: #ffffff;
  435. z-index: 99;
  436. .edit-button-canel {
  437. width: 100%;
  438. height: 88rpx;
  439. line-height: 88rpx;
  440. text-align: center;
  441. color: #FF5B00;
  442. font-size: $font-size-24;
  443. }
  444. .edit-button {
  445. width: 600rpx;
  446. height: 90rpx;
  447. background: $btn-confirm;
  448. line-height: 90rpx;
  449. text-align: center;
  450. color: #ffffff;
  451. font-size: $font-size-30;
  452. margin: 0 auto;
  453. border-radius: 45rpx;
  454. }
  455. }
  456. </style>