index.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238
  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="搜索关键词(客户名称/订单ID)"
  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 { listOrderTabs , listOrderStateTabs } from '@/utils/config.tabs.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: listOrderTabs,
  252. listReturnType: listOrderStateTabs,
  253. listQuery: Object.assign({}, defaultListQuery),
  254. refundListQuery: Object.assign({}, defaultRefundListQuery),
  255. currents: 0,
  256. tabCurrents: 0,
  257. orderList: [],
  258. scrollTop: 0,
  259. isEmpty: false,
  260. loadding: false,
  261. pullUpOn: true,
  262. hasNextPage: false,
  263. pullFlag: true,
  264. navbarHeight: '',
  265. nomoreText: '上拉显示更多',
  266. contentModalText: '', //操作文字提示语句
  267. modal: false,
  268. modal1: false,
  269. modal2: false,
  270. modal3: false,
  271. hanldOrder: '', //储存监听订单信息
  272. OperationType: '', //操作类型
  273. isCmcustomClass: 'left',
  274. isShowHeader: false,
  275. height: 64, //header高度
  276. top: 0, //标题图标距离顶部距离
  277. scrollH: 0, //滚动总高度
  278. opcity: 1,
  279. checkedOrderList: [],
  280. checkedIds: [],
  281. checkedRefundIndex: '',
  282. confirmParams: {
  283. confirmType: 4,
  284. id: 0,
  285. orderIds: ''
  286. },
  287. confirmRefundParams: {
  288. shopOrderId: 0,
  289. id: 0
  290. },
  291. skeletonShow: true,
  292. modelTpye: 1, // 收款弹窗类型
  293. totalOrder: {
  294. orderNums: 1,
  295. payTotalFee: 0, // 订单金额
  296. balancePayFee: 0, // 余额抵扣
  297. payableAmount: 0, // 应收金额
  298. paidAmount: 0, // 已收金额
  299. surplusAmount: 0 // 剩余应收
  300. } ,// 统计都选相同的订单数据
  301. isShareType:false
  302. }
  303. },
  304. onLoad(option) {
  305. let obj = {}
  306. uni.getSystemInfo({
  307. success: res => {
  308. this.width = obj.left || res.windowWidth
  309. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44
  310. this.top = obj.top ? obj.top + (obj.height - 32) / 2 : res.statusBarHeight + 6
  311. this.scrollH = res.windowWidth * 0.6
  312. }
  313. })
  314. if(option.type == 'share'){ this.isShareType = true }
  315. this.listQuery.id = this.confirmParams.id = this.confirmRefundParams.id = option.id
  316. this.getOrderReceiptDetail(this.listQuery.id)
  317. },
  318. computed: {
  319. ...mapState(['hasLogin'])
  320. },
  321. methods: {
  322. getOrderReceiptDetail(id) {
  323. // 收款详情
  324. this.OrderService.orderReceiptDetail({ id: id })
  325. .then(response => {
  326. this.receiptInfo = response.data
  327. this.getOrderReceiptOrders()
  328. })
  329. .catch(err => {
  330. this.$api.navigateTo('/pages/login/login-error')
  331. })
  332. },
  333. getOrderReceiptOrders() {
  334. // 收款详情-订单列表
  335. this.initListQuery()
  336. this.OrderService.orderReceiptOrders(this.listQuery)
  337. .then(response => {
  338. let data = response.data
  339. this.hasNextPage = response.data.hasNextPage
  340. if (data.list && data.list.length > 0) {
  341. this.isEmpty = false
  342. this.orderList = data.list.map((el, index) => {
  343. el.isChecked = false
  344. return el
  345. })
  346. this.pullFlag = false
  347. setTimeout(() => {
  348. this.pullFlag = true
  349. }, 500)
  350. if (this.hasNextPage) {
  351. this.pullUpOn = false
  352. this.nomoreText = '上拉显示更多'
  353. } else {
  354. if (this.orderList.length < 3) {
  355. this.pullUpOn = true
  356. } else {
  357. this.pullUpOn = false
  358. this.loadding = false
  359. this.nomoreText = '已至底部'
  360. }
  361. }
  362. } else {
  363. this.isEmpty = true
  364. }
  365. this.skeletonShow = false
  366. })
  367. .catch(err => {
  368. this.$util.msg(err.msg, 2000)
  369. })
  370. },
  371. orderReceiptRefundOrders() {
  372. // 收款详情-退款子订单列表
  373. this.OrderService.orderReceiptRefundOrders(this.refundListQuery)
  374. .then(response => {
  375. let data = response.data
  376. this.hasNextPage = response.data.hasNextPage
  377. if (data.list && data.list.length > 0) {
  378. this.isEmpty = false
  379. this.orderList = data.list.map((el, index) => {
  380. el.isChecked = false
  381. return el
  382. })
  383. this.pullFlag = false
  384. setTimeout(() => {
  385. this.pullFlag = true
  386. }, 500)
  387. if (this.hasNextPage) {
  388. this.pullUpOn = false
  389. this.nomoreText = '上拉显示更多'
  390. } else {
  391. if (this.orderList.length < 3) {
  392. this.pullUpOn = true
  393. } else {
  394. this.pullUpOn = false
  395. this.loadding = false
  396. this.nomoreText = '已至底部'
  397. }
  398. }
  399. } else {
  400. this.isEmpty = true
  401. }
  402. })
  403. .catch(err => {
  404. this.$util.msg(err.msg, 2000)
  405. })
  406. },
  407. orderReceiptRefundOrdersBottom() {
  408. this.refundListQuery.pageNum += 1
  409. this.OrderService.orderReceiptRefundOrders(this.refundListQuery)
  410. .then(response => {
  411. let data = response.data
  412. if (data.list && data.list.length > 0) {
  413. this.hasNextPage = data.hasNextPage
  414. let list = data.list.map((el, index) => {
  415. el.isChecked = false
  416. return el
  417. })
  418. this.orderList = this.orderList.concat(list)
  419. this.pullFlag = false // 防上拉暴滑
  420. setTimeout(() => {
  421. this.pullFlag = true
  422. }, 500)
  423. if (this.hasNextPage) {
  424. this.pullUpOn = false
  425. this.nomoreText = '上拉显示更多'
  426. } else {
  427. this.pullUpOn = false
  428. this.loadding = false
  429. this.nomoreText = '已至底部'
  430. }
  431. }
  432. })
  433. .catch(err => {
  434. this.$util.msg(err.msg, 2000)
  435. })
  436. },
  437. orderReceiptOrdersBottom() {
  438. this.listQuery.pageNum += 1
  439. this.OrderService.orderReceiptOrders(this.listQuery)
  440. .then(response => {
  441. let data = response.data
  442. if (data.list && data.list.length > 0) {
  443. this.hasNextPage = data.hasNextPage
  444. let list = data.list.map((el, index) => {
  445. el.isChecked = false
  446. return el
  447. })
  448. this.orderList = this.orderList.concat(list)
  449. this.pullFlag = false // 防上拉暴滑
  450. setTimeout(() => {
  451. this.pullFlag = true
  452. }, 500)
  453. if (this.hasNextPage) {
  454. this.pullUpOn = false
  455. this.nomoreText = '上拉显示更多'
  456. } else {
  457. this.pullUpOn = false
  458. this.loadding = false
  459. this.nomoreText = '已至底部'
  460. }
  461. }
  462. })
  463. .catch(err => {
  464. this.$util.msg(err.msg, 2000)
  465. })
  466. },
  467. subMitSearch(type) {
  468. // 确认搜索
  469. switch (type) {
  470. case 1: // 订单
  471. this.getOrderReceiptOrders()
  472. break
  473. case 2: // 订单
  474. this.refundListQuery.pageNum = 1
  475. this.orderReceiptRefundOrders()
  476. break
  477. }
  478. },
  479. getOnReachBottomData() {
  480. //上拉加载
  481. if (this.currents == 3) {
  482. this.orderReceiptRefundOrdersBottom()
  483. } else {
  484. this.orderReceiptOrdersBottom()
  485. }
  486. },
  487. orderDetail(id) {
  488. //订单详情跳转
  489. this.$api.navigateTo(`/pages/relation/order/detail?orderId=${id}`)
  490. },
  491. handleClick(e) {
  492. //用户操作订单
  493. let index = e.index
  494. if (index == 1) {
  495. }
  496. this.modal = false
  497. },
  498. confirmDistinguish() {
  499. // 点击确认
  500. const list = []
  501. this.checkedOrderList.forEach(el => {
  502. if (list.indexOf(el.userId) == -1) {
  503. list.push(el.userId)
  504. }
  505. })
  506. if (this.checkedOrderList.length == 0) {
  507. this.$util.msg('请选择订单!', 2000)
  508. return
  509. }
  510. if (this.currents === 1) {
  511. // 订金订单每次只能关联一个订单
  512. if (this.checkedOrderList.length > 1) {
  513. this.$util.msg('订金订单每次只能关联一个订单!', 2000)
  514. return
  515. }
  516. }
  517. if (list.length > 1) {
  518. this.$util.msg('请选择相同机构的订单!', 2000)
  519. return
  520. }
  521. let payTotalFee = 0 //订单金额
  522. let balancePayFee = 0 //余额抵扣
  523. let payableAmount = 0 //应收金额
  524. let paidAmount = 0 //已收金额
  525. let surplusAmount = 0 //剩余应收
  526. this.checkedOrderList.forEach(el => {
  527. payTotalFee += el.payTotalFee
  528. balancePayFee += el.balancePayFee
  529. payableAmount += el.payableAmount
  530. paidAmount += el.paidAmount
  531. surplusAmount += el.surplusAmount
  532. this.checkedIds.push(el.orderId)
  533. })
  534. // 赋值
  535. this.totalOrder.payTotalFee = Number(payTotalFee.toFixed(2))
  536. this.totalOrder.surplusAmount = Number(surplusAmount.toFixed(2))
  537. this.totalOrder.balancePayFee = Number(balancePayFee.toFixed(2))
  538. this.totalOrder.payableAmount = Number(payableAmount.toFixed(2))
  539. this.totalOrder.paidAmount = Number(paidAmount.toFixed(2))
  540. this.totalOrder.orderNums = this.checkedOrderList.length
  541. if (this.currents === 1) {
  542. // 收款金额必须等于订金订单金额才能关联
  543. if (this.receiptInfo.receiptAmount != this.totalOrder.payTotalFee) {
  544. this.$util.msg('收款金额必须等于订金订单金额才能关联!', 2000)
  545. return
  546. }
  547. }
  548. console.log('totalOrder', this.totalOrder)
  549. //处理收款状态的几种类型
  550. if (
  551. this.receiptInfo.receiptAmount == this.totalOrder.surplusAmount ||
  552. this.totalOrder.surplusAmount - this.receiptInfo.receiptAmount >= 10
  553. ) {
  554. //收款金额等于订单应收金额 或者是 订单应收总金额减去收款金额大于等于10
  555. this.modelTpye = 1
  556. console.log('收款金额等于订单剩余应收金额 或者是 收款金额减去订单剩余应收金额大于等于10', this.modelTpye)
  557. } else if (this.receiptInfo.receiptAmount > this.totalOrder.surplusAmount) {
  558. //收款金额大于订单神域应收金额(可退款到余额)
  559. this.modelTpye = 2
  560. console.log('收款金额大于订单应收金额(可退款到余额)', this.modelTpye)
  561. } else if (this.totalOrder.surplusAmount - this.receiptInfo.receiptAmount <= 10) {
  562. //订单剩余应收总金额减去收款金额小于等于10元时,才能抹平确认
  563. this.modelTpye = 3
  564. console.log('订单剩余应收总金额减去收款金额小于等于10元时,才能抹平确认)', this.modelTpye)
  565. }
  566. this.modal1 = true
  567. },
  568. confirmDistinguishRefund() {
  569. //确认关联供应商退款子订单
  570. if (this.confirmRefundParams.shopOrderId == 0) {
  571. this.$util.msg('请选择订单!', 2000)
  572. return
  573. }
  574. this.orderReceiptConfirmRefund(this.confirmRefundParams)
  575. },
  576. handleClick1(data) {
  577. switch (data) {
  578. case 1: // 小额抹平确认
  579. this.confirmParams.confirmType = data
  580. this.confirmParams.orderIds = this.checkedIds.join(',')
  581. this.orderReceiptConfirm()
  582. this.modal1 = false
  583. break
  584. case 3: // 大额退款余额
  585. this.confirmParams.confirmType = data
  586. this.confirmParams.orderIds = this.checkedIds.join(',')
  587. this.orderReceiptConfirm()
  588. this.modal1 = false
  589. break
  590. case 4: // 确认关联
  591. this.confirmParams.confirmType = data
  592. this.confirmParams.orderIds = this.checkedIds.join(',')
  593. this.orderReceiptConfirm()
  594. this.modal1 = false
  595. break
  596. }
  597. },
  598. orderReceiptConfirmRefund(params) {
  599. //确认关联退款子订单
  600. this.OrderService.orderReceiptConfirmRefund(params)
  601. .then(response => {
  602. this.$util.msg('关联成功~', 2000, true, 'success')
  603. setTimeout(() => {
  604. this.$api.redirectTo(`/pages/relation/refund/detail?id=${this.confirmRefundParams.id}`)
  605. }, 2000)
  606. })
  607. .catch(err => {
  608. this.modal3 = true
  609. this.contentModalText = err.msg
  610. })
  611. },
  612. orderReceiptConfirm() {
  613. //确认关联订单或抹平或退款余额
  614. this.OrderService.orderReceiptConfirm(this.confirmParams)
  615. .then(response => {
  616. this.$api.redirectTo(`/pages/relation/ordinary/examine-detail?id=${this.confirmParams.id}`)
  617. })
  618. .catch(err => {
  619. this.$util.msg(err.msg, 2000)
  620. })
  621. },
  622. checkedOrder(order) {
  623. // 勾选关联订单
  624. order.isChecked = !order.isChecked
  625. if (order.isChecked) {
  626. this.checkedOrderList.push(order)
  627. } else {
  628. this.checkedOrderList.splice(this.checkedOrderList.indexOf(order), 1)
  629. }
  630. },
  631. checkedRefundOrder(order, index) {
  632. // 勾选退款子订单
  633. this.checkedOrderList = []
  634. this.checkedRefundIndex = index
  635. this.orderList.forEach((el, index) => {
  636. if (this.checkedRefundIndex == index) {
  637. el.isChecked = true
  638. this.confirmRefundParams.shopOrderId = el.shopOrderId
  639. } else {
  640. el.isChecked = false
  641. }
  642. })
  643. },
  644. hideMobel(type) {
  645. switch (type) {
  646. case 0:
  647. this.modal = false
  648. break
  649. case 1:
  650. this.modal1 = false
  651. break
  652. case 2:
  653. this.modal2 = false
  654. break
  655. case 3:
  656. this.modal3 = false
  657. break
  658. }
  659. },
  660. formatColor(state) {
  661. //设置邀请码状态亚瑟
  662. let stateColor = '',
  663. stateColorObject = {
  664. 1: '#ff7900',
  665. 2: '#4cd964',
  666. 3: '#19be6b',
  667. 4: '#ed3f14',
  668. 5: '#F74D54'
  669. }
  670. Object.keys(stateColorObject).forEach(function(key) {
  671. if (key == state) {
  672. stateColor = stateColorObject[key]
  673. }
  674. })
  675. return stateColor
  676. },
  677. tabClick(type, index) {
  678. this.pullUpOn = true //切换时隐藏
  679. this.loadding = false //切换时隐藏
  680. this.listQuery.type = 0 //切换是设置订单类型
  681. switch (type) {
  682. case 1: // 切换订单类型
  683. this.currents = index
  684. this.tabCurrents = 0
  685. switch (this.currents) {
  686. case 0: // 商品订单
  687. this.listQuery.organizeId = 0
  688. this.getOrderReceiptOrders()
  689. break
  690. case 1:
  691. this.listQuery.type = 1
  692. this.listQuery.organizeId = 0
  693. this.getOrderReceiptOrders()
  694. break
  695. case 2:
  696. this.listQuery.organizeId = 3
  697. this.getOrderReceiptOrders()
  698. break
  699. case 3:
  700. this.refundListQuery.pageNum = 1
  701. this.orderReceiptRefundOrders()
  702. break
  703. }
  704. break
  705. case 2: // 切换收款状态
  706. this.tabCurrents = index
  707. if (this.currents == 3) {
  708. if (this.tabCurrents == 0) {
  709. this.refundListQuery.confirmedType = 0
  710. } else {
  711. this.refundListQuery.confirmedType = 2
  712. }
  713. this.refundListQuery.pageNum = 1
  714. this.orderReceiptRefundOrders()
  715. } else {
  716. if (this.tabCurrents == 0) {
  717. this.listQuery.orderReceiptStatus = '1,2'
  718. } else {
  719. this.listQuery.orderReceiptStatus = '3'
  720. }
  721. this.getOrderReceiptOrders()
  722. }
  723. }
  724. },
  725. toNoSms(url) {
  726. this.$api.navigateTo(url)
  727. },
  728. showReceiptModel() {
  729. //
  730. this.modal2 = true
  731. },
  732. initListQuery(){// 初始化
  733. this.loadding = true
  734. this.pullUpOn = true
  735. this.orderList = []
  736. this.checkedOrderList=[]
  737. this.listQuery.pageNum = 1
  738. },
  739. formatReceiptType(value) {
  740. //订单状态文字和颜色
  741. var HtmlStateText = '',
  742. stateTextObject = {
  743. 1: '订单款',
  744. 2: '非订单款',
  745. 3: '返佣款',
  746. 4: '订单款或者非订单款',
  747. 5: '供应商退款'
  748. }
  749. Object.keys(stateTextObject).forEach(function(key) {
  750. if (key == value) {
  751. HtmlStateText = stateTextObject[key]
  752. }
  753. })
  754. return HtmlStateText
  755. },
  756. },
  757. onPageScroll(e) {
  758. //实时获取到滚动的值
  759. if (e.scrollTop > 30) {
  760. this.isCmcustomClass = 'fiexd'
  761. } else {
  762. this.isCmcustomClass = 'left'
  763. }
  764. if (e.scrollTop > 180) {
  765. this.isShowHeader = true
  766. } else {
  767. this.isShowHeader = false
  768. }
  769. },
  770. onReachBottom() {
  771. if (this.hasNextPage) {
  772. this.loadding = true
  773. this.pullUpOn = true
  774. this.getOnReachBottomData()
  775. }
  776. },
  777. onPullDownRefresh() {
  778. setTimeout(() => {
  779. this.getOrderReceiptOrders()
  780. uni.stopPullDownRefresh()
  781. }, 200)
  782. },
  783. onShareAppMessage(res) {
  784. //分享购买优惠券
  785. const receipt = this.receiptInfo
  786. const receiptTypeText = this.formatReceiptType(receipt.receiptType)
  787. if (res.from === 'button') {
  788. // console.log('来自页面内转发按钮')
  789. }
  790. return {
  791. title: `【${receipt.receiptStatusText}[${receiptTypeText}]】收款金额${receipt.receiptAmount.toFixed(2)}元,收款时间:${receipt.receiptDate}`,
  792. path: `/pages/login/login-share?id=${receipt.id}`,
  793. imageUrl: 'https://static.caimei365.com/app/crm/image/icon-share@2x.jpg'
  794. }
  795. },
  796. onShow() {
  797. this.$api.getComStorage('userInfo').then(resolve => {
  798. this.listQuery.merchantId = resolve.id
  799. // this.getOrderDatainit(this.currents)
  800. })
  801. }
  802. }
  803. </script>
  804. <style lang="scss">
  805. @import '@/uni.scss';
  806. page {
  807. background: #f7f7f7;
  808. }
  809. .tui-header-box {
  810. width: 100%;
  811. background: #ffffff;
  812. z-index: 999;
  813. position: fixed;
  814. top: 0;
  815. left: 0;
  816. background-size: cover;
  817. background-image: url(https://static.caimei365.com/app/crm/image/statistic_bg2.png);
  818. &.fiexd {
  819. }
  820. &.first {
  821. }
  822. }
  823. .header-top {
  824. width: 100%;
  825. font-size: 16px;
  826. font-weight: 500;
  827. height: 32px;
  828. display: flex;
  829. align-items: center;
  830. justify-content: center;
  831. position: relative;
  832. padding: 0 40rpx;
  833. }
  834. .header-sit {
  835. width: 100%;
  836. box-sizing: border-box;
  837. height: 80rpx;
  838. line-height: 80rpx;
  839. box-sizing: border-box;
  840. color: #ffffff;
  841. .header-sit-text {
  842. text-align: left;
  843. font-size: $font-size-40;
  844. font-weight: 600;
  845. font-family: '正楷';
  846. }
  847. .iconfont {
  848. display: block;
  849. width: 80rpx;
  850. height: 80rpx;
  851. float: left;
  852. text-align: center;
  853. line-height: 80rpx;
  854. font-size: 42rpx;
  855. }
  856. }
  857. .tui-header-tabs {
  858. width: 100%;
  859. height: auto;
  860. margin-bottom: 40rpx;
  861. padding: 20rpx 24rpx;
  862. background: #ffffff;
  863. box-sizing: border-box;
  864. position: fixed;
  865. z-index: 999;
  866. box-shadow: 0 10rpx 10rpx 0 rgba(86, 119, 252, 0.2);
  867. .tui-header-top {
  868. width: 100%;
  869. height: 66rpx;
  870. box-sizing: border-box;
  871. float: left;
  872. .title {
  873. float: left;
  874. line-height: 66rpx;
  875. color: #333333;
  876. text-align: left;
  877. font-size: $font-size-30;
  878. font-weight: 600;
  879. }
  880. .tui-header-button {
  881. float: right;
  882. box-sizing: border-box;
  883. height: 100%;
  884. line-height: 66rpx;
  885. .button {
  886. float: left;
  887. box-sizing: border-box;
  888. padding: 0 24rpx;
  889. height: 100%;
  890. line-height: 66rpx;
  891. border-radius: 8rpx;
  892. text-align: center;
  893. color: #ffffff;
  894. margin-left: 10rpx;
  895. &.btn-confirm {
  896. background: $color-system;
  897. }
  898. &.btn-error {
  899. background: #f0ad4e;
  900. }
  901. }
  902. }
  903. }
  904. .tui-header-item {
  905. width: 100%;
  906. height: auto;
  907. margin-top: 10rpx;
  908. position: relative;
  909. float: left;
  910. .list-title-t {
  911. width: 100%;
  912. height: 50rpx;
  913. float: left;
  914. font-size: $font-size-28;
  915. padding-bottom: 10rpx;
  916. margin-bottom: 10rpx;
  917. .list-title-num {
  918. float: left;
  919. text-align: left;
  920. color: #999999;
  921. margin-left: 30rpx;
  922. line-height: 40rpx;
  923. }
  924. .list-title-tip {
  925. float: left;
  926. .badges {
  927. display: block;
  928. float: left;
  929. padding: 0 15rpx;
  930. height: 40rpx;
  931. line-height: 40rpx;
  932. border-radius: 4rpx;
  933. background: $btn-confirm;
  934. font-size: $font-size-24;
  935. text-align: center;
  936. color: #ffffff;
  937. }
  938. }
  939. }
  940. .list-title-b {
  941. width: 100%;
  942. height: 40rpx;
  943. float: left;
  944. font-size: $font-size-24;
  945. line-height: 40rpx;
  946. color: #666666;
  947. text-align: left;
  948. .text {
  949. color: #999999;
  950. }
  951. .list-title-b-item {
  952. width: 50%;
  953. height: 100%;
  954. float: left;
  955. }
  956. &.sms {
  957. height: 100rpx;
  958. padding: 10rpx;
  959. border-radius: 4rpx;
  960. .text{
  961. height: 100%;
  962. text-overflow: ellipsis;
  963. overflow: hidden;
  964. display: -webkit-box;
  965. -webkit-line-clamp: 2;
  966. line-clamp: 2;
  967. -webkit-box-orient: vertical;
  968. }
  969. }
  970. }
  971. .list-icon {
  972. width: 120rpx;
  973. height: 120rpx;
  974. border-radius: 10rpx;
  975. position: absolute;
  976. right: 0;
  977. top: 0;
  978. color: #dd524d;
  979. z-index: 99;
  980. .list-icon-image {
  981. width: 120rpx;
  982. height: 120rpx;
  983. display: block;
  984. }
  985. }
  986. }
  987. .tui-header-tabmain {
  988. width: 100%;
  989. height: 70rpx;
  990. float: left;
  991. position: relative;
  992. &.day {
  993. height: 70rpx;
  994. box-sizing: border-box;
  995. padding: 20rpx 0;
  996. border-top: 1px solid #efefef;
  997. }
  998. .main-item {
  999. float: left;
  1000. text-align: left;
  1001. color: #ffffff;
  1002. box-sizing: border-box;
  1003. &.one {
  1004. width: 25%;
  1005. .text {
  1006. width: 100%;
  1007. height: 70rpx;
  1008. line-height: 70rpx;
  1009. display: block;
  1010. float: left;
  1011. font-size: $font-size-28;
  1012. color: #666666;
  1013. text-align: left;
  1014. font-weight: 600;
  1015. font-family: '正楷';
  1016. }
  1017. }
  1018. &.tab {
  1019. width: 140rpx;
  1020. border-radius: 8rpx;
  1021. background: #f7f7f7;
  1022. margin-right: 15rpx;
  1023. padding: 0 20rpx;
  1024. .text {
  1025. width: 100%;
  1026. height: 50rpx;
  1027. line-height: 50rpx;
  1028. display: block;
  1029. float: left;
  1030. font-size: $font-size-24;
  1031. color: #666666;
  1032. text-align: center;
  1033. }
  1034. }
  1035. &.active {
  1036. .text {
  1037. color: $btn-confirm;
  1038. font-size: $font-size-28;
  1039. position: relative;
  1040. &::before{
  1041. content: '';
  1042. width: 60rpx;
  1043. height: 4rpx;
  1044. background: $btn-confirm;
  1045. position: absolute;
  1046. left: 0;
  1047. bottom: 0;
  1048. }
  1049. }
  1050. }
  1051. &.tabActive {
  1052. background: $btn-confirm;
  1053. .text {
  1054. color: #ffffff;
  1055. }
  1056. }
  1057. }
  1058. .input {
  1059. width: 100%;
  1060. height: 70rpx;
  1061. box-sizing: border-box;
  1062. padding: 0 20rpx;
  1063. padding-left: 70rpx;
  1064. background: #f7f7f7;
  1065. border-radius: 8rpx;
  1066. font-size: $font-size-26;
  1067. }
  1068. .icon-sousuo {
  1069. width: 80rpx;
  1070. height: 70rpx;
  1071. display: block;
  1072. line-height: 70rpx;
  1073. text-align: center;
  1074. color: #999999;
  1075. font-size: $font-size-38;
  1076. position: absolute;
  1077. left: 0;
  1078. top: 0;
  1079. }
  1080. }
  1081. .button-content {
  1082. width: 100%;
  1083. height: auto;
  1084. float: left;
  1085. position: relative;
  1086. .btn {
  1087. height: 64rpx;
  1088. padding: 0 20rpx;
  1089. margin: 10rpx 0 0 0;
  1090. line-height: 64rpx;
  1091. font-size: $font-size-26;
  1092. text-align: center;
  1093. border-radius: 6rpx;
  1094. float: right;
  1095. }
  1096. .btn-confirm {
  1097. background-color: #ff5000;
  1098. color: #ffffff;
  1099. }
  1100. }
  1101. }
  1102. .distinguish-button {
  1103. width: 100%;
  1104. position: fixed;
  1105. bottom: 0;
  1106. left: 0;
  1107. background-color: #ffffff;
  1108. padding: 0 50rpx;
  1109. padding-top: 20rpx;
  1110. z-index: 1000;
  1111. .button {
  1112. width: 100%;
  1113. height: 80rpx;
  1114. background: $btn-confirm;
  1115. border-radius: 40rpx;
  1116. text-align: center;
  1117. color: #ffffff;
  1118. line-height: 80rpx;
  1119. font-size: $font-size-28;
  1120. box-shadow: 0 10rpx 14rpx 0 rgba(86, 119, 252, 0.2);
  1121. }
  1122. }
  1123. .user-section {
  1124. position: absolute;
  1125. width: 100%;
  1126. }
  1127. .header-content {
  1128. width: 100%;
  1129. height: auto;
  1130. position: relative;
  1131. background-color: #f7f7f7;
  1132. .tui-header-btm {
  1133. width: 100%;
  1134. padding: 0 30rpx;
  1135. box-sizing: border-box;
  1136. display: flex;
  1137. align-items: center;
  1138. justify-content: space-between;
  1139. color: #fff;
  1140. }
  1141. }
  1142. .tui-order-list {
  1143. margin-top: 24rpx;
  1144. width: 100%;
  1145. position: relative;
  1146. box-sizing: border-box;
  1147. padding: 0 20rpx;
  1148. }
  1149. .tui-order-content {
  1150. width: 100%;
  1151. height: auto;
  1152. }
  1153. .tui-order-item {
  1154. display: flex;
  1155. flex-direction: column;
  1156. width: 100%;
  1157. padding: 20rpx 20rpx;
  1158. background: #fff;
  1159. margin-bottom: 24rpx;
  1160. border-radius: 8rpx;
  1161. position: relative;
  1162. .list-checked {
  1163. width: 80rpx;
  1164. height: 80rpx;
  1165. line-height: 80rpx;
  1166. text-align: center;
  1167. position: absolute;
  1168. right: 0;
  1169. top: 0;
  1170. .iconfont {
  1171. font-size: 38rpx;
  1172. color: $color-system;
  1173. }
  1174. }
  1175. .list-detail {
  1176. width: 70rpx;
  1177. height: 80rpx;
  1178. line-height: 80rpx;
  1179. text-align: center;
  1180. position: absolute;
  1181. right: 0;
  1182. bottom: 0;
  1183. .iconfont {
  1184. font-size: $font-size-32;
  1185. color: #999999;
  1186. }
  1187. }
  1188. }
  1189. .tui-prompt-flex {
  1190. width: 100%;
  1191. height: 70rpx;
  1192. display: flex;
  1193. margin-top: 20rpx;
  1194. .btn {
  1195. flex: 1;
  1196. line-height: 70rpx;
  1197. font-size: $font-size-26;
  1198. text-align: center;
  1199. color: #ffffff;
  1200. border-radius: 33rpx;
  1201. margin: 0 24rpx;
  1202. &.btn-cancel {
  1203. background: #f7f7f7;
  1204. color: #999999;
  1205. }
  1206. &.btn-confirm {
  1207. background: $color-system;
  1208. }
  1209. }
  1210. }
  1211. .tui-prompt-text {
  1212. line-height: 44rpx;
  1213. font-size: $font-size-26;
  1214. color: #333333;
  1215. .text {
  1216. color: $color-system;
  1217. }
  1218. }
  1219. </style>