list.vue 10 KB

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