list.vue 9.9 KB

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