index.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258
  1. <template>
  2. <view class="container mine clearfix">
  3. <view
  4. class="tui-header-box first"
  5. :style="{ height: isCmcustomClass == 'fiexd' ? CustomBar + 6 + 'px' : CustomBar + 6 + 'px' }"
  6. :class="isCmcustomClass"
  7. >
  8. <view class="header-top" :style="{ paddingTop: top + 'px', lineHeight: CustomBar + 20 + 'px' }"></view>
  9. <view class="header-sit">
  10. <text
  11. class="iconfont icon-shouye1"
  12. v-if="isShareType"
  13. @click.stop="this.$api.navigateLinkJump()"
  14. ></text>
  15. <text class="iconfont icon-fanhui" v-else @click.stop="this.$api.navigateBack(1)"></text>
  16. <text class="header-sit-text">关联订单</text>
  17. </view>
  18. </view>
  19. <tui-skeleton
  20. v-if="skeletonShow"
  21. backgroundColor="#fafafa"
  22. borderRadius="10rpx"
  23. :isLoading="true"
  24. :loadingType="7"
  25. />
  26. <view class="container-content" v-else>
  27. <view class="tui-header-tabs day clearfix" :style="{ top: CustomBar + 6 + 'px' }">
  28. <view v-if="!isShowHeader">
  29. <view class="tui-header-top">
  30. <view class="title"> 收款信息 </view>
  31. <view class="tui-header-button">
  32. <view
  33. class="button btn-error"
  34. @click.stop="showReceiptModel"
  35. v-if="receiptInfo.shopOrderList.length > 0"
  36. >
  37. 查看关联信息
  38. </view>
  39. <!-- <view class="button btn-confirm" @click="toNoSms('/pages/collection/list')">
  40. <text class="iconfont icon-wodedingdan"></text>收款列表
  41. </view> -->
  42. </view>
  43. </view>
  44. <view class="tui-header-item">
  45. <view class="list-title-t">
  46. <view class="list-title-tip">
  47. <text class="badges">{{ receiptInfo.receiptType | formatReceiptType }}款</text>
  48. </view>
  49. <view class="list-title-num" :style="{ color: formatColor(receiptInfo.receiptStatus) }">{{
  50. receiptInfo.receiptStatus | formatStateType
  51. }}</view>
  52. </view>
  53. <view class="list-title-b">
  54. <view class="list-title-b-item ">
  55. 收款金额:<text class="text">¥{{ receiptInfo.receiptAmount | NumFormat }} </text>
  56. </view>
  57. <view class="list-title-b-item ">
  58. 收款账号:<text class="text">{{ receiptInfo.payTypeText }}</text>
  59. </view>
  60. </view>
  61. <view class="list-title-b">
  62. 收款时间:<text class="text">{{ receiptInfo.receiptDate }}</text>
  63. </view>
  64. <view class="list-title-b">收款短信:</view>
  65. <view class="list-title-b sms">
  66. <text class="text">{{ receiptInfo.smsContent ? receiptInfo.smsContent : '无' }}</text>
  67. </view>
  68. <view class="list-icon" v-if="receiptInfo.tipMsg">
  69. <image
  70. class="list-icon-image"
  71. src="https://static.caimei365.com/app/crm/image/icon-noconfirm@2x.png"
  72. mode=""
  73. v-if="receiptInfo.receiptStatus == 1"
  74. ></image>
  75. <image
  76. class="list-icon-image"
  77. src="https://static.caimei365.com/app/crm/image/icon-noaudit@2x.png"
  78. mode=""
  79. v-if="receiptInfo.receiptStatus == 2"
  80. ></image>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="tui-header-tabmain">
  85. <input
  86. v-if="currents == 3"
  87. class="input"
  88. type="text"
  89. v-model="refundListQuery.keyword"
  90. confirm-type="search"
  91. @confirm="subMitSearch(2)"
  92. placeholder="搜索关键词(供应商名称)"
  93. />
  94. <input
  95. v-else
  96. class="input"
  97. type="text"
  98. v-model="listQuery.keyword"
  99. confirm-type="search"
  100. @confirm="subMitSearch(1)"
  101. placeholder="搜索关键词(客户名称/订单ID)"
  102. />
  103. <text class="iconfont icon-sousuo"></text>
  104. </view>
  105. <view class="tui-header-tabmain">
  106. <view
  107. class="main-item one"
  108. v-for="(item, index) in listTabs"
  109. :key="index"
  110. :class="{ active: currents == index }"
  111. @click="tabClick(1, index)"
  112. >
  113. <view class="text">{{ item.name }}</view>
  114. </view>
  115. </view>
  116. <view class="tui-header-tabmain day">
  117. <view
  118. class="main-item tab"
  119. v-for="(item, index) in listReturnType"
  120. :key="index"
  121. :class="{ tabActive: tabCurrents == index }"
  122. @click="tabClick(2, index)"
  123. >
  124. <view class="text">{{ item.name }}</view>
  125. </view>
  126. </view>
  127. </view>
  128. <view
  129. class="user-section"
  130. :style="{
  131. top: isIphoneX ? CustomBar + 330 + 'px' : CustomBar + 315 + 'px',
  132. left: 0 + 'px',
  133. paddingBottom: isIphoneX ? '178rpx' : '144rpx'
  134. }"
  135. >
  136. <view class="header-content">
  137. <view :class="{ 'tui-order-list': scrollTop >= 0 }" class="clearfix">
  138. <!-- 空白页 -->
  139. <empty v-if="isEmpty" :typeIndex="currents" :navbarHeight="navbarHeight"></empty>
  140. <!-- 列表 -->
  141. <view v-else class="tui-order-content">
  142. <view class="tui-order-item" v-for="(order, orderIndex) in shopOrderList" :key="orderIndex">
  143. <template v-if="currents != 3">
  144. <receipt-details :orderInfo="order" />
  145. <view
  146. class="list-checked"
  147. @click="checkedOrder(order)"
  148. v-if="order.surplusAmount > 0"
  149. >
  150. <text
  151. class="iconfont"
  152. :class="order.isChecked ? 'icon-yixuanze' : 'icon-weixuanze'"
  153. ></text>
  154. </view>
  155. <view class="list-detail" @click="orderDetail(order.shopOrderId)">
  156. <text class="iconfont icon-xiayibu"></text>
  157. </view>
  158. </template>
  159. <template v-if="currents == 3">
  160. <receipt-refund :orderInfo="order" />
  161. <view class="list-checked" @click="checkedRefundOrder(order, orderIndex)">
  162. <text
  163. class="iconfont"
  164. :class="order.isChecked ? 'icon-yixuanze' : 'icon-weixuanze'"
  165. ></text>
  166. </view>
  167. <view class="list-detail" @click="orderDetail(order.shopOrderId)">
  168. <text class="iconfont icon-xiayibu"></text>
  169. </view>
  170. </template>
  171. </view>
  172. <!--加载loadding-->
  173. <tui-loadmore :visible="loadding" :index="3" type="black" />
  174. <tui-nomore :visible="!pullUpOn" bgcolor="#F7F7F7" :text="nomoreText" />
  175. <!--加载loadding-->
  176. </view>
  177. </view>
  178. </view>
  179. </view>
  180. <view class="distinguish-button" :style="{ paddingBottom: isIphoneX ? '68rpx' : '24rpx' }">
  181. <view class="button" @click="confirmDistinguishRefund" v-if="currents == 3">确认关联退款子订单</view>
  182. <view class="button" @click="confirmDistinguish" v-else>确认</view>
  183. </view>
  184. </view>
  185. <!-- 弹窗 -->
  186. <tui-modal
  187. :show="modal"
  188. @click="handleClick"
  189. @cancel="hideMobel(0)"
  190. :content="contentModalText"
  191. color="#333"
  192. :size="32"
  193. shape="circle"
  194. :maskClosable="false"
  195. />
  196. <!-- 关联提示弹窗 -->
  197. <receipt-modal
  198. v-if="modal1"
  199. :show="modal1"
  200. :amount="receiptInfo.receiptAmount"
  201. :totalOrder="totalOrder"
  202. :modelTpye="modelTpye"
  203. @cancel="hideMobel(1)"
  204. @click="handleClick1"
  205. />
  206. <!-- 关联信息 -->
  207. <receipt-orderDetails v-if="modal2" :receipt="receiptInfo" @cancel="hideMobel(2)" />
  208. <!-- 供应商退款子订单关联弹窗 -->
  209. <tui-modal :show="modal3" :padding="'40rpx 30rpx'" @cancel="hideMobel(3)" :custom="true" fadeIn>
  210. <view class="tui-modal-custom">
  211. <view class="tui-prompt-text"> {{ contentModalText }} </view>
  212. <view class="tui-prompt-flex"> <view class="btn btn-confirm" @click="hideMobel(3)">知道了</view> </view>
  213. </view>
  214. </tui-modal>
  215. </view>
  216. </template>
  217. <script>
  218. import receiptModal from '@/components/cm-module/receipt/receipt-modal'
  219. import receiptDetails from '@/components/cm-module/receipt/receipt-details'
  220. import receiptRefund from '@/components/cm-module/receipt/receipt-refund'
  221. import receiptOrderDetails from '@/components/cm-module/receipt/receipt-orderDetails'
  222. import empty from '@/components/empty'
  223. import { listOrderTabs, listOrderStateTabs } from '@/utils/config.tabs.js'
  224. import { mapState, mapMutations } from 'vuex'
  225. const defaultListQuery = {
  226. id: 0, //收款Id
  227. keyword: '', // 搜索关键词(客户名称/订单号)
  228. orderReceiptStatus: '1,2', //订单收款状态:1待收款(协销待确认款项的订单),2部分收款(已确认款项的订单),3已收款(已确认款项的订单)
  229. organizeId: 0, // 商品订单 0 定金订单 0 小程序订单 3 退款子订单 4
  230. pageNum: 1, // 页码
  231. pageSize: 10, // 条数
  232. type: 0 // 0商品订单(默认),1订金订单
  233. }
  234. const defaultRefundListQuery = {
  235. id: 0, //收款Id
  236. confirmedType: 0, // 0待确认,2已确认
  237. keyword: '', //供应商名称
  238. pageNum: 1, // 页码
  239. pageSize: 10 // 条数
  240. }
  241. export default {
  242. components: {
  243. empty,
  244. receiptModal,
  245. receiptDetails,
  246. receiptRefund,
  247. receiptOrderDetails
  248. },
  249. data() {
  250. return {
  251. CustomBar: this.CustomBar, // 顶部导航栏高度
  252. isIphoneX: this.$store.state.isIphoneX,
  253. receiptInfo: {},
  254. listTabs: listOrderTabs,
  255. listReturnType: listOrderStateTabs,
  256. listQuery: Object.assign({}, defaultListQuery),
  257. refundListQuery: Object.assign({}, defaultRefundListQuery),
  258. currents: 0,
  259. tabCurrents: 0,
  260. shopOrderList: [],
  261. scrollTop: 0,
  262. isEmpty: false,
  263. loadding: false,
  264. pullUpOn: true,
  265. hasNextPage: false,
  266. pullFlag: true,
  267. navbarHeight: '',
  268. nomoreText: '上拉显示更多',
  269. contentModalText: '', //操作文字提示语句
  270. modal: false,
  271. modal1: false,
  272. modal2: false,
  273. modal3: false,
  274. hanldOrder: '', //储存监听订单信息
  275. OperationType: '', //操作类型
  276. isCmcustomClass: 'left',
  277. isShowHeader: false,
  278. height: 64, //header高度
  279. top: 0, //标题图标距离顶部距离
  280. scrollH: 0, //滚动总高度
  281. opcity: 1,
  282. checkedOrderList: [],
  283. checkedIds: [],
  284. checkedRefundIndex: '',
  285. confirmParams: {
  286. confirmType: 4,
  287. id: 0,
  288. orderIds: ''
  289. },
  290. confirmRefundParams: {
  291. shopOrderId: 0,
  292. id: 0
  293. },
  294. skeletonShow: true,
  295. modelTpye: 1, // 收款弹窗类型
  296. totalOrder: {
  297. orderNums: 1,
  298. payTotalFee: 0, // 订单金额
  299. balancePayFee: 0, // 余额抵扣
  300. payableAmount: 0, // 应收金额
  301. paidAmount: 0, // 已收金额
  302. surplusAmount: 0 // 剩余应收
  303. }, // 统计都选相同的订单数据
  304. isShareType: false
  305. }
  306. },
  307. onLoad(option) {
  308. let obj = {}
  309. uni.getSystemInfo({
  310. success: res => {
  311. this.width = obj.left || res.windowWidth
  312. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44
  313. this.top = obj.top ? obj.top + (obj.height - 32) / 2 : res.statusBarHeight + 6
  314. this.scrollH = res.windowWidth * 0.6
  315. }
  316. })
  317. if (option.type == 'share') {
  318. this.isShareType = true
  319. }
  320. this.listQuery.id = this.confirmParams.id = this.confirmRefundParams.id = option.id
  321. this.getOrderReceiptDetail(this.listQuery.id)
  322. },
  323. computed: {
  324. ...mapState(['hasLogin'])
  325. },
  326. methods: {
  327. getOrderReceiptDetail(id) {
  328. // 收款详情
  329. this.OrderService.orderReceiptDetail({ id: id })
  330. .then(response => {
  331. this.receiptInfo = response.data
  332. this.getOrderReceiptOrders()
  333. })
  334. .catch(err => {
  335. this.$api.navigateTo('/pages/login/login-error')
  336. })
  337. },
  338. getOrderReceiptOrders() {
  339. // 收款详情-订单列表
  340. this.initListQuery()
  341. this.OrderService.orderReceiptOrders(this.listQuery)
  342. .then(response => {
  343. let data = response.data
  344. this.hasNextPage = response.data.hasNextPage
  345. if (data.list && data.list.length > 0) {
  346. this.isEmpty = false
  347. this.shopOrderList = data.list.map((el, index) => {
  348. el.isChecked = false
  349. return el
  350. })
  351. this.pullFlag = false
  352. setTimeout(() => {
  353. this.pullFlag = true
  354. }, 500)
  355. if (this.hasNextPage) {
  356. this.pullUpOn = false
  357. this.nomoreText = '上拉显示更多'
  358. } else {
  359. if (this.shopOrderList.length < 3) {
  360. this.pullUpOn = true
  361. this.loadding = false
  362. } else {
  363. this.pullUpOn = false
  364. this.loadding = false
  365. this.nomoreText = '已至底部'
  366. }
  367. }
  368. } else {
  369. this.isEmpty = true
  370. }
  371. this.skeletonShow = false
  372. })
  373. .catch(err => {
  374. this.$util.msg(err.msg, 2000)
  375. })
  376. },
  377. orderReceiptRefundOrders() {
  378. // 收款详情-退款子订单列表
  379. this.OrderService.orderReceiptRefundOrders(this.refundListQuery)
  380. .then(response => {
  381. let data = response.data
  382. this.hasNextPage = response.data.hasNextPage
  383. if (data.list && data.list.length > 0) {
  384. this.isEmpty = false
  385. this.shopOrderList = data.list.map((el, index) => {
  386. el.isChecked = false
  387. return el
  388. })
  389. this.pullFlag = false
  390. setTimeout(() => {
  391. this.pullFlag = true
  392. }, 500)
  393. if (this.hasNextPage) {
  394. this.pullUpOn = false
  395. this.nomoreText = '上拉显示更多'
  396. } else {
  397. if (this.shopOrderList.length < 3) {
  398. this.pullUpOn = true
  399. } else {
  400. this.pullUpOn = false
  401. this.loadding = false
  402. this.nomoreText = '已至底部'
  403. }
  404. }
  405. } else {
  406. this.isEmpty = true
  407. }
  408. })
  409. .catch(err => {
  410. this.$util.msg(err.msg, 2000)
  411. })
  412. },
  413. orderReceiptRefundOrdersBottom() {
  414. this.refundListQuery.pageNum += 1
  415. this.OrderService.orderReceiptRefundOrders(this.refundListQuery)
  416. .then(response => {
  417. let data = response.data
  418. if (data.list && data.list.length > 0) {
  419. this.hasNextPage = data.hasNextPage
  420. let list = data.list.map((el, index) => {
  421. el.isChecked = false
  422. return el
  423. })
  424. this.shopOrderList = this.shopOrderList.concat(list)
  425. this.pullFlag = false // 防上拉暴滑
  426. setTimeout(() => {
  427. this.pullFlag = true
  428. }, 500)
  429. if (this.hasNextPage) {
  430. this.pullUpOn = false
  431. this.nomoreText = '上拉显示更多'
  432. } else {
  433. this.pullUpOn = false
  434. this.loadding = false
  435. this.nomoreText = '已至底部'
  436. }
  437. }
  438. })
  439. .catch(err => {
  440. this.$util.msg(err.msg, 2000)
  441. })
  442. },
  443. orderReceiptOrdersBottom() {
  444. this.listQuery.pageNum += 1
  445. this.OrderService.orderReceiptOrders(this.listQuery)
  446. .then(response => {
  447. let data = response.data
  448. if (data.list && data.list.length > 0) {
  449. this.hasNextPage = data.hasNextPage
  450. let list = data.list.map((el, index) => {
  451. el.isChecked = false
  452. return el
  453. })
  454. this.shopOrderList = this.shopOrderList.concat(list)
  455. this.pullFlag = false // 防上拉暴滑
  456. setTimeout(() => {
  457. this.pullFlag = true
  458. }, 500)
  459. if (this.hasNextPage) {
  460. this.pullUpOn = false
  461. this.nomoreText = '上拉显示更多'
  462. } else {
  463. this.pullUpOn = false
  464. this.loadding = false
  465. this.nomoreText = '已至底部'
  466. }
  467. }
  468. })
  469. .catch(err => {
  470. this.$util.msg(err.msg, 2000)
  471. })
  472. },
  473. subMitSearch(type) {
  474. // 确认搜索
  475. switch (type) {
  476. case 1: // 订单
  477. this.getOrderReceiptOrders()
  478. break
  479. case 2: // 订单
  480. this.refundListQuery.pageNum = 1
  481. this.orderReceiptRefundOrders()
  482. break
  483. }
  484. },
  485. getOnReachBottomData() {
  486. //上拉加载
  487. if (this.currents == 3) {
  488. this.orderReceiptRefundOrdersBottom()
  489. } else {
  490. this.orderReceiptOrdersBottom()
  491. }
  492. },
  493. orderDetail(shopOrderId) {
  494. //订单详情跳转
  495. this.$api.navigateTo(`/pages/relation/order/detail?shopOrderId=${shopOrderId}`)
  496. },
  497. handleClick(e) {
  498. //用户操作订单
  499. let index = e.index
  500. if (index == 1) {
  501. }
  502. this.modal = false
  503. },
  504. confirmDistinguish() {
  505. // 点击确认
  506. const list = []
  507. this.checkedOrderList.forEach(el => {
  508. if (list.indexOf(el.userId) == -1) {
  509. list.push(el.userId)
  510. }
  511. })
  512. if (this.checkedOrderList.length == 0) {
  513. this.$util.msg('请选择订单!', 2000)
  514. return
  515. }
  516. // if (this.currents === 1) {
  517. // // 订金订单每次只能关联一个订单
  518. // if (this.checkedOrderList.length > 1) {
  519. // this.$util.msg('订金订单每次只能关联一个订单!', 2000)
  520. // return
  521. // }
  522. // }
  523. if (list.length > 1) {
  524. this.$util.msg('请选择相同机构的订单!', 2000)
  525. return
  526. }
  527. let totalAmount = 0 //订单金额
  528. let accountAmount = 0 //余额抵扣
  529. let realPay = 0 //应收金额
  530. let receiptAmount = 0 //已收金额
  531. let surplusAmount = 0 //剩余应收
  532. console.log('1111111',this.checkedOrderList)
  533. this.checkedOrderList.forEach(el => {
  534. totalAmount += el.totalAmount
  535. accountAmount += el.accountAmount
  536. realPay += el.realPay
  537. receiptAmount += el.receiptAmount
  538. surplusAmount += el.surplusAmount
  539. this.checkedIds.push(el.shopOrderId)
  540. })
  541. console.log('checkedIds',this.checkedIds)
  542. // 赋值
  543. this.totalOrder.totalAmount = Number(totalAmount.toFixed(2))
  544. this.totalOrder.surplusAmount = Number(surplusAmount.toFixed(2))
  545. this.totalOrder.accountAmount = Number(accountAmount.toFixed(2))
  546. this.totalOrder.realPay = Number(realPay.toFixed(2))
  547. this.totalOrder.receiptAmount = Number(receiptAmount.toFixed(2))
  548. this.totalOrder.orderNums = this.checkedOrderList.length
  549. // if (this.currents === 1) {
  550. // // 收款金额必须等于订金订单金额才能关联
  551. // if (this.receiptInfo.receiptAmount != this.totalOrder.payTotalFee) {
  552. // this.$util.msg('收款金额必须等于订金订单金额才能关联!', 2000)
  553. // return
  554. // }
  555. // }
  556. console.log('totalOrder', this.totalOrder)
  557. //处理收款状态的几种类型
  558. if (
  559. this.receiptInfo.receiptAmount == this.totalOrder.surplusAmount ||
  560. this.totalOrder.surplusAmount - this.receiptInfo.receiptAmount >= 10
  561. ) {
  562. //收款金额等于订单应收金额 或者是 订单应收总金额减去收款金额大于等于10
  563. this.modelTpye = 1
  564. console.log(
  565. '收款金额等于订单剩余应收金额 或者是 收款金额减去订单剩余应收金额大于等于10',
  566. this.modelTpye
  567. )
  568. } else if (this.receiptInfo.receiptAmount > this.totalOrder.surplusAmount) {
  569. //收款金额大于订单神域应收金额(可退款到余额)
  570. this.modelTpye = 2
  571. console.log('收款金额大于订单应收金额(可退款到余额)', this.modelTpye)
  572. } else if (this.totalOrder.surplusAmount - this.receiptInfo.receiptAmount <= 10) {
  573. //订单剩余应收总金额减去收款金额小于等于10元时,才能抹平确认
  574. this.modelTpye = 3
  575. console.log('订单剩余应收总金额减去收款金额小于等于10元时,才能抹平确认)', this.modelTpye)
  576. }
  577. this.modal1 = true
  578. },
  579. confirmDistinguishRefund() {
  580. //确认关联供应商退款子订单
  581. if (this.confirmRefundParams.shopOrderId == 0) {
  582. this.$util.msg('请选择订单!', 2000)
  583. return
  584. }
  585. this.orderReceiptConfirmRefund(this.confirmRefundParams)
  586. },
  587. handleClick1(data) {
  588. switch (data) {
  589. case 1: // 小额抹平确认
  590. this.confirmParams.confirmType = data
  591. this.confirmParams.orderIds = this.checkedIds.join(',')
  592. this.orderReceiptConfirm()
  593. this.modal1 = false
  594. break
  595. case 3: // 大额退款余额
  596. this.confirmParams.confirmType = data
  597. this.confirmParams.orderIds = this.checkedIds.join(',')
  598. this.orderReceiptConfirm()
  599. this.modal1 = false
  600. break
  601. case 4: // 确认关联
  602. this.confirmParams.confirmType = data
  603. this.confirmParams.orderIds = this.checkedIds.join(',')
  604. this.orderReceiptConfirm()
  605. this.modal1 = false
  606. break
  607. }
  608. },
  609. orderReceiptConfirmRefund(params) {
  610. //确认关联退款子订单
  611. this.OrderService.orderReceiptConfirmRefund(params)
  612. .then(response => {
  613. this.$util.msg('关联成功~', 2000, true, 'success')
  614. setTimeout(() => {
  615. this.$api.redirectTo(`/pages/relation/refund/detail?id=${this.confirmRefundParams.id}`)
  616. }, 2000)
  617. })
  618. .catch(err => {
  619. this.modal3 = true
  620. this.contentModalText = err.msg
  621. })
  622. },
  623. orderReceiptConfirm() {
  624. //确认关联订单或抹平或退款余额
  625. this.OrderService.orderReceiptConfirm(this.confirmParams)
  626. .then(response => {
  627. this.$api.redirectTo(`/pages/relation/ordinary/examine-detail?id=${this.confirmParams.id}`)
  628. })
  629. .catch(err => {
  630. this.$util.msg(err.msg, 2000)
  631. })
  632. },
  633. checkedOrder(order) {
  634. // 勾选关联订单
  635. order.isChecked = !order.isChecked
  636. if (order.isChecked) {
  637. if(!this.contains(this.checkedOrderList,order.shopOrderId)){
  638. this.checkedOrderList.push(order)
  639. }
  640. } else {
  641. this.checkedOrderList.splice(this.checkedOrderList.indexOf(order), 1)
  642. }
  643. },
  644. contains(arr, val) {// 校验
  645. return arr.some(item => item.shopOrderId === val)
  646. },
  647. checkedRefundOrder(order, index) {
  648. // 勾选退款子订单
  649. this.checkedOrderList = []
  650. this.checkedRefundIndex = index
  651. this.shopOrderList.forEach((el, index) => {
  652. if (this.checkedRefundIndex == index) {
  653. el.isChecked = true
  654. this.confirmRefundParams.shopOrderId = el.shopOrderId
  655. } else {
  656. el.isChecked = false
  657. }
  658. })
  659. },
  660. hideMobel(type) {
  661. switch (type) {
  662. case 0:
  663. this.modal = false
  664. break
  665. case 1:
  666. this.modal1 = false
  667. break
  668. case 2:
  669. this.modal2 = false
  670. break
  671. case 3:
  672. this.modal3 = false
  673. break
  674. }
  675. },
  676. formatColor(state) {
  677. //设置邀请码状态亚瑟
  678. let stateColor = '',
  679. stateColorObject = {
  680. 1: '#ff7900',
  681. 2: '#4cd964',
  682. 3: '#19be6b',
  683. 4: '#ed3f14',
  684. 5: '#F74D54'
  685. }
  686. Object.keys(stateColorObject).forEach(function(key) {
  687. if (key == state) {
  688. stateColor = stateColorObject[key]
  689. }
  690. })
  691. return stateColor
  692. },
  693. tabClick(type, index) {
  694. this.pullUpOn = true //切换时隐藏
  695. this.loadding = false //切换时隐藏
  696. switch (type) {
  697. case 1: // 切换订单类型
  698. this.currents = index
  699. this.tabCurrents = 0
  700. this.listQuery.orderReceiptStatus = '1,2'
  701. switch (this.currents) {
  702. case 0: // 商品订单
  703. this.listQuery.type = 0
  704. this.listQuery.organizeId = 0
  705. this.getOrderReceiptOrders()
  706. break
  707. // case 1: // 定金订单
  708. // this.listQuery.type = 1
  709. // this.listQuery.organizeId = 0
  710. // this.getOrderReceiptOrders()
  711. // break
  712. case 1: // 集团
  713. this.listQuery.type = 0
  714. this.listQuery.organizeId = 3
  715. this.getOrderReceiptOrders()
  716. break
  717. // case 2: // 供应商退款 (暂时停用,后续可视情况废除)
  718. // this.listQuery.type = 0
  719. // this.refundListQuery.pageNum = 1
  720. // this.orderReceiptRefundOrders()
  721. // break
  722. }
  723. break
  724. case 2: // 切换收款状态
  725. this.tabCurrents = index
  726. if (this.currents == 3) {
  727. if (this.tabCurrents == 0) {
  728. this.refundListQuery.confirmedType = 0
  729. } else {
  730. this.refundListQuery.confirmedType = 2
  731. }
  732. this.refundListQuery.pageNum = 1
  733. this.orderReceiptRefundOrders()
  734. } else {
  735. if (this.tabCurrents == 0) {
  736. this.listQuery.orderReceiptStatus = '1,2'
  737. } else {
  738. this.listQuery.orderReceiptStatus = '3'
  739. }
  740. this.getOrderReceiptOrders()
  741. }
  742. }
  743. },
  744. toNoSms(url) {
  745. this.$api.navigateTo(url)
  746. },
  747. showReceiptModel() {
  748. //
  749. this.modal2 = true
  750. },
  751. initListQuery() {
  752. // 初始化
  753. this.loadding = true
  754. this.pullUpOn = true
  755. this.shopOrderList = []
  756. this.checkedOrderList = []
  757. this.listQuery.pageNum = 1
  758. },
  759. formatReceiptType(value) {
  760. //订单状态文字和颜色
  761. var HtmlStateText = '',
  762. stateTextObject = {
  763. 1: '订单款',
  764. 2: '非订单款',
  765. 3: '返佣款',
  766. 4: '订单款或者非订单款',
  767. 5: '供应商退款'
  768. }
  769. Object.keys(stateTextObject).forEach(function(key) {
  770. if (key == value) {
  771. HtmlStateText = stateTextObject[key]
  772. }
  773. })
  774. return HtmlStateText
  775. }
  776. },
  777. onPageScroll(e) {
  778. //实时获取到滚动的值
  779. if (e.scrollTop > 30) {
  780. this.isCmcustomClass = 'fiexd'
  781. } else {
  782. this.isCmcustomClass = 'left'
  783. }
  784. if (e.scrollTop > 180) {
  785. this.isShowHeader = true
  786. } else {
  787. this.isShowHeader = false
  788. }
  789. },
  790. onReachBottom() {
  791. if (this.hasNextPage) {
  792. this.loadding = true
  793. this.pullUpOn = true
  794. this.getOnReachBottomData()
  795. }
  796. },
  797. onPullDownRefresh() {
  798. setTimeout(() => {
  799. this.getOrderReceiptOrders()
  800. uni.stopPullDownRefresh()
  801. }, 200)
  802. },
  803. onShareAppMessage(res) {
  804. //分享购买优惠券
  805. const receipt = this.receiptInfo
  806. const receiptTypeText = this.formatReceiptType(receipt.receiptType)
  807. if (res.from === 'button') {
  808. // console.log('来自页面内转发按钮')
  809. }
  810. return {
  811. title: `¥${receipt.receiptAmount.toFixed(2)} | ${receipt.receiptDate} | ${
  812. receipt.receiptStatusText
  813. }(${receiptTypeText})`,
  814. path: `/pages/login/login-share?id=${receipt.id}`,
  815. imageUrl: 'https://static.caimei365.com/app/crm/image/icon-share@2x.jpg'
  816. }
  817. },
  818. onShow() {}
  819. }
  820. </script>
  821. <style lang="scss">
  822. @import '@/uni.scss';
  823. page {
  824. background: #f7f7f7;
  825. }
  826. .tui-header-box {
  827. width: 100%;
  828. background: #ffffff;
  829. z-index: 999;
  830. position: fixed;
  831. top: 0;
  832. left: 0;
  833. background-size: cover;
  834. background-image: url(https://static.caimei365.com/app/crm/image/statistic_bg2.png);
  835. &.fiexd {
  836. }
  837. &.first {
  838. }
  839. }
  840. .header-top {
  841. width: 100%;
  842. font-size: 16px;
  843. font-weight: 500;
  844. height: 32px;
  845. display: flex;
  846. align-items: center;
  847. justify-content: center;
  848. position: relative;
  849. padding: 0 40rpx;
  850. }
  851. .header-sit {
  852. width: 100%;
  853. box-sizing: border-box;
  854. height: 80rpx;
  855. line-height: 80rpx;
  856. box-sizing: border-box;
  857. color: #ffffff;
  858. .header-sit-text {
  859. text-align: left;
  860. font-size: $font-size-40;
  861. font-weight: 600;
  862. font-family: '正楷';
  863. }
  864. .iconfont {
  865. display: block;
  866. width: 80rpx;
  867. height: 80rpx;
  868. float: left;
  869. text-align: center;
  870. line-height: 80rpx;
  871. font-size: 42rpx;
  872. }
  873. }
  874. .tui-header-tabs {
  875. width: 100%;
  876. height: auto;
  877. margin-bottom: 40rpx;
  878. padding: 20rpx 24rpx;
  879. background: #ffffff;
  880. box-sizing: border-box;
  881. position: fixed;
  882. z-index: 999;
  883. box-shadow: 0 10rpx 10rpx 0 rgba(86, 119, 252, 0.2);
  884. .tui-header-top {
  885. width: 100%;
  886. height: 66rpx;
  887. box-sizing: border-box;
  888. float: left;
  889. .title {
  890. float: left;
  891. line-height: 66rpx;
  892. color: #333333;
  893. text-align: left;
  894. font-size: $font-size-30;
  895. font-weight: 600;
  896. }
  897. .tui-header-button {
  898. float: right;
  899. box-sizing: border-box;
  900. height: 100%;
  901. line-height: 66rpx;
  902. .button {
  903. float: left;
  904. box-sizing: border-box;
  905. padding: 0 24rpx;
  906. height: 100%;
  907. line-height: 66rpx;
  908. border-radius: 35rpx;
  909. text-align: center;
  910. color: #ffffff;
  911. margin-left: 10rpx;
  912. &.btn-confirm {
  913. background: $color-system;
  914. }
  915. &.btn-error {
  916. background: #fdf6ec;
  917. color: #e6a23c;
  918. font-size: $font-size-24;
  919. }
  920. }
  921. }
  922. }
  923. .tui-header-item {
  924. width: 100%;
  925. height: auto;
  926. margin-top: 10rpx;
  927. position: relative;
  928. float: left;
  929. .list-title-t {
  930. width: 100%;
  931. height: 50rpx;
  932. float: left;
  933. font-size: $font-size-28;
  934. padding-bottom: 10rpx;
  935. margin-bottom: 10rpx;
  936. .list-title-num {
  937. float: left;
  938. text-align: left;
  939. color: #999999;
  940. margin-left: 30rpx;
  941. line-height: 40rpx;
  942. font-size: $font-size-24;
  943. }
  944. .list-title-tip {
  945. float: left;
  946. .badges {
  947. display: block;
  948. float: left;
  949. padding: 0 15rpx;
  950. height: 36rpx;
  951. line-height: 36rpx;
  952. border-radius: 18rpx;
  953. background: #ecf5ff;
  954. font-size: $font-size-22;
  955. text-align: center;
  956. color: #409eff;
  957. }
  958. }
  959. }
  960. .list-title-b {
  961. width: 100%;
  962. height: 40rpx;
  963. float: left;
  964. font-size: $font-size-24;
  965. line-height: 40rpx;
  966. color: #666666;
  967. text-align: left;
  968. .text {
  969. color: #999999;
  970. }
  971. .list-title-b-item {
  972. width: 50%;
  973. height: 100%;
  974. float: left;
  975. }
  976. &.sms {
  977. height: 100rpx;
  978. padding: 10rpx;
  979. border-radius: 4rpx;
  980. .text {
  981. height: 100%;
  982. text-overflow: ellipsis;
  983. overflow: hidden;
  984. display: -webkit-box;
  985. -webkit-line-clamp: 2;
  986. line-clamp: 2;
  987. -webkit-box-orient: vertical;
  988. }
  989. }
  990. }
  991. .list-icon {
  992. width: 120rpx;
  993. height: 120rpx;
  994. border-radius: 10rpx;
  995. position: absolute;
  996. right: 0;
  997. top: 0;
  998. color: #dd524d;
  999. z-index: 99;
  1000. .list-icon-image {
  1001. width: 120rpx;
  1002. height: 120rpx;
  1003. display: block;
  1004. }
  1005. }
  1006. }
  1007. .tui-header-tabmain {
  1008. width: 100%;
  1009. height: 70rpx;
  1010. float: left;
  1011. position: relative;
  1012. &.day {
  1013. height: 70rpx;
  1014. box-sizing: border-box;
  1015. padding: 20rpx 0;
  1016. border-top: 1px solid #efefef;
  1017. }
  1018. .main-item {
  1019. float: left;
  1020. text-align: left;
  1021. color: #ffffff;
  1022. box-sizing: border-box;
  1023. &.one {
  1024. width: 25%;
  1025. .text {
  1026. width: 100%;
  1027. height: 70rpx;
  1028. line-height: 70rpx;
  1029. display: block;
  1030. float: left;
  1031. font-size: $font-size-28;
  1032. color: #666666;
  1033. text-align: left;
  1034. font-weight: 600;
  1035. font-family: '正楷';
  1036. }
  1037. }
  1038. &.tab {
  1039. width: 140rpx;
  1040. border-radius: 30rpx;
  1041. background: #f7f7f7;
  1042. margin-right: 15rpx;
  1043. padding: 0 20rpx;
  1044. .text {
  1045. width: 100%;
  1046. height: 50rpx;
  1047. line-height: 50rpx;
  1048. display: block;
  1049. float: left;
  1050. font-size: $font-size-24;
  1051. color: #666666;
  1052. text-align: center;
  1053. }
  1054. }
  1055. &.active {
  1056. .text {
  1057. color: $btn-confirm;
  1058. font-size: $font-size-28;
  1059. position: relative;
  1060. &::before {
  1061. content: '';
  1062. width: 60rpx;
  1063. height: 4rpx;
  1064. background: $btn-confirm;
  1065. position: absolute;
  1066. left: 50%;
  1067. bottom: 0;
  1068. margin-left: -60rpx;
  1069. }
  1070. }
  1071. }
  1072. &.tabActive {
  1073. background: $btn-confirm;
  1074. .text {
  1075. color: #ffffff;
  1076. }
  1077. }
  1078. }
  1079. .input {
  1080. width: 100%;
  1081. height: 70rpx;
  1082. box-sizing: border-box;
  1083. padding: 0 20rpx;
  1084. padding-left: 70rpx;
  1085. background: #f7f7f7;
  1086. border-radius: 35rpx;
  1087. font-size: $font-size-26;
  1088. }
  1089. .icon-sousuo {
  1090. width: 80rpx;
  1091. height: 70rpx;
  1092. display: block;
  1093. line-height: 70rpx;
  1094. text-align: center;
  1095. color: #999999;
  1096. font-size: $font-size-38;
  1097. position: absolute;
  1098. left: 0;
  1099. top: 0;
  1100. }
  1101. }
  1102. .button-content {
  1103. width: 100%;
  1104. height: auto;
  1105. float: left;
  1106. position: relative;
  1107. .btn {
  1108. height: 64rpx;
  1109. padding: 0 20rpx;
  1110. margin: 10rpx 0 0 0;
  1111. line-height: 64rpx;
  1112. font-size: $font-size-26;
  1113. text-align: center;
  1114. border-radius: 6rpx;
  1115. float: right;
  1116. }
  1117. .btn-confirm {
  1118. background-color: #ff5000;
  1119. color: #ffffff;
  1120. }
  1121. }
  1122. }
  1123. .distinguish-button {
  1124. width: 100%;
  1125. position: fixed;
  1126. bottom: 0;
  1127. left: 0;
  1128. background-color: #ffffff;
  1129. padding: 0 50rpx;
  1130. padding-top: 20rpx;
  1131. z-index: 1000;
  1132. .button {
  1133. width: 100%;
  1134. height: 80rpx;
  1135. background: $btn-confirm;
  1136. border-radius: 40rpx;
  1137. text-align: center;
  1138. color: #ffffff;
  1139. line-height: 80rpx;
  1140. font-size: $font-size-28;
  1141. box-shadow: 0 10rpx 14rpx 0 rgba(86, 119, 252, 0.2);
  1142. }
  1143. }
  1144. .user-section {
  1145. position: absolute;
  1146. width: 100%;
  1147. }
  1148. .header-content {
  1149. width: 100%;
  1150. height: auto;
  1151. position: relative;
  1152. background-color: #f7f7f7;
  1153. .tui-header-btm {
  1154. width: 100%;
  1155. padding: 0 30rpx;
  1156. box-sizing: border-box;
  1157. display: flex;
  1158. align-items: center;
  1159. justify-content: space-between;
  1160. color: #fff;
  1161. }
  1162. }
  1163. .tui-order-list {
  1164. margin-top: 24rpx;
  1165. width: 100%;
  1166. position: relative;
  1167. box-sizing: border-box;
  1168. padding: 0 20rpx;
  1169. }
  1170. .tui-order-content {
  1171. width: 100%;
  1172. height: auto;
  1173. }
  1174. .tui-order-item {
  1175. display: flex;
  1176. flex-direction: column;
  1177. width: 100%;
  1178. padding: 20rpx 20rpx;
  1179. background: #fff;
  1180. margin-bottom: 24rpx;
  1181. border-radius: 8rpx;
  1182. position: relative;
  1183. .list-checked {
  1184. width: 80rpx;
  1185. height: 80rpx;
  1186. line-height: 80rpx;
  1187. text-align: center;
  1188. position: absolute;
  1189. right: 0;
  1190. top: 0;
  1191. .iconfont {
  1192. font-size: 38rpx;
  1193. color: $color-system;
  1194. }
  1195. }
  1196. .list-detail {
  1197. width: 70rpx;
  1198. height: 80rpx;
  1199. line-height: 80rpx;
  1200. text-align: center;
  1201. position: absolute;
  1202. right: 0;
  1203. bottom: 0;
  1204. .iconfont {
  1205. font-size: $font-size-32;
  1206. color: #999999;
  1207. }
  1208. }
  1209. }
  1210. .tui-prompt-flex {
  1211. width: 100%;
  1212. height: 70rpx;
  1213. display: flex;
  1214. margin-top: 20rpx;
  1215. .btn {
  1216. flex: 1;
  1217. line-height: 70rpx;
  1218. font-size: $font-size-26;
  1219. text-align: center;
  1220. color: #ffffff;
  1221. border-radius: 33rpx;
  1222. margin: 0 24rpx;
  1223. &.btn-cancel {
  1224. background: #f7f7f7;
  1225. color: #999999;
  1226. }
  1227. &.btn-confirm {
  1228. background: $color-system;
  1229. }
  1230. }
  1231. }
  1232. .tui-prompt-text {
  1233. line-height: 44rpx;
  1234. font-size: $font-size-26;
  1235. color: #333333;
  1236. .text {
  1237. color: $color-system;
  1238. }
  1239. }
  1240. </style>