list.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <view>
  3. <wm-watermark :text="userInfo2.phone" :num="50"></wm-watermark>
  4. <view class="scoped-list">
  5. <view v-if="customerList.length == 0" class="empty-wrap"><u-empty mode="list" text="暂无成交单"></u-empty></view>
  6. <view v-for="(item, index) in customerList" class="sl-item" :key="index">
  7. <view :class="'sli-top t' + item.deal_type">{{ item.deal_item }}[{{ thtObj[item.house_type] }}] {{ item.house_no }}
  8. <view class="r2" @click="pageTo('/pages/trade/create', { info: item })">编辑</view>
  9. <view class="r" @click="copyTextHandle(item)">喜报</view>
  10. </view>
  11. <view class="sli-body" @click="pageTo('/pages/trade/record?id=' + item.id)">
  12. <view class="sli-p2">总价:<view class="n">{{ item.price }}元</view> => {{(Number(item.price)/item.area).toFixed(2)}}元|<view class="n">{{ item.area }}㎡</view></view>
  13. <view class="sli-p4" v-if="item.discount">折扣:{{ item.discount || '未知' }}</view>
  14. <view class="sli-p1">客户:{{ item.customer_name }}({{ item.customer_phone }})</view>
  15. <view class="sli-p1">业务:{{ item.deal_clerk }}报备至{{ item.report_dept }}({{ tdtObj[item.deal_type] }})</view>
  16. <view class="sli-p1">佣金:<view class="n">{{ item.brokerage || '0' }}</view> 元 | 返佣<view class="n">{{ item.rebate || '0' }}</view>元
  17. </view>
  18. <view class="sli-p3">成交日期:{{ item.deal_at }}</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="float-search2" @click="pageTo('/pages/trade/create')"><u-icon name="plus" size="42" color="#fff"></u-icon></view>
  23. <view class="float-search" @click="searchPopupShow = true"><u-icon name="search" size="42" color="#fff"></u-icon></view>
  24. <u-popup v-model="searchPopupShow" mode="center" width="80%" height="700rpx" border-radius="20">
  25. <view class="bwin-popup">
  26. <view class="popup-header">成交单搜索</view>
  27. <view class="popup-body">
  28. <u-input v-model="searchFormData.deal_item" border placeholder="请输入成交项目(支持模糊搜索)"></u-input>
  29. <u-divider marginTop="10" marginBottom="10">或</u-divider>
  30. <u-input v-model="searchFormData.deal_clerk" border placeholder="请输入成交业务员姓名(支持模糊搜索)"></u-input>
  31. <u-divider marginTop="10" marginBottom="10">或</u-divider>
  32. <u-input v-model="searchFormData.customer_name" border placeholder="请输入客户姓名(支持模糊搜索)"></u-input>
  33. <u-divider marginTop="10" marginBottom="10">或</u-divider>
  34. <u-input v-model="searchFormData.customer_phone" border placeholder="请输入客户手机号(可仅输入一部分)"></u-input>
  35. </view>
  36. <view class="popup-footer" style="position: absolute;">
  37. <u-button size="medium" @click="searchPopupShow = false">取消</u-button>
  38. <u-button size="medium" type="primary" @click="searchHandle()">搜索</u-button>
  39. </view>
  40. </view>
  41. </u-popup>
  42. <u-loadmore
  43. v-if="customerList.length > 0"
  44. marginTop="32"
  45. :line="true"
  46. :status="loadmore.status"
  47. :loading-text="loadmore.loadingText"
  48. :loadmore-text="loadmore.defaultText"
  49. :nomore-text="loadmore.nomoreText"
  50. />
  51. </view>
  52. </template>
  53. <script>
  54. import { arrToObj } from '@/utils'
  55. import wmWatermark from '@/components/wm-watermark/wm-watermark.vue'
  56. import uniCopy from '@/js_sdk/xb-copy/uni-copy.js'
  57. var that;
  58. export default {
  59. components: {
  60. wmWatermark
  61. },
  62. data() {
  63. return {
  64. userInfo2: {},
  65. thtObj: {},
  66. tdtObj: {},
  67. searchKeyword: null,
  68. searchPopupShow: false,
  69. searchFormData: {
  70. deal_item: '',
  71. deal_clerk: '',
  72. customer_name: '',
  73. customer_phone: ''
  74. }, // 搜索栏数据
  75. customerList: [],
  76. loadmore: {
  77. status: 'loadmore',
  78. loadingText: '努力加载中',
  79. defaultText: '轻轻上拉 查看更多',
  80. nomoreText: '实在没有了',
  81. currnetPage: 1
  82. }
  83. };
  84. },
  85. onLoad(params) {
  86. that = this;
  87. // 默认筛选项
  88. if (params.filterStepStatus !== undefined) {
  89. that.filterStepStatus = parseInt(params.filterStepStatus);
  90. this.filterDropdownValue = [[],[],[],[that.filterStepStatus],[]]
  91. }
  92. const dictObj = uni.getStorageSync('MD_dict')
  93. this.thtObj = arrToObj(dictObj.trade_house_type)
  94. this.tdtObj = arrToObj(dictObj.trade_deal_type)
  95. this.getDataList()
  96. },
  97. created () {
  98. this.userInfo2 = uni.getStorageSync('MD_userInfo2')
  99. },
  100. onReachBottom() {
  101. if (that.loadmore.status == 'nomore') return;
  102. that.loadmore.currnetPage++
  103. this.getDataList()
  104. },
  105. onPullDownRefresh() {
  106. // 防止频繁刷新
  107. },
  108. methods: {
  109. // 带监听器跳转
  110. pageTo(url, data) {
  111. /// xxxxx
  112. uni.navigateTo({
  113. url: url,
  114. events: {
  115. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  116. update: function(data) {
  117. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  118. }
  119. },
  120. success: function(res) {
  121. // 通过eventChannel向被打开页面传送数据
  122. res.eventChannel.emit('data', data);
  123. }
  124. });
  125. },
  126. copyTextHandle (item) {
  127. // return
  128. uniCopy({
  129. content: `【洪楼News】${item.deal_at}喜报
  130. 恭喜${item.deal_clerk}小伙伴今日成交${this.thtObj[item.house_type]}一套
  131. (1)客户姓名: ${item.customer_name}
  132. (2)报备电话:${item.customer_phone}
  133. (3)报备渠道:${item.report_dept}(${this.tdtObj[item.deal_type]})
  134. (4)成交项目:${item.deal_item}
  135. (5)具体房号:${item.house_no}
  136. (6)面积:${item.area}㎡
  137. (7)总价:${item.price}元
  138. (8)单价:${(Number(item.price)/item.area).toFixed(2)}元
  139. (9)折扣:${item.discount || '未知' }
  140. 齐心协力向前冲,洪楼业绩显峥嵘!`,
  141. success:(res)=>{
  142. uni.showToast({
  143. title: res,
  144. icon: 'none'
  145. })
  146. },
  147. error:(e)=>{
  148. uni.showToast({
  149. title: e,
  150. icon: 'none',
  151. duration:3000,
  152. })
  153. }
  154. })
  155. },
  156. delHandle (item) {
  157. uni.$msgConfirm('确定删除吗?', () => {
  158. uni.api.cust.apiprivatecustomerdel({
  159. id: item.id
  160. }).then(res => {
  161. uni.$msg('删除成功~')
  162. this.loadmore.currnetPage = 1
  163. this.getDataList()
  164. })
  165. })
  166. },
  167. getDataList (bc) {
  168. const that = this
  169. let params = {
  170. ...this.searchFormData
  171. }
  172. uni.api.cust.apitradelist({
  173. page: that.loadmore.currnetPage,
  174. ...params,
  175. }).then(res => {
  176. const list = res.list || []
  177. if (list.length < 10) {
  178. that.loadmore.status = 'nomore';
  179. }
  180. if (res.current_page === 1) {
  181. if (list.length == 0) {
  182. uni.$msg('无搜索结果', 'none');
  183. }
  184. that.customerList = [...list]
  185. } else {
  186. that.customerList = that.customerList.concat(list)
  187. }
  188. if (bc) bc()
  189. })
  190. },
  191. customBack() {
  192. uni.navigateBack();
  193. },
  194. // 带监听器跳转
  195. pageTo(url, data) {
  196. /// xxxxx
  197. uni.navigateTo({
  198. url: url,
  199. events: {
  200. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  201. update: function(data) {
  202. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  203. }
  204. },
  205. success: function(res) {
  206. // 通过eventChannel向被打开页面传送数据
  207. res.eventChannel.emit('data', data);
  208. }
  209. });
  210. },
  211. searchHandle() {
  212. that.loadmore.currnetPage = 1
  213. this.getDataList(() => {
  214. this.searchPopupShow = false
  215. })
  216. },
  217. }
  218. };
  219. </script>
  220. <style lang="scss">
  221. .scoped-list {
  222. padding-top: 20rpx;
  223. .sl-item {
  224. box-shadow: 0 0 5px #ccc;
  225. margin: 0 20rpx 20rpx;
  226. border-radius: 20rpx;
  227. overflow: hidden;
  228. .sli-top {
  229. position: relative;
  230. height: 70rpx;
  231. line-height: 70rpx;
  232. color: #fff;
  233. background: #2d8cf0;
  234. padding-left: 20rpx;
  235. &.t2 {
  236. background: #19be6b;
  237. }
  238. &.t3 {
  239. background: #795548;
  240. }
  241. .r {
  242. position: absolute;
  243. top: 0;
  244. right: 20rpx;
  245. height: 70rpx;
  246. line-height: 70rpx;
  247. color: #eee;
  248. }
  249. .r2 {
  250. position: absolute;
  251. top: 0;
  252. right: 100rpx;
  253. height: 70rpx;
  254. line-height: 70rpx;
  255. color: #eee;
  256. }
  257. }
  258. .sli-body {
  259. padding: 10rpx 20rpx;
  260. }
  261. .sli-p1 {
  262. color: #666;
  263. margin-bottom: 10rpx;
  264. font-size: 28rpx;
  265. .n {
  266. color: #ff9900;
  267. display: inline-block;
  268. font-weight: bold;
  269. }
  270. .i {
  271. color: #2d8cf0;
  272. font-weight: bold;
  273. display: inline-block;
  274. padding-left: 10rpx;
  275. }
  276. }
  277. .sli-p2 {
  278. color: #333;
  279. margin-bottom: 10rpx;
  280. .n {
  281. font-size: 30rpx;
  282. display: inline-block;
  283. font-weight: bold;
  284. color: #ed4014;
  285. }
  286. }
  287. .sli-p3 {
  288. color: #999;
  289. font-size: 28rpx;
  290. margin-bottom: 10rpx;
  291. }
  292. .sli-p4 {
  293. background: rgba(255,229,100,.3);
  294. color: #666;
  295. margin-bottom: 10rpx;
  296. }
  297. }
  298. }
  299. .float-search {
  300. opacity: 0.9;
  301. position: fixed;
  302. right: 20rpx;
  303. bottom: 40rpx;
  304. padding: 20rpx;
  305. border-radius: 50%;
  306. background-color: $u-theme-color;
  307. }
  308. .float-search2 {
  309. opacity: 0.9;
  310. position: fixed;
  311. right: 20rpx;
  312. bottom: 150rpx;
  313. padding: 20rpx;
  314. border-radius: 50%;
  315. background-color: $u-theme-color;
  316. }
  317. </style>