myOrder.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. <template>
  2. <view class="box">
  3. <homenav :iStatusBarHeight="iStatusBarHeight" :title="'我的订单'" :cj="3"></homenav>
  4. <view class="tab">
  5. <view class="tabLine" :class="{tabActive:tabIndex==0}" @click="tabClick(0)">全部</view>
  6. <view class="tabLine" :class="{tabActive:tabIndex==1}" @click="tabClick(1)">待付款</view>
  7. <view class="tabLine" :class="{tabActive:tabIndex==5}" @click="tabClick(5)">待成团</view>
  8. <view class="tabLine" :class="{tabActive:tabIndex==2}" @click="tabClick(2)">待服务</view>
  9. <view class="tabLine" :class="{tabActive:tabIndex==3}" @click="tabClick(3)">已完成</view>
  10. </view>
  11. <view class="main">
  12. <view class="itemBg" v-for="(item,index) in items" @click="goDetail(item)">
  13. <view class="itemTop">
  14. <view class="orderCodeBox">
  15. <view class="itemType" v-if="item.SheetType==1">商城-商品订单</view>
  16. <view class="itemType" v-if="item.SheetType==2">商城-项目订单</view>
  17. <view class="itemType" v-if="item.SheetType==3">商城-套餐订单</view>
  18. <view class="itemType" v-if="item.SheetType==4">救援订单</view>
  19. <view class="itemType" v-if="item.SheetType==5">钣喷订单</view>
  20. <view class="itemType" v-if="item.SheetType==6">集客订单</view>
  21. <view class="itemType" v-if="item.SheetType==7">保养订单</view>
  22. <view class="itemType" v-else></view>
  23. <view class="orderCode">:{{item.Code}}</view>
  24. </view>
  25. <view class="itemSheetState redColor" v-if="item.SheetState==5">待成团</view>
  26. <view class="itemSheetState redColor" v-if="item.SheetState==1">待付款</view>
  27. <!-- <view v-if="item.SheetType==7">
  28. <view class="itemSheetState orangeColor" v-if="item.SheetState==2">已完成</view>
  29. </view> -->
  30. <view class="itemSheetState orangeColor" v-if="item.SheetState==2">待服务</view>
  31. <view class="itemSheetState greenColor" v-if="item.SheetState==3">已完成</view>
  32. <view class="itemSheetState" v-if="item.SheetState==4">已取消</view>
  33. </view>
  34. <view class="itemShopBg">
  35. <view class="shopName">{{item.SheetContent}}</view>
  36. <view style="color: #333333;font-size: 22rpx;">¥<span class="price">{{item.PayType==1?item.RealMoney:0}}</span></view>
  37. </view>
  38. <view class="renBox" v-if="item.SheetType==6">
  39. <image src="../../../static/timg/icon_ren.png" mode="" class="renimg"></image>
  40. <view class="renMobilePhone">{{item.MobilePhone}}</view>
  41. <view class="renNickName">{{item.NickName?item.NickName:''}}</view>
  42. </view>
  43. <view class="itemName">{{item.CreateTime}}</view>
  44. <view class="itemName" style="padding-top: 2rpx;padding-bottom: 0;">{{item.ShopName}}</view>
  45. <view class="package" v-if="item.SheetType==7" style="display: flex;">
  46. <view class="packageName" v-if="item.packageName">{{item.packageName}}</view>
  47. <view class="packageQty" v-if="item.packageQty" style="padding-left: 10rpx;">共{{item.packageQty}}件</view>
  48. </view>
  49. <view class="bottom" v-if="item.SheetState == 1">
  50. <view class="cancel" @click.stop="cancelBespeak(item)">取消订单</view>
  51. <view class="defer" @click.stop="pay(item)">立即支付</view>
  52. </view>
  53. </view>
  54. <nodata v-show="items==''&&isload"></nodata>
  55. </view>
  56. <!-- 手机号授权 -->
  57. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  58. <view class="authorizCont" @click.stop="">
  59. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  60. <view class="authorizMs">未注册的手机号登录后将自动创建会员账号,如果您不同意授权获取手机号,会影响您使用我们的产品和服务。</view>
  61. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  62. </view>
  63. <view style="text-align: center;padding-top: 56rpx;">
  64. <image src="../../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. import nodata from '@/components/nodata/nodata.vue'
  71. import homenav from "@/components/homenav/nav.vue"
  72. export default {
  73. components: {
  74. nodata,homenav
  75. },
  76. data() {
  77. return {
  78. page: 1,
  79. tabIndex: '',
  80. items: [],
  81. isload: false,
  82. iStatusBarHeight:'',
  83. userInfo:'',
  84. ext:'',
  85. wxOpenData:'',
  86. themeColor:'',
  87. authorizShow:false,
  88. code:'',
  89. }
  90. },
  91. onLoad(opt) {
  92. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  93. this.tabIndex = opt.num;
  94. this.userInfo=this.$store.state.userInfo;
  95. this.ext=this.$common.getExtStoreId();
  96. this.themeColor = uni.getStorageSync("themeColor");
  97. if(this.userInfo){
  98. this.getData()
  99. }else{
  100. this.$common.automaticlogin().then(val => {
  101. this.userInfo=this.$store.state.userInfo;
  102. this.wxOpenData=this.$store.state.wxOpenData;
  103. this.themeColor = uni.getStorageSync("themeColor");
  104. this.getData();
  105. if(!this.userInfo){
  106. this.authorizShow=true
  107. }
  108. })
  109. }
  110. },
  111. onShow() {
  112. console.log(this.tabIndex)
  113. this.getData()
  114. },
  115. methods: {
  116. pay(item){
  117. this.$http('openMallOrder/unifiedPay', {
  118. sheetId:item.ID
  119. },'POST').then(res => {
  120. if(res.code==0){
  121. this.requestPayment(res.data)
  122. }else{
  123. uni.showToast({
  124. title: res.msg,
  125. icon: 'none',
  126. duration: 3000
  127. });
  128. }
  129. })
  130. },
  131. requestPayment(res){
  132. var payInfo=res;
  133. //console.log(payInfo)
  134. //console.log(String(Date.now()))
  135. var that=this;
  136. uni.requestPayment({
  137. provider: 'wxpay',
  138. //timeStamp: String(Date.now()),
  139. timeStamp: payInfo.timeStamp,
  140. nonceStr: payInfo.nonceStr,
  141. package:payInfo.package,
  142. signType: payInfo.signType,
  143. paySign: payInfo.paySign,
  144. appid:payInfo.appId,
  145. success: function (res) {
  146. console.log('success:' + JSON.stringify(res));
  147. uni.showToast({
  148. title: '支付成功',
  149. icon:'none',
  150. duration: 2000
  151. });
  152. that.tabIndex=0
  153. that.page = 1;
  154. that.getData()
  155. },
  156. fail: function (err) {
  157. console.log(err)
  158. uni.showToast({
  159. title: '支付失败',
  160. icon:'none',
  161. duration: 2000
  162. });
  163. }
  164. });
  165. },
  166. cancelBespeak(item){
  167. var that = this
  168. uni.showModal({
  169. title: '提示',
  170. content: '是否取消该订单',
  171. cancelText:'否',
  172. confirmText:'是',
  173. success: function (res) {
  174. if (res.confirm) {
  175. uni.showLoading({
  176. title: '加载中'
  177. })
  178. that.$http('openOrderManagement/updateSheetState', {
  179. id: item.ID,
  180. }, 'POST').then(res => {
  181. uni.hideLoading();
  182. // var list = res.data.Items
  183. if(res.code==0){
  184. uni.showToast({
  185. title: '取消成功',
  186. icon: 'none',
  187. duration: 2000
  188. });
  189. setTimeout(function() {
  190. that.page = 1;
  191. that.getData();
  192. }, 100);
  193. }else{
  194. uni.showToast({
  195. title: res.msg,
  196. icon: 'none',
  197. duration: 3000
  198. });
  199. }
  200. })
  201. } else if (res.cancel) {
  202. }
  203. }
  204. });
  205. },
  206. decryptPhoneNumber: function(e) {
  207. console.log(e);
  208. this.code=e.detail.code
  209. this.wxPhoneLogin()
  210. this.authorizShow=false;
  211. },
  212. wxPhoneLogin(){
  213. var that=this;
  214. this.$http('miniApp2/sys/wxPhoneLogin', {
  215. appId:this.ext.appId,
  216. unionId:this.ext.unionId,
  217. code:this.code,
  218. openId:this.wxOpenData.openid
  219. },'POST').then(res => {
  220. var data = res.data;
  221. if(data.loginInfo){
  222. this.userInfo=data.loginInfo.openUser;
  223. this.wxOpenData=data.loginInfo;
  224. this.$store.commit('mutationswxOpenData', data)
  225. this.$store.commit('mutationsuserInfo', this.userInfo)
  226. this.getData()
  227. }
  228. })
  229. },
  230. tabClick(num) {
  231. this.tabIndex = num;
  232. this.page = 1;
  233. this.getData()
  234. },
  235. goDetail(item) {
  236. //SheetType 1 商品2项目3套餐4救援5钣喷6集客
  237. if((item.SheetType==1)||(item.SheetType==2)||(item.SheetType==3)){
  238. uni.navigateTo({
  239. url: "mallOrderDetail?id=" + item.ID +"&SheetType=" + item.SheetType
  240. })
  241. }
  242. else if (item.SheetType==5){
  243. uni.navigateTo({
  244. url: "paintOrderDetail?id=" + item.ID
  245. })
  246. }
  247. else if (item.SheetType==6){
  248. uni.navigateTo({
  249. url: "activityOrderDetail?id=" + item.ID//+'&sx=1'
  250. })
  251. }
  252. },
  253. getData() {
  254. uni.showLoading({
  255. title: '加载中'
  256. });
  257. this.isload = false;
  258. var padata = {
  259. page: this.page,
  260. limit: 10,
  261. sheetState: this.tabIndex > 0 ? this.tabIndex : ''
  262. }
  263. this.$http('openOrderManagement/getOpenSheetList', padata, 'GET').then(res => {
  264. uni.hideLoading();
  265. this.isload = true;
  266. var list = res.data.Items;
  267. if (this.page == 1) {
  268. this.items = list
  269. } else {
  270. this.items = this.items.concat(list)
  271. }
  272. })
  273. },
  274. },
  275. onReachBottom() {
  276. this.page++;
  277. this.getData()
  278. },
  279. onPullDownRefresh() {
  280. this.page = 1;
  281. this.getData()
  282. setTimeout(function() {
  283. uni.stopPullDownRefresh();
  284. }, 1000);
  285. }
  286. }
  287. </script>
  288. <style scoped>
  289. .box {
  290. min-height: 100vh;
  291. background: #F4F5F7;
  292. }
  293. .renBox{
  294. color: #1A1A1A;
  295. background: #F7F7F7;
  296. border-radius: 10rpx;
  297. display: flex;
  298. padding: 20rpx;font-size: 24rpx;
  299. line-height: 30rpx;
  300. margin-top: 16rpx;
  301. }
  302. .renimg{
  303. width: 30rpx;height: 30rpx;
  304. }
  305. .renMobilePhone{
  306. padding-left: 13rpx;
  307. }
  308. .renNickName{
  309. padding-left: 20rpx;
  310. }
  311. .tab {
  312. background: #FFFFFF;
  313. display: flex;
  314. justify-content: space-between;
  315. line-height: 92rpx;
  316. position: fixed;
  317. width: calc(100vw - 100rpx);
  318. padding-left: 50rpx;
  319. padding-right: 50rpx;
  320. height: 92rpx;
  321. z-index: 11;
  322. }
  323. .tabLine {
  324. font-size: 28rpx;
  325. color: #333333;
  326. text-align: center;
  327. }
  328. .tabActive {
  329. color: #EC0F0A;
  330. font-weight: bold;
  331. border-bottom: 4rpx solid #EC0F0A;
  332. }
  333. .main {
  334. padding-top: 92rpx;
  335. padding-bottom: 20rpx;
  336. background-color: #F4F5F7;
  337. }
  338. .itemBg {
  339. margin: 20rpx 24rpx;
  340. background-color: #FFFFFF;
  341. border-radius: 10rpx;
  342. padding: 20rpx;
  343. }
  344. .itemTop {
  345. display: flex;
  346. justify-content: space-between;
  347. }
  348. .itemType {
  349. color: #999999;
  350. font-size: 24rpx;
  351. }
  352. .itemSheetState {
  353. font-size: 24rpx;
  354. color: #999999
  355. }
  356. .redColor {
  357. color: #EC0F0A;
  358. }
  359. .orangeColor {
  360. color: #F19D01;
  361. }
  362. .greenColor {
  363. color: #00A040;
  364. }
  365. .itemShopBg {
  366. display: flex;
  367. justify-content: space-between;
  368. margin-top: 20rpx;
  369. }
  370. .shopName {
  371. color: #333333;
  372. font-size: 30rpx;
  373. font-weight: bold;
  374. /* 隐藏文字显示 ...不换行 */
  375. overflow: hidden;
  376. text-overflow: ellipsis;
  377. white-space: nowrap;
  378. }
  379. .price {
  380. color: #333333;
  381. font-weight: bold;
  382. font-size: 32rpx;
  383. }
  384. .itemName {
  385. color: #666666;
  386. font-size: 24rpx;
  387. padding: 16rpx 0;
  388. height: 30rpx;
  389. overflow: hidden;
  390. text-overflow: ellipsis;
  391. white-space: nowrap;
  392. }
  393. .plateBg {
  394. display: flex;
  395. justify-content: space-between;
  396. align-items: center;
  397. }
  398. .plateNumber {
  399. color: #666666;
  400. font-size: 24rpx;
  401. margin-bottom: 20rpx;
  402. display: flex;
  403. }
  404. .itemLineBottom {
  405. display: flex;
  406. justify-content: flex-end;
  407. }
  408. .itemBtn1 {
  409. width: 150rpx;
  410. height: 56rpx;
  411. border-radius: 36rpx;
  412. border: 2rpx solid #DDDDDD;
  413. text-align: center;
  414. line-height: 56rpx;
  415. font-size: 28rpx;
  416. color: #3C3C3C;
  417. margin-left: 40rpx;
  418. }
  419. .itemBtn2 {
  420. width: 150rpx;
  421. height: 56rpx;
  422. border-radius: 36rpx;
  423. border: 2rpx solid #FF4F00;
  424. text-align: center;
  425. line-height: 56rpx;
  426. font-size: 28rpx;
  427. color: #FF4F00;
  428. margin-left: 40rpx;
  429. }
  430. .orderState {
  431. color: #F19D01;
  432. font-size: 24rpx;
  433. padding-left: 20rpx;
  434. }
  435. .authorizBox{
  436. width: 100vw;
  437. height: 100vh;
  438. background: rgba(0, 0, 0, 0.5);
  439. position: fixed;
  440. top: 0;
  441. left: 0;
  442. }
  443. .authorizCont{
  444. margin-top: 30vh;
  445. width: 564rpx;
  446. height: 408rpx;
  447. background: #FFFFFF;
  448. border-radius: 24rpx;
  449. margin-left: 93rpx;
  450. position: relative;
  451. }
  452. .authorizCloseImg{
  453. width: 62rpx;
  454. height: 62rpx;
  455. }
  456. .sqLogoBox{
  457. width: 180rpx;
  458. height: 180rpx;
  459. background: #FFFFFF;
  460. border-radius: 90rpx;
  461. text-align: center;
  462. position: absolute;
  463. top: -50rpx;
  464. left: 192rpx;
  465. }
  466. .authorizName{
  467. color: #333333;
  468. line-height: 42rpx;
  469. font-size: 30rpx;
  470. text-align: center;
  471. padding-top: 58rpx;
  472. }
  473. .authorizMs{
  474. color: #999999;
  475. line-height: 36rpx;
  476. font-size: 26rpx;
  477. width: 452rpx;
  478. padding-top: 24rpx;
  479. text-align: center;
  480. margin-left: 56rpx;
  481. }
  482. .authorizContbutton{
  483. width: 422rpx;
  484. height: 88rpx;
  485. background: #EC0F0A;
  486. border-radius: 44rpx;
  487. line-height: 88rpx;
  488. text-align: center;
  489. font-size:30rpx;
  490. color: #FFFFFF;
  491. margin-top: 62rpx;
  492. margin-left:71rpx;
  493. }
  494. .shopBoxpt{
  495. margin-top: 20rpx;
  496. }
  497. button::after{
  498. border: none;
  499. }
  500. button{
  501. position: relative;
  502. display: block;
  503. margin-left: 0;
  504. margin-right: 0;
  505. padding-left: 0px;
  506. padding-right: 0px;
  507. box-sizing: border-box;
  508. // font-size: 18px;
  509. text-align: center;
  510. text-decoration: none;
  511. // line-height: 1;
  512. line-height: 1.35;
  513. // border-radius: 5px;
  514. -webkit-tap-highlight-color: transparent;
  515. overflow: hidden;
  516. color: #000000;
  517. background-color: #fff;
  518. height: 100%;
  519. }
  520. .orderCodeBox{
  521. display: flex;
  522. }
  523. .orderCode{
  524. color: #999999; font-size: 24rpx;
  525. }
  526. .cancel {
  527. color: #3C3C3C;
  528. font-size: 24rpx;
  529. width: 130rpx;
  530. height: 56rpx;
  531. border-radius: 8rpx;
  532. border: 1rpx solid #DDDDDD;
  533. text-align: center;
  534. line-height: 56rpx;
  535. margin-right: 20rpx;
  536. }
  537. .defer {
  538. color: #EC0F0A;
  539. font-size: 24rpx;
  540. width: 130rpx;
  541. height: 56rpx;
  542. border-radius: 8rpx;
  543. border: 1rpx solid #EC0F0A;
  544. text-align: center;
  545. line-height: 56rpx;
  546. }
  547. .bottom{
  548. display: flex;
  549. justify-content: flex-end;
  550. }
  551. .packageName{
  552. font-size: 22rpx;
  553. color: #FF0035;
  554. border-radius: 5rpx;
  555. border: 1px solid #FF0035;
  556. padding: 2rpx 8rpx;
  557. }
  558. .package{
  559. justify-content: space-between;
  560. padding-top: 10rpx;padding-bottom: 10rpx;
  561. }
  562. .packageQty{
  563. font-size: 26rpx;
  564. color: #666666;
  565. }
  566. </style>