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