index.vue 30 KB

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