list.vue 11 KB

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