report-add.vue 9.6 KB

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