list.vue 9.6 KB

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