myOrder.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  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="itemName" v-if="item.packageName">{{item.packageName}}</view>
  47. <view class="itemName" v-if="item.packageQty" style="padding-left: 10rpx;">x{{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. uni.showToast({
  184. title: '取消成功',
  185. icon: 'none',
  186. duration: 2000
  187. });
  188. setTimeout(function() {
  189. that.page = 1;
  190. that.getData();
  191. }, 100);
  192. })
  193. } else if (res.cancel) {
  194. }
  195. }
  196. });
  197. },
  198. decryptPhoneNumber: function(e) {
  199. console.log(e);
  200. this.code=e.detail.code
  201. this.wxPhoneLogin()
  202. this.authorizShow=false;
  203. },
  204. wxPhoneLogin(){
  205. var that=this;
  206. this.$http('miniApp2/sys/wxPhoneLogin', {
  207. appId:this.ext.appId,
  208. unionId:this.ext.unionId,
  209. code:this.code,
  210. openId:this.wxOpenData.openid
  211. },'POST').then(res => {
  212. var data = res.data;
  213. if(data.loginInfo){
  214. this.userInfo=data.loginInfo.openUser;
  215. this.wxOpenData=data.loginInfo;
  216. this.$store.commit('mutationswxOpenData', data)
  217. this.$store.commit('mutationsuserInfo', this.userInfo)
  218. this.getData()
  219. }
  220. })
  221. },
  222. tabClick(num) {
  223. this.tabIndex = num;
  224. this.page = 1;
  225. this.getData()
  226. },
  227. goDetail(item) {
  228. //SheetType 1 商品2项目3套餐4救援5钣喷6集客
  229. if((item.SheetType==1)||(item.SheetType==2)||(item.SheetType==3)){
  230. uni.navigateTo({
  231. url: "mallOrderDetail?id=" + item.ID +"&SheetType=" + item.SheetType
  232. })
  233. }
  234. else if (item.SheetType==5){
  235. uni.navigateTo({
  236. url: "paintOrderDetail?id=" + item.ID
  237. })
  238. }
  239. else if (item.SheetType==6){
  240. uni.navigateTo({
  241. url: "activityOrderDetail?id=" + item.ID//+'&sx=1'
  242. })
  243. }
  244. },
  245. getData() {
  246. uni.showLoading({
  247. title: '加载中'
  248. });
  249. this.isload = false;
  250. var padata = {
  251. page: this.page,
  252. limit: 10,
  253. sheetState: this.tabIndex > 0 ? this.tabIndex : ''
  254. }
  255. this.$http('openOrderManagement/getOpenSheetList', padata, 'GET').then(res => {
  256. uni.hideLoading();
  257. this.isload = true;
  258. var list = res.data.Items;
  259. if (this.page == 1) {
  260. this.items = list
  261. } else {
  262. this.items = this.items.concat(list)
  263. }
  264. })
  265. },
  266. },
  267. onReachBottom() {
  268. this.page++;
  269. this.getData()
  270. },
  271. onPullDownRefresh() {
  272. this.page = 1;
  273. this.getData()
  274. setTimeout(function() {
  275. uni.stopPullDownRefresh();
  276. }, 1000);
  277. }
  278. }
  279. </script>
  280. <style scoped>
  281. .box {
  282. min-height: 100vh;
  283. background: #F4F5F7;
  284. }
  285. .renBox{
  286. color: #1A1A1A;
  287. background: #F7F7F7;
  288. border-radius: 10rpx;
  289. display: flex;
  290. padding: 20rpx;font-size: 24rpx;
  291. line-height: 30rpx;
  292. margin-top: 16rpx;
  293. }
  294. .renimg{
  295. width: 30rpx;height: 30rpx;
  296. }
  297. .renMobilePhone{
  298. padding-left: 13rpx;
  299. }
  300. .renNickName{
  301. padding-left: 20rpx;
  302. }
  303. .tab {
  304. background: #FFFFFF;
  305. display: flex;
  306. justify-content: space-between;
  307. line-height: 92rpx;
  308. position: fixed;
  309. width: calc(100vw - 100rpx);
  310. padding-left: 50rpx;
  311. padding-right: 50rpx;
  312. height: 92rpx;
  313. z-index: 11;
  314. }
  315. .tabLine {
  316. font-size: 28rpx;
  317. color: #333333;
  318. text-align: center;
  319. }
  320. .tabActive {
  321. color: #EC0F0A;
  322. font-weight: bold;
  323. border-bottom: 4rpx solid #EC0F0A;
  324. }
  325. .main {
  326. padding-top: 92rpx;
  327. padding-bottom: 20rpx;
  328. background-color: #F4F5F7;
  329. }
  330. .itemBg {
  331. margin: 20rpx 24rpx;
  332. background-color: #FFFFFF;
  333. border-radius: 10rpx;
  334. padding: 20rpx;
  335. }
  336. .itemTop {
  337. display: flex;
  338. justify-content: space-between;
  339. }
  340. .itemType {
  341. color: #999999;
  342. font-size: 24rpx;
  343. }
  344. .itemSheetState {
  345. font-size: 24rpx;
  346. color: #999999
  347. }
  348. .redColor {
  349. color: #EC0F0A;
  350. }
  351. .orangeColor {
  352. color: #F19D01;
  353. }
  354. .greenColor {
  355. color: #00A040;
  356. }
  357. .itemShopBg {
  358. display: flex;
  359. justify-content: space-between;
  360. margin-top: 20rpx;
  361. }
  362. .shopName {
  363. color: #333333;
  364. font-size: 30rpx;
  365. font-weight: bold;
  366. /* 隐藏文字显示 ...不换行 */
  367. overflow: hidden;
  368. text-overflow: ellipsis;
  369. white-space: nowrap;
  370. }
  371. .price {
  372. color: #333333;
  373. font-weight: bold;
  374. font-size: 32rpx;
  375. }
  376. .itemName {
  377. color: #666666;
  378. font-size: 24rpx;
  379. padding: 16rpx 0;
  380. height: 30rpx;
  381. overflow: hidden;
  382. text-overflow: ellipsis;
  383. white-space: nowrap;
  384. }
  385. .plateBg {
  386. display: flex;
  387. justify-content: space-between;
  388. align-items: center;
  389. }
  390. .plateNumber {
  391. color: #666666;
  392. font-size: 24rpx;
  393. margin-bottom: 20rpx;
  394. display: flex;
  395. }
  396. .itemLineBottom {
  397. display: flex;
  398. justify-content: flex-end;
  399. }
  400. .itemBtn1 {
  401. width: 150rpx;
  402. height: 56rpx;
  403. border-radius: 36rpx;
  404. border: 2rpx solid #DDDDDD;
  405. text-align: center;
  406. line-height: 56rpx;
  407. font-size: 28rpx;
  408. color: #3C3C3C;
  409. margin-left: 40rpx;
  410. }
  411. .itemBtn2 {
  412. width: 150rpx;
  413. height: 56rpx;
  414. border-radius: 36rpx;
  415. border: 2rpx solid #FF4F00;
  416. text-align: center;
  417. line-height: 56rpx;
  418. font-size: 28rpx;
  419. color: #FF4F00;
  420. margin-left: 40rpx;
  421. }
  422. .orderState {
  423. color: #F19D01;
  424. font-size: 24rpx;
  425. padding-left: 20rpx;
  426. }
  427. .authorizBox{
  428. width: 100vw;
  429. height: 100vh;
  430. background: rgba(0, 0, 0, 0.5);
  431. position: fixed;
  432. top: 0;
  433. left: 0;
  434. }
  435. .authorizCont{
  436. margin-top: 30vh;
  437. width: 564rpx;
  438. height: 408rpx;
  439. background: #FFFFFF;
  440. border-radius: 24rpx;
  441. margin-left: 93rpx;
  442. position: relative;
  443. }
  444. .authorizCloseImg{
  445. width: 62rpx;
  446. height: 62rpx;
  447. }
  448. .sqLogoBox{
  449. width: 180rpx;
  450. height: 180rpx;
  451. background: #FFFFFF;
  452. border-radius: 90rpx;
  453. text-align: center;
  454. position: absolute;
  455. top: -50rpx;
  456. left: 192rpx;
  457. }
  458. .authorizName{
  459. color: #333333;
  460. line-height: 42rpx;
  461. font-size: 30rpx;
  462. text-align: center;
  463. padding-top: 58rpx;
  464. }
  465. .authorizMs{
  466. color: #999999;
  467. line-height: 36rpx;
  468. font-size: 26rpx;
  469. width: 452rpx;
  470. padding-top: 24rpx;
  471. text-align: center;
  472. margin-left: 56rpx;
  473. }
  474. .authorizContbutton{
  475. width: 422rpx;
  476. height: 88rpx;
  477. background: #EC0F0A;
  478. border-radius: 44rpx;
  479. line-height: 88rpx;
  480. text-align: center;
  481. font-size:30rpx;
  482. color: #FFFFFF;
  483. margin-top: 62rpx;
  484. margin-left:71rpx;
  485. }
  486. .shopBoxpt{
  487. margin-top: 20rpx;
  488. }
  489. button::after{
  490. border: none;
  491. }
  492. button{
  493. position: relative;
  494. display: block;
  495. margin-left: 0;
  496. margin-right: 0;
  497. padding-left: 0px;
  498. padding-right: 0px;
  499. box-sizing: border-box;
  500. // font-size: 18px;
  501. text-align: center;
  502. text-decoration: none;
  503. // line-height: 1;
  504. line-height: 1.35;
  505. // border-radius: 5px;
  506. -webkit-tap-highlight-color: transparent;
  507. overflow: hidden;
  508. color: #000000;
  509. background-color: #fff;
  510. height: 100%;
  511. }
  512. .orderCodeBox{
  513. display: flex;
  514. }
  515. .orderCode{
  516. color: #999999; font-size: 24rpx;
  517. }
  518. .cancel {
  519. color: #3C3C3C;
  520. font-size: 24rpx;
  521. width: 130rpx;
  522. height: 56rpx;
  523. border-radius: 8rpx;
  524. border: 1rpx solid #DDDDDD;
  525. text-align: center;
  526. line-height: 56rpx;
  527. margin-right: 20rpx;
  528. }
  529. .defer {
  530. color: #EC0F0A;
  531. font-size: 24rpx;
  532. width: 130rpx;
  533. height: 56rpx;
  534. border-radius: 8rpx;
  535. border: 1rpx solid #EC0F0A;
  536. text-align: center;
  537. line-height: 56rpx;
  538. }
  539. .bottom{
  540. display: flex;
  541. justify-content: flex-end;
  542. }
  543. </style>