index.vue 31 KB

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