list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  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. 所属门店:${item.store_type || '未填' }
  166. 齐心协力向前冲,洪楼业绩显峥嵘!`
  167. if (item.house_type == 2) {
  168. curContent = `【洪楼News】${item.deal_at}喜报
  169. 恭喜${item.deal_clerk}小伙伴今日成交${this.thtObj[item.house_type]}第1套
  170. 本月(${res.month}月)喜报总计:${res.month_total}套,本月个人总计:${res.user_total}套
  171. (1)客户姓名: ${item.customer_name}
  172. (2)报备电话:${item.customer_phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2")}
  173. (3)报备渠道:${item.report_dept}(${this.tdtObj[item.deal_type]})
  174. (4)成交项目:${item.deal_item}
  175. (5)具体房号:${item.house_no}
  176. (6)面积:${item.area}㎡
  177. (7)总价:${item.price}元
  178. (8)单价:${(Number(item.price)/item.area).toFixed(2)}元
  179. (9)折扣:${item.discount || '未知' }
  180. 房源录入:${item.house_create || '未填' }[${item.house_id || 0}]
  181. 所属门店:${item.store_type || '未填' }
  182. 齐心协力向前冲,洪楼业绩显峥嵘!`
  183. }
  184. uniCopy({
  185. content: curContent,
  186. success:(res)=>{
  187. uni.showToast({
  188. title: res,
  189. icon: 'none'
  190. })
  191. },
  192. error:(e)=>{
  193. uni.showToast({
  194. title: e,
  195. icon: 'none',
  196. duration:3000,
  197. })
  198. }
  199. })
  200. })
  201. },
  202. delHandle (item) {
  203. uni.$msgConfirm('确定删除吗?', () => {
  204. uni.api.cust.apiprivatecustomerdel({
  205. id: item.id
  206. }).then(res => {
  207. uni.$msg('删除成功~')
  208. this.loadmore.currnetPage = 1
  209. this.getDataList()
  210. })
  211. })
  212. },
  213. getDataList (bc) {
  214. const that = this
  215. let params = {
  216. ...this.searchFormData
  217. }
  218. uni.api.cust.apitradelist({
  219. page: that.loadmore.currnetPage,
  220. ...params,
  221. }).then(res => {
  222. const list = res.list || []
  223. if (list.length < 10) {
  224. that.loadmore.status = 'nomore';
  225. }
  226. if (res.current_page === 1) {
  227. if (list.length == 0) {
  228. uni.$msg('无搜索结果', 'none');
  229. }
  230. that.customerList = [...list]
  231. } else {
  232. that.customerList = that.customerList.concat(list)
  233. }
  234. if (bc) bc()
  235. })
  236. },
  237. customBack() {
  238. uni.navigateBack();
  239. },
  240. // 带监听器跳转
  241. pageTo(url, data) {
  242. /// xxxxx
  243. uni.navigateTo({
  244. url: url,
  245. events: {
  246. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  247. update: function(data) {
  248. // 当B页面运行 eventChannel.emit('update', { a:1 }); 时,会运行这里的代码逻辑。
  249. }
  250. },
  251. success: function(res) {
  252. // 通过eventChannel向被打开页面传送数据
  253. res.eventChannel.emit('data', data);
  254. }
  255. });
  256. },
  257. searchHandle() {
  258. that.loadmore.currnetPage = 1
  259. this.getDataList(() => {
  260. this.searchPopupShow = false
  261. })
  262. },
  263. }
  264. };
  265. </script>
  266. <style lang="scss">
  267. .scoped-list {
  268. padding-top: 20rpx;
  269. .sl-item {
  270. box-shadow: 0 0 5px #ccc;
  271. margin: 0 20rpx 20rpx;
  272. border-radius: 20rpx;
  273. overflow: hidden;
  274. .sli-top {
  275. position: relative;
  276. height: 70rpx;
  277. line-height: 70rpx;
  278. color: #fff;
  279. background: #2d8cf0;
  280. padding-left: 20rpx;
  281. &.t2 {
  282. background: #19be6b;
  283. }
  284. &.t3 {
  285. background: #795548;
  286. }
  287. &.t4 {
  288. background: #ccc;
  289. }
  290. .r {
  291. position: absolute;
  292. top: 0;
  293. right: 20rpx;
  294. height: 70rpx;
  295. line-height: 70rpx;
  296. color: #eee;
  297. }
  298. .r2 {
  299. position: absolute;
  300. top: 0;
  301. right: 100rpx;
  302. height: 70rpx;
  303. line-height: 70rpx;
  304. color: #eee;
  305. }
  306. }
  307. .sli-body {
  308. padding: 10rpx 20rpx;
  309. }
  310. .sli-p1 {
  311. color: #666;
  312. margin-bottom: 10rpx;
  313. font-size: 28rpx;
  314. .n {
  315. color: #ff9900;
  316. display: inline-block;
  317. font-weight: bold;
  318. }
  319. .i {
  320. color: #2d8cf0;
  321. font-weight: bold;
  322. display: inline-block;
  323. padding-left: 10rpx;
  324. }
  325. }
  326. .sli-p2 {
  327. color: #333;
  328. margin-bottom: 10rpx;
  329. .n {
  330. font-size: 30rpx;
  331. display: inline-block;
  332. font-weight: bold;
  333. color: #ed4014;
  334. }
  335. }
  336. .sli-p3 {
  337. color: #999;
  338. font-size: 28rpx;
  339. margin-bottom: 10rpx;
  340. }
  341. .sli-p4 {
  342. background: rgba(255,229,100,.3);
  343. color: #666;
  344. margin-bottom: 10rpx;
  345. }
  346. .sli-state {
  347. margin-bottom: 10rpx;
  348. color: #666;
  349. .s {
  350. font-weight: bold;
  351. background: #2d8cf0;
  352. padding: 6rpx 10rpx;
  353. color: #fff;
  354. border-radius: 10rpx;
  355. display: inline-block;
  356. font-size: 24rpx;
  357. &.s1 {
  358. background: #ccc;
  359. }
  360. &.s5 {
  361. background: #19be6b;
  362. }
  363. }
  364. }
  365. }
  366. }
  367. .float-search {
  368. opacity: 0.9;
  369. position: fixed;
  370. right: 20rpx;
  371. bottom: 40rpx;
  372. padding: 20rpx;
  373. border-radius: 50%;
  374. background-color: $u-theme-color;
  375. }
  376. .float-search2 {
  377. opacity: 0.9;
  378. position: fixed;
  379. right: 20rpx;
  380. bottom: 150rpx;
  381. padding: 20rpx;
  382. border-radius: 50%;
  383. background-color: $u-theme-color;
  384. }
  385. </style>