index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239
  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. this.listQuery.type = 0 //切换是设置订单类型
  682. switch (type) {
  683. case 1: // 切换订单类型
  684. this.currents = index
  685. this.tabCurrents = 0
  686. switch (this.currents) {
  687. case 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.organizeId = 3
  698. this.getOrderReceiptOrders()
  699. break
  700. case 3:
  701. this.refundListQuery.pageNum = 1
  702. this.orderReceiptRefundOrders()
  703. break
  704. }
  705. break
  706. case 2: // 切换收款状态
  707. this.tabCurrents = index
  708. if (this.currents == 3) {
  709. if (this.tabCurrents == 0) {
  710. this.refundListQuery.confirmedType = 0
  711. } else {
  712. this.refundListQuery.confirmedType = 2
  713. }
  714. this.refundListQuery.pageNum = 1
  715. this.orderReceiptRefundOrders()
  716. } else {
  717. if (this.tabCurrents == 0) {
  718. this.listQuery.orderReceiptStatus = '1,2'
  719. } else {
  720. this.listQuery.orderReceiptStatus = '3'
  721. }
  722. this.getOrderReceiptOrders()
  723. }
  724. }
  725. },
  726. toNoSms(url) {
  727. this.$api.navigateTo(url)
  728. },
  729. showReceiptModel() {
  730. //
  731. this.modal2 = true
  732. },
  733. initListQuery(){// 初始化
  734. this.loadding = true
  735. this.pullUpOn = true
  736. this.orderList = []
  737. this.checkedOrderList=[]
  738. this.listQuery.pageNum = 1
  739. },
  740. formatReceiptType(value) {
  741. //订单状态文字和颜色
  742. var HtmlStateText = '',
  743. stateTextObject = {
  744. 1: '订单款',
  745. 2: '非订单款',
  746. 3: '返佣款',
  747. 4: '订单款或者非订单款',
  748. 5: '供应商退款'
  749. }
  750. Object.keys(stateTextObject).forEach(function(key) {
  751. if (key == value) {
  752. HtmlStateText = stateTextObject[key]
  753. }
  754. })
  755. return HtmlStateText
  756. },
  757. },
  758. onPageScroll(e) {
  759. //实时获取到滚动的值
  760. if (e.scrollTop > 30) {
  761. this.isCmcustomClass = 'fiexd'
  762. } else {
  763. this.isCmcustomClass = 'left'
  764. }
  765. if (e.scrollTop > 180) {
  766. this.isShowHeader = true
  767. } else {
  768. this.isShowHeader = false
  769. }
  770. },
  771. onReachBottom() {
  772. if (this.hasNextPage) {
  773. this.loadding = true
  774. this.pullUpOn = true
  775. this.getOnReachBottomData()
  776. }
  777. },
  778. onPullDownRefresh() {
  779. setTimeout(() => {
  780. this.getOrderReceiptOrders()
  781. uni.stopPullDownRefresh()
  782. }, 200)
  783. },
  784. onShareAppMessage(res) {
  785. //分享购买优惠券
  786. const receipt = this.receiptInfo
  787. const receiptTypeText = this.formatReceiptType(receipt.receiptType)
  788. if (res.from === 'button') {
  789. // console.log('来自页面内转发按钮')
  790. }
  791. return {
  792. title: `【${receipt.receiptStatusText}[${receiptTypeText}]】收款金额${receipt.receiptAmount.toFixed(2)}元,收款时间:${receipt.receiptDate}`,
  793. path: `/pages/login/login-share?id=${receipt.id}`,
  794. imageUrl: 'https://static.caimei365.com/app/crm/image/icon-share@2x.jpg'
  795. }
  796. },
  797. onShow() {
  798. this.$api.getComStorage('userInfo').then(resolve => {
  799. this.listQuery.merchantId = resolve.id
  800. // this.getOrderDatainit(this.currents)
  801. })
  802. }
  803. }
  804. </script>
  805. <style lang="scss">
  806. @import '@/uni.scss';
  807. page {
  808. background: #f7f7f7;
  809. }
  810. .tui-header-box {
  811. width: 100%;
  812. background: #ffffff;
  813. z-index: 999;
  814. position: fixed;
  815. top: 0;
  816. left: 0;
  817. background-size: cover;
  818. background-image: url(https://static.caimei365.com/app/crm/image/statistic_bg2.png);
  819. &.fiexd {
  820. }
  821. &.first {
  822. }
  823. }
  824. .header-top {
  825. width: 100%;
  826. font-size: 16px;
  827. font-weight: 500;
  828. height: 32px;
  829. display: flex;
  830. align-items: center;
  831. justify-content: center;
  832. position: relative;
  833. padding: 0 40rpx;
  834. }
  835. .header-sit {
  836. width: 100%;
  837. box-sizing: border-box;
  838. height: 80rpx;
  839. line-height: 80rpx;
  840. box-sizing: border-box;
  841. color: #ffffff;
  842. .header-sit-text {
  843. text-align: left;
  844. font-size: $font-size-40;
  845. font-weight: 600;
  846. font-family: '正楷';
  847. }
  848. .iconfont {
  849. display: block;
  850. width: 80rpx;
  851. height: 80rpx;
  852. float: left;
  853. text-align: center;
  854. line-height: 80rpx;
  855. font-size: 42rpx;
  856. }
  857. }
  858. .tui-header-tabs {
  859. width: 100%;
  860. height: auto;
  861. margin-bottom: 40rpx;
  862. padding: 20rpx 24rpx;
  863. background: #ffffff;
  864. box-sizing: border-box;
  865. position: fixed;
  866. z-index: 999;
  867. box-shadow: 0 10rpx 10rpx 0 rgba(86, 119, 252, 0.2);
  868. .tui-header-top {
  869. width: 100%;
  870. height: 66rpx;
  871. box-sizing: border-box;
  872. float: left;
  873. .title {
  874. float: left;
  875. line-height: 66rpx;
  876. color: #333333;
  877. text-align: left;
  878. font-size: $font-size-30;
  879. font-weight: 600;
  880. }
  881. .tui-header-button {
  882. float: right;
  883. box-sizing: border-box;
  884. height: 100%;
  885. line-height: 66rpx;
  886. .button {
  887. float: left;
  888. box-sizing: border-box;
  889. padding: 0 24rpx;
  890. height: 100%;
  891. line-height: 66rpx;
  892. border-radius: 8rpx;
  893. text-align: center;
  894. color: #ffffff;
  895. margin-left: 10rpx;
  896. &.btn-confirm {
  897. background: $color-system;
  898. }
  899. &.btn-error {
  900. background: #f0ad4e;
  901. }
  902. }
  903. }
  904. }
  905. .tui-header-item {
  906. width: 100%;
  907. height: auto;
  908. margin-top: 10rpx;
  909. position: relative;
  910. float: left;
  911. .list-title-t {
  912. width: 100%;
  913. height: 50rpx;
  914. float: left;
  915. font-size: $font-size-28;
  916. padding-bottom: 10rpx;
  917. margin-bottom: 10rpx;
  918. .list-title-num {
  919. float: left;
  920. text-align: left;
  921. color: #999999;
  922. margin-left: 30rpx;
  923. line-height: 40rpx;
  924. }
  925. .list-title-tip {
  926. float: left;
  927. .badges {
  928. display: block;
  929. float: left;
  930. padding: 0 15rpx;
  931. height: 40rpx;
  932. line-height: 40rpx;
  933. border-radius: 4rpx;
  934. background: $btn-confirm;
  935. font-size: $font-size-24;
  936. text-align: center;
  937. color: #ffffff;
  938. }
  939. }
  940. }
  941. .list-title-b {
  942. width: 100%;
  943. height: 40rpx;
  944. float: left;
  945. font-size: $font-size-24;
  946. line-height: 40rpx;
  947. color: #666666;
  948. text-align: left;
  949. .text {
  950. color: #999999;
  951. }
  952. .list-title-b-item {
  953. width: 50%;
  954. height: 100%;
  955. float: left;
  956. }
  957. &.sms {
  958. height: 100rpx;
  959. padding: 10rpx;
  960. border-radius: 4rpx;
  961. .text{
  962. height: 100%;
  963. text-overflow: ellipsis;
  964. overflow: hidden;
  965. display: -webkit-box;
  966. -webkit-line-clamp: 2;
  967. line-clamp: 2;
  968. -webkit-box-orient: vertical;
  969. }
  970. }
  971. }
  972. .list-icon {
  973. width: 120rpx;
  974. height: 120rpx;
  975. border-radius: 10rpx;
  976. position: absolute;
  977. right: 0;
  978. top: 0;
  979. color: #dd524d;
  980. z-index: 99;
  981. .list-icon-image {
  982. width: 120rpx;
  983. height: 120rpx;
  984. display: block;
  985. }
  986. }
  987. }
  988. .tui-header-tabmain {
  989. width: 100%;
  990. height: 70rpx;
  991. float: left;
  992. position: relative;
  993. &.day {
  994. height: 70rpx;
  995. box-sizing: border-box;
  996. padding: 20rpx 0;
  997. border-top: 1px solid #efefef;
  998. }
  999. .main-item {
  1000. float: left;
  1001. text-align: left;
  1002. color: #ffffff;
  1003. box-sizing: border-box;
  1004. &.one {
  1005. width: 25%;
  1006. .text {
  1007. width: 100%;
  1008. height: 70rpx;
  1009. line-height: 70rpx;
  1010. display: block;
  1011. float: left;
  1012. font-size: $font-size-28;
  1013. color: #666666;
  1014. text-align: left;
  1015. font-weight: 600;
  1016. font-family: '正楷';
  1017. }
  1018. }
  1019. &.tab {
  1020. width: 140rpx;
  1021. border-radius: 8rpx;
  1022. background: #f7f7f7;
  1023. margin-right: 15rpx;
  1024. padding: 0 20rpx;
  1025. .text {
  1026. width: 100%;
  1027. height: 50rpx;
  1028. line-height: 50rpx;
  1029. display: block;
  1030. float: left;
  1031. font-size: $font-size-24;
  1032. color: #666666;
  1033. text-align: center;
  1034. }
  1035. }
  1036. &.active {
  1037. .text {
  1038. color: $btn-confirm;
  1039. font-size: $font-size-28;
  1040. position: relative;
  1041. &::before{
  1042. content: '';
  1043. width: 60rpx;
  1044. height: 4rpx;
  1045. background: $btn-confirm;
  1046. position: absolute;
  1047. left: 0;
  1048. bottom: 0;
  1049. }
  1050. }
  1051. }
  1052. &.tabActive {
  1053. background: $btn-confirm;
  1054. .text {
  1055. color: #ffffff;
  1056. }
  1057. }
  1058. }
  1059. .input {
  1060. width: 100%;
  1061. height: 70rpx;
  1062. box-sizing: border-box;
  1063. padding: 0 20rpx;
  1064. padding-left: 70rpx;
  1065. background: #f7f7f7;
  1066. border-radius: 8rpx;
  1067. font-size: $font-size-26;
  1068. }
  1069. .icon-sousuo {
  1070. width: 80rpx;
  1071. height: 70rpx;
  1072. display: block;
  1073. line-height: 70rpx;
  1074. text-align: center;
  1075. color: #999999;
  1076. font-size: $font-size-38;
  1077. position: absolute;
  1078. left: 0;
  1079. top: 0;
  1080. }
  1081. }
  1082. .button-content {
  1083. width: 100%;
  1084. height: auto;
  1085. float: left;
  1086. position: relative;
  1087. .btn {
  1088. height: 64rpx;
  1089. padding: 0 20rpx;
  1090. margin: 10rpx 0 0 0;
  1091. line-height: 64rpx;
  1092. font-size: $font-size-26;
  1093. text-align: center;
  1094. border-radius: 6rpx;
  1095. float: right;
  1096. }
  1097. .btn-confirm {
  1098. background-color: #ff5000;
  1099. color: #ffffff;
  1100. }
  1101. }
  1102. }
  1103. .distinguish-button {
  1104. width: 100%;
  1105. position: fixed;
  1106. bottom: 0;
  1107. left: 0;
  1108. background-color: #ffffff;
  1109. padding: 0 50rpx;
  1110. padding-top: 20rpx;
  1111. z-index: 1000;
  1112. .button {
  1113. width: 100%;
  1114. height: 80rpx;
  1115. background: $btn-confirm;
  1116. border-radius: 40rpx;
  1117. text-align: center;
  1118. color: #ffffff;
  1119. line-height: 80rpx;
  1120. font-size: $font-size-28;
  1121. box-shadow: 0 10rpx 14rpx 0 rgba(86, 119, 252, 0.2);
  1122. }
  1123. }
  1124. .user-section {
  1125. position: absolute;
  1126. width: 100%;
  1127. }
  1128. .header-content {
  1129. width: 100%;
  1130. height: auto;
  1131. position: relative;
  1132. background-color: #f7f7f7;
  1133. .tui-header-btm {
  1134. width: 100%;
  1135. padding: 0 30rpx;
  1136. box-sizing: border-box;
  1137. display: flex;
  1138. align-items: center;
  1139. justify-content: space-between;
  1140. color: #fff;
  1141. }
  1142. }
  1143. .tui-order-list {
  1144. margin-top: 24rpx;
  1145. width: 100%;
  1146. position: relative;
  1147. box-sizing: border-box;
  1148. padding: 0 20rpx;
  1149. }
  1150. .tui-order-content {
  1151. width: 100%;
  1152. height: auto;
  1153. }
  1154. .tui-order-item {
  1155. display: flex;
  1156. flex-direction: column;
  1157. width: 100%;
  1158. padding: 20rpx 20rpx;
  1159. background: #fff;
  1160. margin-bottom: 24rpx;
  1161. border-radius: 8rpx;
  1162. position: relative;
  1163. .list-checked {
  1164. width: 80rpx;
  1165. height: 80rpx;
  1166. line-height: 80rpx;
  1167. text-align: center;
  1168. position: absolute;
  1169. right: 0;
  1170. top: 0;
  1171. .iconfont {
  1172. font-size: 38rpx;
  1173. color: $color-system;
  1174. }
  1175. }
  1176. .list-detail {
  1177. width: 70rpx;
  1178. height: 80rpx;
  1179. line-height: 80rpx;
  1180. text-align: center;
  1181. position: absolute;
  1182. right: 0;
  1183. bottom: 0;
  1184. .iconfont {
  1185. font-size: $font-size-32;
  1186. color: #999999;
  1187. }
  1188. }
  1189. }
  1190. .tui-prompt-flex {
  1191. width: 100%;
  1192. height: 70rpx;
  1193. display: flex;
  1194. margin-top: 20rpx;
  1195. .btn {
  1196. flex: 1;
  1197. line-height: 70rpx;
  1198. font-size: $font-size-26;
  1199. text-align: center;
  1200. color: #ffffff;
  1201. border-radius: 33rpx;
  1202. margin: 0 24rpx;
  1203. &.btn-cancel {
  1204. background: #f7f7f7;
  1205. color: #999999;
  1206. }
  1207. &.btn-confirm {
  1208. background: $color-system;
  1209. }
  1210. }
  1211. }
  1212. .tui-prompt-text {
  1213. line-height: 44rpx;
  1214. font-size: $font-size-26;
  1215. color: #333333;
  1216. .text {
  1217. color: $color-system;
  1218. }
  1219. }
  1220. </style>