order.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. <template>
  2. <view class="main">
  3. <view class="top">
  4. <view class="tab" v-for="(item, index) in status" :key="index" :class="index == lindex ? 'native' : ''"
  5. @click="getthis(index)">{{ item.name }}</view>
  6. </view>
  7. <view class="list">
  8. <!-- <view class="nodata" v-if="orders.length == 0">暂无数据</view> -->
  9. <view class="order-box" v-for="(item, index) in orders" :key="index" v-if="orders.length > 0">
  10. <view class="order-box-item" @click="godetail(item)">
  11. <view class="title">
  12. <view class="id">订单号:{{ item.order_sn }}</view>
  13. <view
  14. :class="{ status: item.order_status_new == 2||item.order_status_new == 4, statusTwo: item.order_status_new == 1, statusThree: item.order_status_new == 5, statusFour: item.order_status_new == 3,statusFive:item.order_status_new == 6 }">
  15. {{ item.order_status_new == 1 ? '待支付' : item.order_status_new == 2 ? '待评估' : item.order_status_new == 3 ? '待审核' : item.order_status_new == 4 ?'已评估': item.order_status_new == 5 ?'已完成':'已取消'}}
  16. </view>
  17. </view>
  18. <view class="goods">
  19. <image v-if="item.type==2" src="../../static/index/3166d3d1d9b79004291261c7e8357a3.jpg"
  20. mode="" />
  21. <image v-if="item.type==1" src="../../static/index/47e8bab2b5b68f3fff001bce06e0a11.jpg"
  22. mode="" />
  23. <view class="margin-left-sm">
  24. <view class="name">{{ item.type_text }}</view>
  25. <view class="name" style="font-size: 24rpx;" v-if="item.type==1">项目类型:个人征信异议申诉</view>
  26. <view class="name" style="font-size: 24rpx;" v-else>项目类型:企业信用问题咨询</view>
  27. <view class="name" style="font-size: 24rpx;">创建时间:{{ item.created_at }}</view>
  28. </view>
  29. <view
  30. v-if="item.order_status_new == 1||item.order_status_new == 2||item.order_status_new == 3||item.order_status_new == 6"
  31. class="price">
  32. <text style="color:#555864 ;"></text>
  33. ¥{{ item.place_payment_amount/100 }}
  34. </view>
  35. <view v-else-if="item.order_status_new == 4||item.order_status_new == 5" class="price">
  36. <text style="color:#555864 ;"></text>
  37. ¥{{ item.total_price }}
  38. </view>
  39. </view>
  40. <view class="goods" v-if="item.managers!=null">
  41. <image style="border-radius: 50%;" :src="item.managers.avatar" mode="" />
  42. <view class="margin-left-sm">
  43. <view class="name">信用管理师姓名:{{item.managers.name}}</view>
  44. <view class="name" style="font-size: 24rpx;">信用管理师接单时间:{{item.morders.start_time||'未接单'}}</view>
  45. <view class="name" style="font-size: 24rpx;">信用管理师联系电话:{{ item.managers.phone }}</view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="btns" v-if="item.order_status_new == 1||item.order_status_new == 6">
  50. <view v-if="item.order_status_new == 1" class="btn" style="border-color:#f5cc57;color: #f5cc57;"
  51. @click="paymentOrder(item)">
  52. 支付订单
  53. </view>
  54. <!-- <view class="btn" @click="godetail(item)" data-target="cancel">查看详情</view> -->
  55. <view v-if="item.order_status_new == 1" class="btn" @click="cancelOrder(item)" data-target="cancel">
  56. 取消订单</view>
  57. <view v-if="item.order_status_new == 6" class="btn"
  58. style="background-color:rgb(222,132,133);color: #fff;border-color:rgb(222,132,133);"
  59. @click="delOrder(item)">
  60. 删除订单
  61. </view>
  62. </view>
  63. </view>
  64. <uni-load-more :loadingType="loadingType" :contentText="contentText" />
  65. </view>
  66. <!-- 弹出框 -->
  67. <view class="cu-modal" :class="modalName == 'cancel' ? 'show' : ''">
  68. <view class="cu-dialog">
  69. <view class="cu-bar bg-white justify-end">
  70. <view class="content">订单取消</view>
  71. <view class="action" @tap="hideModal">
  72. <text class="cuIcon-close yellow"></text>
  73. </view>
  74. </view>
  75. <view class="cu-bar bg-white">
  76. <view class="action margin-0 flex-sub yellow solid-left" @tap="hideModal">取消</view>
  77. <view class="action margin-0 flex-sub solid-left" @tap="cancel">确定</view>
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 是否支付 -->
  82. <view class="cu-modal" :class="modalName == 'ispay' ? 'show' : ''">
  83. <view class="cu-dialog">
  84. <view class="cu-bar bg-white justify-end">
  85. <view class="content">订单提示</view>
  86. <!-- <view class="action" @tap="hideModal">
  87. <text class="cuIcon-close yellow" />
  88. </view> -->
  89. </view>
  90. <view class="padding-xl">是否完成支付?</view>
  91. <view class="cu-bar bg-white">
  92. <!-- <view class="action margin-0 flex-sub yellow solid-left" @tap="hideModal">取消</view> -->
  93. <view class="action margin-0 flex-sub solid-left" @tap="ispaytrue">已经完成支付</view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </template>
  99. <script>
  100. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  101. export default {
  102. components: {
  103. uniLoadMore
  104. },
  105. data() {
  106. return {
  107. orders: [],
  108. param: {
  109. screen_status: 1
  110. },
  111. loadingType: 0,
  112. contentText: {
  113. contentdown: '上拉显示更多',
  114. contentrefresh: '正在加载...',
  115. contentnomore: '没有更多数据了'
  116. },
  117. status: [{
  118. name: '全部',
  119. param: {
  120. screen_status: 0
  121. }
  122. },
  123. {
  124. name: '评估中',
  125. param: {
  126. screen_status: 1
  127. }
  128. },
  129. {
  130. name: '修复中',
  131. param: {
  132. screen_status: 2
  133. }
  134. },
  135. {
  136. name: '已完成',
  137. param: {
  138. screen_status: 3
  139. }
  140. },
  141. {
  142. name: '已取消',
  143. param: {
  144. screen_status: 4
  145. }
  146. }
  147. ],
  148. lindex: 0,
  149. modalName: null,
  150. thisOrder: {},
  151. order_sn_num: ""
  152. };
  153. },
  154. onLoad(option) {
  155. this.lindex = option.index;
  156. },
  157. onShow() {
  158. this.findOrderList();
  159. },
  160. onReachBottom() {
  161. if (this.loadingType !== 0) {
  162. return;
  163. }
  164. this.loadingType = 1;
  165. this.loadPage();
  166. },
  167. methods: {
  168. async ispaytrue() {
  169. this.modalName = ''
  170. let res = await this.$request.post("/api/payment/getWebPayResult", {
  171. trade_sn: this.order_sn_num
  172. }, false)
  173. if (res.code == 200) {
  174. uni.redirectTo({
  175. url: "paysource?id=" + this.id + "&payment_status=" + this.order.order.payment_status
  176. })
  177. } else {
  178. uni.showToast({
  179. title: "支付失败",
  180. icon: "none",
  181. duration: 1000
  182. })
  183. setTimeout(() => {
  184. uni.navigateBack({
  185. delta: 1
  186. })
  187. }, 1000)
  188. }
  189. },
  190. async paymentOrder(item) {
  191. this.thisOrder = item
  192. if (this.$util.is_weixin()) {
  193. let res = await this.$request.post('/api/payment/payPlaceOrder', {
  194. order_id: item.id,
  195. plat_type: 1
  196. }, true);
  197. if (res.code == 200) {
  198. this.modalName = 'ispay'
  199. this.order_sn_num = res.data.trade_sn
  200. if (typeof WeixinJSBridge == "undefined") {
  201. if (document.addEventListener) {
  202. document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady, false);
  203. } else if (document.attachEvent) {
  204. document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady);
  205. document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady);
  206. }
  207. } else {
  208. this.onBridgeReady(res)
  209. }
  210. } else {
  211. uni.showModal({
  212. title: '错误信息',
  213. content: res.message,
  214. showCancel: false
  215. });
  216. }
  217. } else {
  218. let res = await this.$request.post("/api/payment/wbePayPlaceOrder", {
  219. order_id: item.id
  220. })
  221. if (res.code == 200) {
  222. this.modalName = 'ispay'
  223. this.order_sn_num = res.data.trade_sn
  224. window.location.href = res.data.mweb_url
  225. }
  226. }
  227. },
  228. onBridgeReady: function(res) {
  229. WeixinJSBridge.invoke(
  230. 'getBrandWCPayRequest', {
  231. "appId": res.data.appId,
  232. "timeStamp": res.data.timeStamp,
  233. "nonceStr": res.data.nonceStr,
  234. "package": res.data.package,
  235. "signType": res.data.signType,
  236. "paySign": res.data.paySign
  237. },
  238. function(re) {
  239. if (re.err_msg == "get_brand_wcpay_request:ok") {
  240. uni.navigateTo({
  241. url: "paysource?id=" + this.thisOrder.id + "&payment_status=" + this
  242. .thisOrder.payment_status
  243. })
  244. }
  245. });
  246. },
  247. // 下拉刷新
  248. // onPullDownRefresh: function(){
  249. // this.loadPage();
  250. // console.log('下拉刷新')
  251. // setTimeout(function () {
  252. // uni.stopPullDownRefresh();
  253. // }, 1000);
  254. // },
  255. // 下拉刷新
  256. onPullDownRefresh() {
  257. this.findOrderList();
  258. },
  259. getthis(e) {
  260. this.lindex = e;
  261. this.findOrderList();
  262. },
  263. godetail(e) {
  264. uni.navigateTo({
  265. url: '/pages/mine/detail?id=' + e.id + '&payment_status=' + e.payment_status
  266. });
  267. },
  268. delOrder(item) {
  269. uni.showModal({
  270. title: "提示",
  271. content: "你确定要删除吗?",
  272. success: (res) => {
  273. if (res.confirm) {
  274. this.$request.post("/api/order/orderHandle", {
  275. order_id: item.id,
  276. handle_type: 2
  277. }).then(data => {
  278. if (data.code == 200) {
  279. this.findOrderList();
  280. }
  281. }).catch(err => {})
  282. }
  283. }
  284. })
  285. },
  286. cancelOrder(item) {
  287. this.modalName = 'cancel';
  288. this.thisOrder = item;
  289. },
  290. async cancel(e) {
  291. let data = await this.$request.post('/api/order/cancelOrder', {
  292. order_id: this.thisOrder.id
  293. }, false);
  294. console.log(data)
  295. if (data.code == 200) {
  296. this.findOrderList();
  297. this.modalName = '';
  298. } else {
  299. uni.showToast({
  300. icon: 'none',
  301. title: data.message
  302. });
  303. }
  304. },
  305. hideModal(e) {
  306. this.modalName = null;
  307. },
  308. findOrderList: function() {
  309. this.loadingType = 1;
  310. this.param.page = 0;
  311. this.loadPage();
  312. },
  313. loadPage: async function() {
  314. if (this.loadingType == 2) {
  315. return;
  316. }
  317. try {
  318. this.param = Object.assign(this.param, this.status[this.lindex].param);
  319. this.param.page++;
  320. console.log(this.param)
  321. let data = await this.$request.post('/api/order/orderList', this.param, false);
  322. console.log(data)
  323. if (data.code == 200) {
  324. if (data.data.current_page == 1) {
  325. this.orders = [];
  326. }
  327. this.orders = this.orders.concat(data.data.data);
  328. if (data.data.current_page == data.data.last_page) {
  329. this.loadingType = 2;
  330. } else {
  331. this.loadingType = 0;
  332. }
  333. } else {
  334. uni.showToast({
  335. icon: 'none',
  336. title: data.message
  337. });
  338. this.loadingType = 0;
  339. }
  340. } catch (e) {
  341. console.info(e)
  342. uni.showToast({
  343. icon: 'none',
  344. title: '数据获取失败'
  345. });
  346. this.loadingType = 0;
  347. }
  348. uni.stopPullDownRefresh();
  349. }
  350. }
  351. };
  352. </script>
  353. <style>
  354. page {
  355. background: #f5f5f5;
  356. }
  357. .main {
  358. width: 100vw;
  359. height: auto;
  360. margin-bottom: 20px;
  361. }
  362. .main .top {
  363. width: 100%;
  364. height: 40px;
  365. display: flex;
  366. justify-content: space-around;
  367. }
  368. .top .tab {
  369. width: auto;
  370. height: 40px;
  371. font-size: 16px;
  372. line-height: 50px;
  373. text-align: center;
  374. color: #666;
  375. }
  376. .top .native {
  377. border-bottom: 2px solid #f5cc57;
  378. color: #f5cc57;
  379. }
  380. .list {
  381. width: 90vw;
  382. height: auto;
  383. margin: 20px 5vw;
  384. }
  385. .list .nodata {
  386. width: 100%;
  387. height: 40px;
  388. line-height: 40px;
  389. text-align: center;
  390. color: #888;
  391. }
  392. .order-box {
  393. position: relative;
  394. width: 90vw;
  395. height: auto;
  396. padding: 14px;
  397. background: #fff;
  398. border-radius: 8px;
  399. margin-bottom: 15px;
  400. font-size: 14px;
  401. }
  402. .order-box .title {
  403. width: 100%;
  404. height: 40px;
  405. line-height: 40px;
  406. display: flex;
  407. justify-content: space-between;
  408. color: #8c8e96;
  409. border-bottom: 1px solid rgba(216, 216, 216, 1);
  410. }
  411. .status {
  412. color: #f5cc57;
  413. }
  414. .statusTwo {
  415. color: #ed462f;
  416. }
  417. .statusThree {
  418. color: #00b563;
  419. }
  420. .statusFour {
  421. color: #00a3dd;
  422. }
  423. .statusFive {
  424. color: #8c8e96;
  425. }
  426. .order-box .goods {
  427. width: 100%;
  428. height: 95px;
  429. display: flex;
  430. /* justify-content: space-between; */
  431. align-items: center;
  432. padding: 15px 0;
  433. border-bottom: 1px solid rgba(216, 216, 216, 1);
  434. }
  435. .goods image {
  436. width: 70px;
  437. height: 70px;
  438. background: #eee;
  439. }
  440. .goods .price {
  441. position: absolute;
  442. right: 4px;
  443. top: 70px;
  444. width: auto;
  445. height: 30px;
  446. line-height: 30px;
  447. padding: 0 10px;
  448. color: #ed462f;
  449. }
  450. .goods .name {
  451. /* position: absolute;
  452. left: 95px; */
  453. width: auto;
  454. /* height: 80px; */
  455. /* line-height: 80px; */
  456. color: #555864;
  457. margin-bottom: 15rpx;
  458. }
  459. .btns {
  460. width: 100%;
  461. height: 40px;
  462. }
  463. .btns .btn {
  464. width: auto;
  465. height: 30px;
  466. line-height: 30px;
  467. padding: 0 15px;
  468. border: 1px solid #979797;
  469. color: #979797;
  470. margin: 5px;
  471. float: right;
  472. border-radius: 5px;
  473. }
  474. .yellow {
  475. color: #f5cc57;
  476. }
  477. </style>