list.vue 12 KB

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