list.vue 10 KB

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