report-add.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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-module/cm-seller/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. this.userClubReportSave()
  144. break
  145. case '2': // 咨询人报备保存
  146. this.userReportVisitorSave()
  147. break
  148. }
  149. },
  150. userClubReportSave() {
  151. // 机构报备保存
  152. this.UserService.userClubReportSave(this.reportClubParams)
  153. .then(response => {
  154. this.$util.msg('保存成功', 3000, true, 'success')
  155. this.isConfirmLoding = false
  156. setTimeout(() => {
  157. uni.navigateBack({
  158. delta: 1
  159. })
  160. }, 1000)
  161. })
  162. .catch(error => {
  163. this.$util.msg(error.msg, 2000)
  164. this.isConfirmLoding = false
  165. })
  166. },
  167. userReportVisitorSave() {
  168. // 未注册客户报备保存
  169. this.UserService.userReportVisitorSave(this.reportParams)
  170. .then(response => {
  171. this.$util.msg('保存成功', 3000, true, 'success')
  172. this.isConfirmLoding = false
  173. setTimeout(() => {
  174. uni.navigateBack({
  175. delta: 1
  176. })
  177. }, 1000)
  178. })
  179. .catch(error => {
  180. this.$util.msg(error.msg, 2000)
  181. this.isConfirmLoding = false
  182. })
  183. },
  184. handleShowGoodPopup() {
  185. // 显示添加商品弹窗
  186. this.isGoodspopup = true
  187. },
  188. handleClean() {
  189. //删除选择的商品
  190. this.handleGoods = []
  191. },
  192. handleChoiceaGoodsData(data) {
  193. this.handleGoods = []
  194. this.reportClubParams.productId = this.reportParams.productId = data.productId
  195. this.handleGoods.push(data)
  196. console.log('handleGoods', this.handleGoods)
  197. },
  198. conInput(e) {
  199. //备注文字字数限制
  200. let value = e.detail.value
  201. let len = parseInt(value.length)
  202. if (len > this.max) return
  203. this.min = len
  204. if (this.min == 200) {
  205. this.$util.msg('您输入的字数已达上限', 2000)
  206. }
  207. }
  208. },
  209. onShow() {}
  210. }
  211. </script>
  212. <style lang="scss">
  213. page {
  214. height: auto;
  215. background: #ffffff;
  216. }
  217. .remarks-content {
  218. width: 100%;
  219. height: auto;
  220. box-sizing: border-box;
  221. padding: 0 24rpx;
  222. padding-bottom: 80rpx;
  223. .list-view-title {
  224. width: 100%;
  225. height: auto;
  226. margin-bottom: 16rpx;
  227. margin-top: 40rpx;
  228. .list-view-h1 {
  229. line-height: 40rpx;
  230. font-size: $font-size-30;
  231. color: #333333;
  232. text-align: left;
  233. font-weight: bold;
  234. text {
  235. color: #ff2a2a;
  236. &.none {
  237. color: #999999;
  238. font-weight: normal;
  239. }
  240. }
  241. }
  242. }
  243. .remarks-textarea {
  244. width: 100%;
  245. height: 226rpx;
  246. padding: 16rpx;
  247. margin: 20rpx 0 0 0;
  248. border-radius: 6rpx;
  249. position: relative;
  250. border: 1px solid #b2b2b2;
  251. box-sizing: border-box;
  252. .textarea {
  253. width: 100%;
  254. height: 100%;
  255. line-height: 36rpx;
  256. font-size: $font-size-26;
  257. color: $text-color;
  258. z-index: 1;
  259. }
  260. .limit-text {
  261. position: absolute;
  262. right: 20rpx;
  263. bottom: 16rpx;
  264. line-height: 44rpx;
  265. font-size: $font-size-24;
  266. color: #b2b2b2;
  267. }
  268. }
  269. .tui-remarks-content {
  270. width: 100%;
  271. height: auto;
  272. margin-bottom: 24rpx;
  273. .tui-remarks-goods-input {
  274. width: 100%;
  275. height: 180rpx;
  276. box-sizing: border-box;
  277. background-color: #f7f7f7;
  278. padding: 26rpx;
  279. border-radius: 6rpx;
  280. .input-add {
  281. width: 128rpx;
  282. height: 128rpx;
  283. line-height: 128rpx;
  284. float: left;
  285. text-align: center;
  286. box-sizing: border-box;
  287. border: 1px dashed #b2b2b2;
  288. border-radius: 6rpx;
  289. .iconfont {
  290. font-size: 44rpx;
  291. color: #b2b2b2;
  292. }
  293. }
  294. .input-text {
  295. height: 128rpx;
  296. box-sizing: border-box;
  297. padding: 0 32rpx;
  298. line-height: 128rpx;
  299. text-align: left;
  300. font-size: 26rpx;
  301. color: #b2b2b2;
  302. float: left;
  303. }
  304. }
  305. .tui-remarks-showgoods {
  306. width: 100%;
  307. height: 180rpx;
  308. box-sizing: border-box;
  309. .tui-remarks-btn {
  310. width: 90rpx;
  311. height: 180rpx;
  312. float: right;
  313. .btn {
  314. width: 100%;
  315. height: 90rpx;
  316. float: left;
  317. line-height: 90rpx;
  318. text-align: center;
  319. font-size: 26rpx;
  320. &.delete {
  321. color: #f94b4b;
  322. }
  323. &.update {
  324. color: #1890f9;
  325. }
  326. }
  327. }
  328. .tui-remarks-goods {
  329. width: 612rpx;
  330. height: 180rpx;
  331. box-sizing: border-box;
  332. background-color: #f7f7f7;
  333. padding: 26rpx;
  334. border-radius: 6rpx;
  335. float: left;
  336. .goods-image {
  337. width: 128rpx;
  338. height: 128rpx;
  339. float: left;
  340. image {
  341. width: 128rpx;
  342. height: 128rpx;
  343. display: block;
  344. border-radius: 4rpx;
  345. }
  346. }
  347. .goods-main {
  348. width: 432rpx;
  349. height: 128rpx;
  350. box-sizing: border-box;
  351. padding-left: 32rpx;
  352. float: right;
  353. .name {
  354. width: 100%;
  355. height: 60rpx;
  356. box-sizing: border-box;
  357. line-height: 60rpx;
  358. color: #333333;
  359. text-overflow: ellipsis;
  360. overflow: hidden;
  361. display: -webkit-box;
  362. -webkit-line-clamp: 1;
  363. line-clamp: 1;
  364. -webkit-box-orient: vertical;
  365. font-size: 26rpx;
  366. }
  367. .shop {
  368. line-height: 60rpx;
  369. color: #999999;
  370. font-size: 26rpx;
  371. text-overflow: ellipsis;
  372. overflow: hidden;
  373. display: -webkit-box;
  374. -webkit-line-clamp: 1;
  375. line-clamp: 1;
  376. -webkit-box-orient: vertical;
  377. }
  378. }
  379. }
  380. }
  381. }
  382. .list-view {
  383. width: 100%;
  384. height: auto;
  385. margin-top: 20rpx;
  386. .list-view-text {
  387. width: 100%;
  388. float: left;
  389. .input {
  390. width: 500rpx;
  391. height: 50rpx;
  392. box-sizing: border-box;
  393. line-height: 50rpx;
  394. color: #333333;
  395. text-overflow: ellipsis;
  396. overflow: hidden;
  397. display: -webkit-box;
  398. -webkit-line-clamp: 1;
  399. line-clamp: 1;
  400. -webkit-box-orient: vertical;
  401. float: left;
  402. font-size: 26rpx;
  403. }
  404. .delbtn {
  405. width: 96rpx;
  406. height: 44rpx;
  407. border-radius: 8rpx;
  408. font-size: $font-size-24;
  409. color: #e15616;
  410. line-height: 44rpx;
  411. text-align: center;
  412. float: left;
  413. &.down {
  414. color: #1890f9;
  415. }
  416. }
  417. }
  418. }
  419. }
  420. .remarks-btn {
  421. width: 100%;
  422. padding-top: 20rpx;
  423. position: fixed;
  424. bottom: 0;
  425. left: 0;
  426. background-color: #ffffff;
  427. z-index: 99;
  428. .edit-button-canel {
  429. width: 100%;
  430. height: 88rpx;
  431. line-height: 88rpx;
  432. text-align: center;
  433. color: #e15616;
  434. font-size: $font-size-24;
  435. }
  436. .edit-button {
  437. width: 600rpx;
  438. height: 90rpx;
  439. background: $btn-confirm;
  440. line-height: 90rpx;
  441. text-align: center;
  442. color: #ffffff;
  443. font-size: $font-size-30;
  444. margin: 0 auto;
  445. border-radius: 45rpx;
  446. }
  447. }
  448. </style>