index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <view class="caseInfo_wrap">
  3. <template v-if="clueDetail.id">
  4. <view class="caseInfo_content_wrap">
  5. <view class="caseInfo_title">
  6. <image src="/static/clueDetail/icon-caseInfo.png" mode=""></image>
  7. <text class="info_text">线索基础信息</text>
  8. </view>
  9. <view class="caseInfo_main_wrap">
  10. <template v-if="params.type === '1'">
  11. <view class="Info_item" v-for="(item,index) in caseInfoColumn" :key="item.prop">
  12. <text class="label">{{item.label}}</text>
  13. <text v-if="item.color" class="value highlight" :style="handleStyle(item.color)">
  14. {{clueDetail[item.prop]}}
  15. </text>
  16. <show-real-text :real="clueDetail.telephone" :type='params.type'
  17. v-if="item.prop === 'telephone'"></show-real-text>
  18. <text v-else class="value">{{clueDetail[item.prop]}}</text>
  19. </view>
  20. </template>
  21. <template v-if="params.type === '2'">
  22. <view class="Info_item" v-for="(item,index) in caseInfoColumn" :key="item.prop">
  23. <text class="label">{{item.label}}</text>
  24. <view class="input_wrap" v-if="item.input">
  25. <input v-model="clueDetail[item.prop]" style="text-align: right; padding-right: 10px;"
  26. @blur="updateClueMainInfo" />
  27. </view>
  28. <text v-else-if="item.color" class="value highlight" :style="handleStyle(item.color)">
  29. {{clueDetail[item.prop]}}
  30. </text>
  31. <text v-else class="value">{{clueDetail[item.prop]}}</text>
  32. </view>
  33. </template>
  34. <template v-if="parsedRemarkDict && Object.keys(parsedRemarkDict).length > 0">
  35. <view class="Info_item" v-for="(value, key) in parsedRemarkDict" :key="key">
  36. <text class="label">{{ key }}</text>
  37. <text class="value">{{ value }}</text>
  38. </view>
  39. </template>
  40. </view>
  41. </view>
  42. </template>
  43. </view>
  44. </template>
  45. <script>
  46. import {
  47. cloneDeep,
  48. isEqual
  49. } from 'lodash';
  50. const caseInfoColumn = [{
  51. prop: 'name',
  52. label: '姓名',
  53. input: true
  54. },
  55. {
  56. prop: 'telephone',
  57. label: '电话',
  58. input: true
  59. },
  60. {
  61. prop: 'genderTypeCode',
  62. label: '性别',
  63. },
  64. {
  65. prop: 'age',
  66. label: '年龄',
  67. },
  68. {
  69. prop: 'weixin',
  70. label: '微信',
  71. input: true
  72. },
  73. {
  74. prop: 'corporateStatus',
  75. label: '企业号状态',
  76. },
  77. {
  78. prop: 'userDouyinId',
  79. label: '抖音号',
  80. },
  81. {
  82. prop: 'autoAddress',
  83. label: '自动定位城市',
  84. },
  85. {
  86. prop: 'telAddr',
  87. label: '手机号归属地',
  88. },
  89. {
  90. prop: 'createTime',
  91. label: '线索创建时间',
  92. },
  93. {
  94. prop: 'updateTime',
  95. label: '最新修改时间',
  96. },
  97. {
  98. prop: 'address',
  99. label: '详细地址',
  100. },
  101. {
  102. prop: 'remark',
  103. label: '备注',
  104. },
  105. {
  106. prop: 'qq',
  107. label: 'QQ号',
  108. },
  109. {
  110. prop: 'email',
  111. label: '邮箱',
  112. },
  113. {
  114. prop: 'date',
  115. label: '日期',
  116. },
  117. {
  118. prop: 'manualAddressCode',
  119. label: '手动填写地域',
  120. }
  121. ]
  122. export default {
  123. props: {
  124. clueId: {
  125. required: true
  126. },
  127. params: {
  128. type: Object,
  129. required: true
  130. },
  131. clueDetailVo : {
  132. type : Object,
  133. required : true
  134. },
  135. },
  136. computed : {
  137. parsedRemarkDict() {
  138. try {
  139. const remarkDict = this.clueDetailVo.remarkDict
  140. if (!remarkDict) {
  141. return null
  142. }
  143. if (typeof remarkDict === 'string') {
  144. const parsed = JSON.parse(remarkDict)
  145. return typeof parsed === 'object' && parsed !== null ? parsed : null
  146. }
  147. return typeof remarkDict === 'object' && remarkDict !== null ? remarkDict : null
  148. } catch (error) {
  149. console.error('解析remarkDict失败:', error)
  150. return null
  151. }
  152. }
  153. },
  154. methods: {
  155. async updateClueMainInfo() {
  156. if (!this.clueDetail.name) {
  157. uni.$u.toast("姓名不能为空");
  158. return;
  159. }
  160. if (!isEqual(this.cloneClueDetail, this.clueDetail)) {
  161. await uni.$u.api.updateClueMainInfo(this.clueDetail);
  162. uni.$u.toast("修改成功");
  163. this.getData();
  164. }
  165. },
  166. async getData() {
  167. const {
  168. data
  169. } = await uni.$u.api.getClueMainInfoById({
  170. id: this.clueId
  171. });
  172. this.clueDetail = data;
  173. this.cloneClueDetail = cloneDeep(data);
  174. }
  175. },
  176. created() {
  177. this.getData();
  178. },
  179. data() {
  180. return {
  181. cloneClueDetail: {},
  182. clueDetail: {},
  183. caseInfoColumn,
  184. }
  185. }
  186. }
  187. </script>
  188. <style lang="scss" scoped>
  189. .caseInfo_wrap {
  190. min-height: 400px;
  191. .caseInfo_title {
  192. display: flex;
  193. align-items: center;
  194. height: 80rpx;
  195. background: #f4f4f6;
  196. padding-left: 40rpx;
  197. image {
  198. width: 24rpx;
  199. height: 24rpx;
  200. margin-right: 10rpx;
  201. }
  202. .info_text {
  203. font-size: 24rpx;
  204. color: #202020;
  205. }
  206. .tabs_wrap {
  207. display: flex;
  208. .tab_item {
  209. margin-left: 30rpx;
  210. }
  211. }
  212. }
  213. .caseInfo_main_wrap {
  214. .caseCards_list_wrap {
  215. background: #ebf6ff;
  216. margin-bottom: 10rpx;
  217. margin-left: 10rpx;
  218. margin-right: 10rpx;
  219. }
  220. .Info_item {
  221. padding: 18rpx 40rpx;
  222. display: flex;
  223. justify-content: space-between;
  224. .label {
  225. color: #999999;
  226. font-size: 26rpx;
  227. }
  228. .input_wrap {
  229. border-bottom: 1px solid #ddd;
  230. }
  231. .value {
  232. font-size: 26rpx;
  233. color: #202020;
  234. border-radius: 100rpx;
  235. }
  236. .highlight {
  237. font-size: 22rpx;
  238. font-weight: 900;
  239. padding: 6rpx 20rpx;
  240. }
  241. }
  242. }
  243. }
  244. </style>