details.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view style="">
  3. <u-cell-group :border="false">
  4. <u-cell :border="false" center title="客户信息" arrow-direction="down">
  5. <view slot="icon" style="width: 10rpx;height: 35rpx;background-color: #fd4b09;"></view>
  6. </u-cell>
  7. </u-cell-group>
  8. <view style="padding: 0 6px;">
  9. <uni-table border stripe emptyText="暂无更多数据">
  10. <uni-tr>
  11. <uni-th align="center" width='50'>行号</uni-th>
  12. <uni-th align="center" width='100'>联系人</uni-th>
  13. <uni-th align="center" width='160'>电话</uni-th>
  14. </uni-tr>
  15. <uni-tr v-for="(item,index) in corpsAttnList" :key="index">
  16. <uni-td align="center">{{index+1}}</uni-td>
  17. <uni-td align="center">{{item.cname}}</uni-td>
  18. <uni-td align="center">{{item.tel}}</uni-td>
  19. </uni-tr>
  20. </uni-table>
  21. <u-cell-group :border="false">
  22. <u-cell :border="false" center title="拜访记录" arrow-direction="down">
  23. <view slot="icon" style="width: 10rpx;height: 35rpx;background-color: #fd4b09;"></view>
  24. </u-cell>
  25. </u-cell-group>
  26. <view class="content" style="padding-bottom: 60px;">
  27. <view class="contentBox" v-for="(item,index) in corpsVisitList" :key="index">
  28. <view style="width: 100%;margin: 0 auto;">
  29. <u-cell-group :border="false" class="cellClass">
  30. <u-cell :border="false" center :title="item.visitPeopleName">
  31. <view slot="icon" style="width: 10rpx;height: 35rpx;background-color: #fd4b09;"></view>
  32. <u-icon slot="right-icon" name="edit-pen" @click="inputDialogToggle(item)"></u-icon>
  33. </u-cell>
  34. <u-cell :border="false" center title="时间" :value="item.visitDate">
  35. </u-cell>
  36. <u-cell :border="false" center title="定位" :label="item.address">
  37. </u-cell>
  38. <u-cell :border="false" center title="内容" :label="item.content">
  39. </u-cell>
  40. </u-cell-group>
  41. </view>
  42. </view>
  43. </view>
  44. <u-button class="fixed-bottom-btn" type="primary" text="创建拜访记录" @click="inputDialogToggle"></u-button>
  45. <!-- <uni-popup ref="inputDialog" type="dialog" :mask-click="false">
  46. <uni-popup-dialog ref="inputClose" mode="input" title="请输入内容" :value="content" placeholder="请输入内容"
  47. @confirm="dialogInputConfirm" @close="dialogClose"></uni-popup-dialog>
  48. </uni-popup> -->
  49. <u-modal :show="showDialog" showCancelButton confirmText='保存' title='请输入内容' negativeTop='300'
  50. @confirm="dialogInputConfirm" @cancel="dialogClose">
  51. <view style="width: 100%;" slots='default'>
  52. <u--textarea v-model="content" placeholder="请输入内容"></u--textarea>
  53. </view>
  54. </u-modal>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import {
  60. getDetail,
  61. submit
  62. } from '@/api/views/customerAnalysis/index.js'
  63. export default {
  64. data() {
  65. return {
  66. showDialog: false,
  67. form: {},
  68. obj: {},
  69. content: null,
  70. dimension: null,
  71. longitude: null,
  72. address: null,
  73. corpsAttnList: [],
  74. corpsVisitList: [],
  75. }
  76. },
  77. onLoad(data) {
  78. this.getDetails(data.id)
  79. let _this = this
  80. uni.getLocation({
  81. type: 'gcj02',
  82. altitude: true,
  83. geocode: true,
  84. isHighAccuracy: true,
  85. success: function(res) {
  86. _this.longitude = res.longitude
  87. _this.dimension = res.latitude
  88. _this.getAddress()
  89. }
  90. });
  91. },
  92. onShow() {},
  93. methods: {
  94. async getAddress() {
  95. console.log('address')
  96. const AMAP_KEY = '639d6b93b11d15c8b7df707612d42b8e'; // 从高德开放平台申请Web服务Key
  97. const API_URL = 'https://restapi.amap.com/v3/geocode/regeo';
  98. uni.request({
  99. url: API_URL,
  100. data: {
  101. key: AMAP_KEY,
  102. location: `${this.longitude},${this.dimension}`, // 注意坐标顺序
  103. extensions: 'base' // 精简返回数据
  104. },
  105. success: (res) => {
  106. this.address = res.data.regeocode.formatted_address
  107. },
  108. fail: (err) => {
  109. console.error('请求失败:', err);
  110. }
  111. });
  112. },
  113. inputDialogToggle(row) {
  114. if (row) {
  115. this.obj = row
  116. this.content = row.content
  117. } else {
  118. this.obj = {}
  119. this.content = null
  120. }
  121. // this.$refs.inputDialog.open()
  122. this.showDialog = true
  123. },
  124. dialogClose() {
  125. this.content = null
  126. this.showDialog = false
  127. },
  128. dialogInputConfirm() {
  129. this.obj.customerId = this.form.id
  130. this.obj.customerName = this.form.cname
  131. this.obj.content =this.content
  132. this.obj.dimension = this.dimension
  133. this.obj.longitude = this.longitude
  134. this.obj.address = this.address
  135. this.submit(this.obj)
  136. this.showDialog=false
  137. },
  138. submit(obj) {
  139. uni.showLoading({
  140. title: '加载中',
  141. mask: true
  142. });
  143. submit(obj).then(res => {
  144. console.log('保存', res)
  145. this.getDetails(this.form.id)
  146. uni.hideLoading();
  147. })
  148. },
  149. getDetails(id) {
  150. uni.showLoading({
  151. title: '加载中',
  152. mask: true
  153. });
  154. getDetail({
  155. id: id
  156. }).then(res => {
  157. this.form = res.data
  158. this.corpsAttnList = res.data.corpsAttnList
  159. this.corpsVisitList = res.data.corpsVisitList
  160. uni.hideLoading();
  161. })
  162. }
  163. },
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .fixed-bottom-btn {
  168. position: fixed;
  169. bottom: 10px;
  170. width: 97%;
  171. /* 根据需要调整宽度 */
  172. }
  173. .contentBox {
  174. margin-bottom: 20rpx;
  175. background-color: #FFFFFF;
  176. border-radius: 20rpx;
  177. /* box-shadow: 0 5rpx 14rpx 0 rgba(101, 176, 249, 0.42); */
  178. padding-top: 15rpx;
  179. padding-bottom: 10rpx;
  180. }
  181. .textBox {
  182. padding: 0 15px;
  183. display: flex;
  184. justify-content: space-between;
  185. font-size: 28rpx;
  186. margin-bottom: 10rpx;
  187. // align-items: flex-end;
  188. }
  189. .textBox-width {
  190. max-width: 500rpx;
  191. }
  192. .cellClass :v-deep .u-cell {
  193. &__body {
  194. padding: 2px 10px;
  195. }
  196. }
  197. </style>