orderItem.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. <template>
  2. <view class="container">
  3. <view class="order-row" @click="goToOrderDetail()">
  4. <view class="shop-info" v-if="orderData">
  5. <text class="iconfont iconwode"></text>
  6. <text class="shop-name">{{orderData.nickname}}</text>
  7. <text class="order-type">{{getOrderType(orderData.orderStatus)}}</text>
  8. </view>
  9. <view class="goods-list" v-if="orderData">
  10. <view class="goods-row" v-for="(site, index) in orderData.products" :key="index">
  11. <image class="goods-img" :src="site.imgUrl" mode="aspectFill"></image>
  12. <view class="goods-info">
  13. <view class="goods-name">{{site.productName}}</view>
  14. <view class="goods-type">
  15. 类型:{{site.productType == 1 ? '普通商品' : (site.productType == 2 ? '拍卖' : (site.productType == 3 ? '自助采摘' : '共享种植'))}}
  16. </view>
  17. <view class="goods-price-number">
  18. <text class="goods-unit">¥</text>
  19. <text class="goods-price">{{site.bizPrice}}</text>
  20. <text class="goods-number">x{{site.buyNum}}</text>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="pay-info" v-if="!isPick">总价¥{{getAllPrice()}},实付¥{{orderData.paySum}}</view>
  26. <view class="handle-box" v-if="(tabIndex > 1 && tabIndex < 5) || (tabIndex == 5 && orderData.evaluateStatus == 2 && orderData.evaluateReplyStatus == 1)">
  27. <u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
  28. v-if="tabIndex == 2 && orderData.auctionStatus != 1 && orderData.auctionStatus != 3" @click.stop="handleOrder(1)">发货</u-button>
  29. <u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
  30. v-if="tabIndex == 3 || tabIndex == 4" @click.stop="handleOrder(2)">追踪物流</u-button>
  31. <u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
  32. v-if="tabIndex == 5 && orderData.evaluateStatus == 2 && orderData.evaluateReplyStatus == 1" @click.stop="handleOrder(3)">回复</u-button>
  33. <u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
  34. v-if="!orderData.noPick && orderData.orderStatus == 2" @click.stop="handleOrder(6)">自助采摘</u-button>
  35. </view>
  36. <u-top-tips ref="uTips"></u-top-tips>
  37. </view>
  38. <view class="uni-popup-dialog" :hidden="show_qx">
  39. <view class="uni-dialog-title">
  40. <text class="uni-dialog-title-text">提示</text>
  41. </view>
  42. <view class="uni-dialog-content">
  43. <text class="uni-dialog-content-text">请在设置中开启摄像头权限和麦克风权限</text>
  44. </view>
  45. <view class="uni-dialog-button-group">
  46. <button class="uni-dialog-button uni-border-left" open-type="openSetting" @click="closeSetting">
  47. 设置权限
  48. </button>
  49. </view>
  50. </view>
  51. <view class="qx_bg" :hidden="show_qx">
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. const NET = require('@/utils/request')
  57. const API = require('@/config/api')
  58. export default {
  59. props: {
  60. tabIndex: {
  61. default: 1
  62. },
  63. isPick: {
  64. default: false
  65. },
  66. orderData: {
  67. default: {
  68. auctionStatus: 0,
  69. orderId: 0,
  70. orderStatus: 0,
  71. evaluateReplyStatus: 0,
  72. nickname: '',
  73. logisticsNum: '',
  74. payStatus: 0,
  75. paySum: 0,
  76. products: [{
  77. bizPrice: 0,
  78. buyNum: 0,
  79. imgUrl: '',
  80. originalPrice: 0,
  81. productId: 0,
  82. productName: '',
  83. productType: 0,
  84. shoppingcartId: 0,
  85. tenantCode: ''
  86. }],
  87. supplierName: '',
  88. noPick: true
  89. }
  90. },
  91. },
  92. data() {
  93. return {
  94. show_qx:true
  95. }
  96. },
  97. onLoad() {},
  98. methods: {
  99. closeSetting:function(){
  100. this.show_qx=true;
  101. },
  102. // 获取订单总价
  103. getAllPrice() {
  104. let price = this.orderData.products.reduce((total, site) => {
  105. return total + site.bizPrice * site.buyNum
  106. }, 0)
  107. return price.toFixed(2)
  108. },
  109. // 获取订单类型
  110. getOrderType(type) {
  111. switch (type) {
  112. case 1:
  113. return '待付款'
  114. break;
  115. case 2:
  116. return '待发货'
  117. break;
  118. case 3:
  119. return '已发货'
  120. break;
  121. case 4:
  122. return '已收货'
  123. break;
  124. case 5:
  125. return '已完成'
  126. break;
  127. default:
  128. return '已取消'
  129. }
  130. },
  131. // 获取拍卖状态
  132. getAuctionType(type) {
  133. switch (type) {
  134. case 1:
  135. return '竞拍中'
  136. break;
  137. case 2:
  138. return '竞拍成功'
  139. break;
  140. case 3:
  141. return '竞拍失败'
  142. break;
  143. }
  144. },
  145. // 操作区分
  146. handleOrder(type) {
  147. if (type == 1) {
  148. // 发货
  149. uni.navigateTo({
  150. url: '/pagesMain/bindOrder?orderId=' + this.orderData.orderId
  151. });
  152. } else if (type == 2) {
  153. // 追踪物流
  154. uni.navigateTo({
  155. url: '/pagesMain/logisticsDeatil?logisticCode=' + this.orderData.logisticsNum
  156. });
  157. } else if (type == 3) {
  158. // 回复
  159. uni.navigateTo({
  160. url: '/pagesMain/evaluateForm?orderId=' + this.orderData.orderId + '&mid='+this.orderData.mid
  161. });
  162. } else if (type == 6) {
  163. // 自助采摘
  164. var that=this;
  165. if(uni.getStorageSync("firstTimeLive")==""){
  166. uni.setStorage({
  167. key: 'firstTimeLive',
  168. data: 1
  169. })
  170. uni.navigateTo({
  171. url: '/pagesMedia/pickVideo?tenantCode=' + that.orderData.tenantCode + '&orderId=' + that.orderData.orderId
  172. });
  173. }else{
  174. wx.getSetting({
  175. success(res) {
  176. if (!res.authSetting['scope.camera']){
  177. that.show_qx=false;
  178. }else if (!res.authSetting['scope.record']){
  179. that.show_qx=false;
  180. }else{
  181. uni.navigateTo({
  182. url: '/pagesMedia/pickVideo?tenantCode=' + that.orderData.tenantCode + '&orderId=' + that.orderData.orderId
  183. });
  184. }
  185. }
  186. })
  187. }
  188. }
  189. },
  190. // 跳转订单详情
  191. goToOrderDetail() {
  192. if (!this.isPick) {
  193. uni.navigateTo({
  194. url: '/pagesMain/orderDetail?orderId=' + this.orderData.orderId + '&orderStatus=' + this.orderData.orderStatus
  195. });
  196. } else {
  197. // 自助采摘
  198. var that=this;
  199. if(uni.getStorageSync("firstTimeLive")==""){
  200. uni.setStorage({
  201. key: 'firstTimeLive',
  202. data: 1
  203. })
  204. uni.navigateTo({
  205. url: '/pagesMedia/pickVideo?tenantCode=' + that.orderData.tenantCode + '&orderId=' + that.orderData.orderId
  206. });
  207. }else{
  208. wx.getSetting({
  209. success(res) {
  210. if (!res.authSetting['scope.camera']){
  211. that.show_qx=false;
  212. }else if (!res.authSetting['scope.record']){
  213. that.show_qx=false;
  214. }else{
  215. uni.navigateTo({
  216. url: '/pagesMedia/pickVideo?tenantCode=' + that.orderData.tenantCode + '&orderId=' + that.orderData.orderId
  217. });
  218. }
  219. }
  220. })
  221. }
  222. }
  223. },
  224. }
  225. }
  226. </script>
  227. <style lang="less" scoped>
  228. .order-row {
  229. width: 100%;
  230. float: left;
  231. margin: 0 0 15px 0;
  232. background: #FFFFFF;
  233. border-radius: 10px;
  234. .shop-info {
  235. width: 100%;
  236. height: 48px;
  237. float: left;
  238. box-sizing: border-box;
  239. padding: 13px 15px 12px 15px;
  240. border-bottom: 1px solid #EEEEEE;
  241. line-height: 22px;
  242. .iconwode {
  243. font-size: 22px;
  244. color: #333333;
  245. }
  246. .shop-name {
  247. font-size: 15px;
  248. font-family: PingFang SC;
  249. color: #333333;
  250. margin: 0 8px 0 10px;
  251. }
  252. .iconshangjia {
  253. font-size: 12px;
  254. color: #999999;
  255. }
  256. .order-type {
  257. float: right;
  258. font-size: 15px;
  259. font-family: PingFang SC;
  260. color: #52A63A;
  261. }
  262. }
  263. .goods-list {
  264. width: 100%;
  265. float: left;
  266. box-sizing: border-box;
  267. padding: 10px 15px 0 15px;
  268. .goods-row {
  269. width: 100%;
  270. height: 90px;
  271. float: left;
  272. display: flex;
  273. margin-bottom: 10px;
  274. .goods-img {
  275. width: 90px;
  276. height: 90px;
  277. border-radius: 5px;
  278. object-fit: cover;
  279. }
  280. .goods-info {
  281. width: calc(100% - 106px);
  282. height: 90px;
  283. margin-left: 16px;
  284. .goods-name {
  285. width: 100%;
  286. height: 36px;
  287. float: left;
  288. font-size: 14px;
  289. font-family: PingFang SC;
  290. color: #333333;
  291. line-height: 18px;
  292. overflow: hidden;
  293. text-overflow: ellipsis;
  294. display: -webkit-box;
  295. -webkit-line-clamp: 2;
  296. -webkit-box-orient: vertical;
  297. word-wrap: break-word;
  298. }
  299. .goods-type {
  300. height: 20px;
  301. float: left;
  302. background: #F0F0F0;
  303. border-radius: 4px;
  304. padding: 0 8px;
  305. margin: 6px 0;
  306. font-size: 10px;
  307. font-family: PingFang SC;
  308. color: #666666;
  309. line-height: 20px;
  310. }
  311. .goods-price-number {
  312. width: 100%;
  313. height: 20px;
  314. float: left;
  315. line-height: 20px;
  316. font-family: PingFang SC;
  317. color: #333333;
  318. .goods-unit {
  319. font-size: 12px;
  320. }
  321. .goods-price {
  322. font-size: 15px;
  323. margin-right: 6px;
  324. }
  325. .goods-number {
  326. font-size: 12px;
  327. }
  328. }
  329. }
  330. }
  331. }
  332. .pay-info {
  333. width: 100%;
  334. float: left;
  335. box-sizing: border-box;
  336. padding: 20px 15px 16px 15px;
  337. font-size: 12px;
  338. font-family: PingFang SC;
  339. color: #333333;
  340. line-height: 16px;
  341. text-align: right;
  342. }
  343. .handle-box {
  344. width: calc(100% - 30px);
  345. height: 51px;
  346. float: left;
  347. margin: 0 15px;
  348. box-sizing: border-box;
  349. padding: 10px 0;
  350. border-top: 1px solid #EEEEEE;
  351. text-align: right;
  352. .handle-button {
  353. height: 30px;
  354. margin-left: 8px;
  355. margin-bottom: 10px;
  356. line-height: 28px;
  357. text-align: center;
  358. box-sizing: border-box;
  359. display: inline-block;
  360. border-radius: 15px;
  361. /deep/button {
  362. padding: 0 12px;
  363. border: 1px solid #BFBFBF !important;
  364. background-color: #FFFFFF!important;
  365. color: #333333 !important;
  366. }
  367. }
  368. }
  369. }
  370. .uni-popup-dialog {
  371. width: 80vw;
  372. border-radius: 15px;
  373. background-color: #fff;
  374. position: fixed;
  375. margin-left: 10vw;
  376. top: 34vh;
  377. z-index: 11;
  378. }
  379. .uni-dialog-title {
  380. /* #ifndef APP-NVUE */
  381. display: flex;
  382. /* #endif */
  383. flex-direction: row;
  384. justify-content: center;
  385. padding-top: 15px;
  386. padding-bottom: 5px;
  387. }
  388. .uni-dialog-title-text {
  389. font-size: 16px;
  390. font-weight: 500;
  391. }
  392. .uni-dialog-content {
  393. /* #ifndef APP-NVUE */
  394. display: flex;
  395. /* #endif */
  396. flex-direction: row;
  397. justify-content: center;
  398. align-items: center;
  399. padding: 5px 15px 15px 15px;
  400. text-align: center;
  401. }
  402. .uni-dialog-content-text {
  403. font-size: 14px;
  404. color: #6e6e6e;
  405. }
  406. .uni-dialog-button-group {
  407. /* #ifndef APP-NVUE */
  408. display: flex;
  409. /* #endif */
  410. flex-direction: row;
  411. border-top-color: #f5f5f5;
  412. border-top-style: solid;
  413. border-top-width: 1px;
  414. }
  415. .uni-dialog-button {
  416. /* #ifndef APP-NVUE */
  417. display: flex;
  418. /* #endif */
  419. background: rgba(0, 0, 0, 0);
  420. border: none;
  421. flex: 1;
  422. flex-direction: row;
  423. justify-content: center;
  424. align-items: center;
  425. height: 45px;
  426. }
  427. .uni-border-left {
  428. border-left-color: #f0f0f0;
  429. border-left-style: solid;
  430. border-left-width: 0px;
  431. }
  432. .uni-dialog-button-text {
  433. font-size: 14px;
  434. }
  435. .uni-button-color {
  436. color: #007aff;
  437. }
  438. .uni-dialog-input {
  439. flex: 1;
  440. font-size: 14px;
  441. }
  442. .uni-popup__success {
  443. color: #4cd964;
  444. }
  445. .uni-popup__warn {
  446. color: #f0ad4e;
  447. }
  448. .uni-popup__error {
  449. color: #dd524d;
  450. }
  451. .uni-popup__info {
  452. color: #909399;
  453. }
  454. .qx_bg{
  455. width: 100vw;
  456. height: 100vh;
  457. background: rgba(0, 0, 0, 0.25);
  458. position: fixed;
  459. top: 0px;
  460. left: 0px;
  461. z-index: 10;
  462. }
  463. </style>