CommunicationLogs.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <view>
  3. <view class="keyword-view clearfix">
  4. <view class="float_left">
  5. <u-search
  6. disabled
  7. @search="searchConfirm()"
  8. :show-action="false"
  9. :clearabled="true"
  10. placeholder="请选择客户"
  11. v-model="customer_name"
  12. @click="goPage('/pagesT/customer/selCustomer')"
  13. ></u-search>
  14. </view>
  15. <view class="float_right" @click="openSearch"><text class="custom-icon custom-icon-shaixuan"></text></view>
  16. </view>
  17. <view class="com-ul">
  18. <view class="com-li" v-for="(item, index) in order_list" :key="index">
  19. <view class="cutomer-name clearfix">
  20. <view class="float_left ellipsis">
  21. <u-icon margin-left="10" name="account-fill" label-size="24" label-color="#2979ff" :label="item.customerName" color="#2979ff" size="28"></u-icon>
  22. </view>
  23. <view class="float_right staff-name">
  24. {{ item.staffName }}
  25. <!-- <u-icon name="dianhua" color="#2d73ed" custom-prefix="custom-icon" /> -->
  26. </view>
  27. </view>
  28. <view class="cont">
  29. <view class="content">{{ item.content }}</view>
  30. <view v-if="item.picture" class="image-view"><image @click="previewImage(item.picture)" :src="item.picture" mode="aspectFill"></image></view>
  31. <view class="address clearfix">
  32. <view class="float_left">
  33. <block v-if="item.location">
  34. <u-icon name="map-fill" color="#6c6c6c" size="26"></u-icon>
  35. {{ item.location }}
  36. </block>
  37. <text v-else style="color: #999999;">无定位信息</text>
  38. </view>
  39. </view>
  40. <view class="time clearfix">
  41. <view class="float_left">{{ $u.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
  42. <view v-if="item.managerMobile" class="float_right" @click="callPhone(item.managerMobile)">
  43. <!-- <u-icon @click="goPage(`/pagesT/customer/CommunicationLogsAdd?id=${item.id}`)"
  44. style="margin-right: 30rpx;" name="edit-pen-fill" color="#2d73ed" /> -->
  45. 客户电话:{{ item.managerMobile }}
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <u-loadmore :status="load_status" />
  52. <addBtn url="/pagesT/customer/CommunicationLogsAdd"></addBtn>
  53. <u-popup v-model="search_show" mode="right">
  54. <view class="search-pop">
  55. <view class="form-view">
  56. <u-form label-width="160rpx" label-position="left">
  57. <u-form-item label-position="top" label="下单日期">
  58. <view class="date-li">
  59. <picker mode="date" @change="bindDateStartChange">
  60. <text class="date-li">{{ search_data.start ? $u.timeFormat(search_data.start, 'yyyy-mm-dd') : '开始日期' }}</text>
  61. </picker>
  62. </view>
  63. <view class="date-line">-</view>
  64. <view class="date-li">
  65. <picker mode="date" @change="bindDateEndChange">
  66. <text class="date-li">{{ search_data.end ? $u.timeFormat(search_data.end, 'yyyy-mm-dd') : '结束日期' }}</text>
  67. </picker>
  68. </view>
  69. </u-form-item>
  70. </u-form>
  71. </view>
  72. <view class="search-btn">
  73. <view class="btn-li" @click="clearValue()">重置</view>
  74. <view class="btn-li" @click="getAllCustomerCommunication()">确定</view>
  75. </view>
  76. </view>
  77. </u-popup>
  78. </view>
  79. </template>
  80. <script>
  81. export default {
  82. data() {
  83. return {
  84. load_status: 'nomore',
  85. customerData: '',
  86. page: 1,
  87. pageSize: 10,
  88. total: 0,
  89. order_list: [],
  90. customer_name: '',
  91. customer_id: '',
  92. search_show: false,
  93. search_data: {
  94. start: '',
  95. end: ''
  96. }
  97. };
  98. },
  99. watch: {
  100. customerData(val) {
  101. if (val) {
  102. this.customer_name = val.name;
  103. this.customer_id = val.id;
  104. this.page = 1;
  105. this.getAllCustomerCommunication();
  106. }
  107. }
  108. },
  109. computed: {
  110. staffId() {
  111. return this.$store.state.userInfo.staffId;
  112. },
  113. isAdministrator() {
  114. return this.$store.state.access.isAdministrator;
  115. }
  116. },
  117. onLoad(opt) {
  118. if(opt.id) {
  119. this.customer_name = opt.name
  120. this.customer_id = opt.id
  121. }
  122. this.getAllCustomerCommunication();
  123. },
  124. onShow() {
  125. },
  126. onPullDownRefresh() {
  127. this.page = 1;
  128. this.getAllCustomerCommunication();
  129. },
  130. onReachBottom() {
  131. if (this.total / this.pageSize > this.page) {
  132. this.page += 1;
  133. this.getAllCustomerCommunication();
  134. }
  135. },
  136. methods: {
  137. clearValue() {
  138. this.search_show = false;
  139. this.customer_name = '';
  140. this.customer_id = '';
  141. this.search_data = {
  142. start: '',
  143. end: ''
  144. };
  145. this.page = 1;
  146. this.getAllCustomerCommunication();
  147. },
  148. getAllCustomerCommunication() {
  149. this.search_show = false;
  150. let params = {
  151. page: this.page,
  152. pageSize: this.pageSize,
  153. customerId: this.customer_id,
  154. start: this.search_data.start,
  155. end: this.search_data.end
  156. };
  157. if (!this.isAdministrator) {
  158. params.staffId = this.staffId;
  159. }
  160. this.$u.api.getAllCustomerCommunication(params).then(res => {
  161. console.log(res,'res+++')
  162. if (this.page === 1) {
  163. this.order_list = res.data;
  164. } else {
  165. this.order_list = this.order_list.concat(res.data);
  166. }
  167. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, res.pageTotal);
  168. this.total = res.pageTotal;
  169. }).catch(res => {
  170. console.log(res,'失败')
  171. });
  172. },
  173. previewImage(image) {
  174. // 预览图片
  175. uni.previewImage({
  176. urls: [image],
  177. longPressActions: {
  178. itemList: ['发送给朋友', '保存图片', '收藏'],
  179. success: function(data) {
  180. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  181. },
  182. fail: function(err) {
  183. console.log(err.errMsg);
  184. }
  185. }
  186. });
  187. },
  188. openSearch() {
  189. this.search_show = true;
  190. },
  191. bindDateStartChange(e) {
  192. this.search_data.start = this.$utils.timeByTimestamp(e.detail.value + ' 00:00:00');
  193. },
  194. bindDateEndChange(e) {
  195. this.search_data.end = this.$utils.timeByTimestamp(e.detail.value + ' 23:59:59');
  196. }
  197. }
  198. };
  199. </script>
  200. <style lang="scss" scoped>
  201. // .keyword-view {
  202. // position: fixed;
  203. // width: 100%;
  204. // top: 0;
  205. // left: 0;
  206. // padding: 20rpx 24rpx;
  207. // background-color: #ffffff;
  208. // z-index: 9;
  209. // .float_left {
  210. // width: 640rpx;
  211. // }
  212. // .float_right {
  213. // line-height: 64rpx;
  214. // width: 50rpx;
  215. // text-align: center;
  216. // color: #666666;
  217. // }
  218. // }
  219. .keyword-view {
  220. position: fixed;
  221. width: 100%;
  222. top: 0;
  223. left: 0;
  224. padding: 20rpx 24rpx;
  225. background-color: #ffffff;
  226. z-index: 9;
  227. .float_left {
  228. width: 640rpx;
  229. }
  230. .float_right {
  231. line-height: 64rpx;
  232. width: 50rpx;
  233. text-align: center;
  234. color: #666666;
  235. }
  236. }
  237. .com-ul {
  238. padding-top: 100rpx;
  239. .com-li {
  240. width: 710rpx;
  241. margin: 20rpx auto;
  242. background-color: #ffffff;
  243. padding: 20rpx 0;
  244. border-radius: 20rpx;
  245. .cutomer-name {
  246. padding-bottom: 10rpx;
  247. color: $uni-color-primary;
  248. font-size: 24rpx;
  249. .float_left {
  250. max-width: 540rpx;
  251. background-color: #ecf5ff;
  252. border-top-right-radius: 20rpx;
  253. border-bottom-right-radius: 20rpx;
  254. padding: 0 20rpx;
  255. line-height: 40rpx;
  256. }
  257. .staff-name {
  258. padding-right: 20rpx;
  259. line-height: 40rpx;
  260. }
  261. }
  262. .cont {
  263. padding: 0 20rpx;
  264. line-height: 36rpx;
  265. .content {
  266. padding-bottom: 10rpx;
  267. }
  268. .image-view {
  269. padding-bottom: 10rpx;
  270. image {
  271. width: 120rpx;
  272. height: 120rpx;
  273. border-radius: 10rpx;
  274. }
  275. }
  276. .address {
  277. padding-bottom: 10rpx;
  278. font-size: 24rpx;
  279. }
  280. .time {
  281. font-size: 24rpx;
  282. color: #999999;
  283. }
  284. }
  285. }
  286. }
  287. </style>