orderItem.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <template>
  2. <view>
  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 == 1 || 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. // #ifdef MP-WEIXIN
  165. var that = this;
  166. if (uni.getStorageSync("firstTimeLive") == "") {
  167. uni.setStorage({
  168. key: 'firstTimeLive',
  169. data: 1
  170. })
  171. uni.navigateTo({
  172. url: '/pagesMedia/pickVideo?tenantCode=' + that.orderData.tenantCode + '&orderId=' + that.orderData.orderId
  173. });
  174. } else {
  175. uni.navigateTo({
  176. url: '/pagesMedia/pickVideo?tenantCode=' + that.orderData.tenantCode + '&orderId=' + that.orderData.orderId
  177. });
  178. }
  179. // #endif
  180. // #ifdef APP-PLUS
  181. uni.navigateTo({
  182. url: '/pagesMedia/pickVideo?tenantCode=' + this.orderData.tenantCode + '&orderId=' + this.orderData.orderId
  183. });
  184. // #endif
  185. }
  186. },
  187. // 跳转订单详情
  188. goToOrderDetail() {
  189. if (!this.isPick) {
  190. uni.navigateTo({
  191. url: '/pagesMain/orderDetail?orderId=' + this.orderData.orderId + '&orderStatus=' + this.orderData.orderStatus
  192. });
  193. } else {
  194. // 自助采摘
  195. var that = this;
  196. if (uni.getStorageSync("firstTimeLive") == "") {
  197. uni.setStorage({
  198. key: 'firstTimeLive',
  199. data: 1
  200. })
  201. uni.navigateTo({
  202. url: '/pagesMedia/pickVideo?tenantCode=' + that.orderData.tenantCode + '&orderId=' + that.orderData.orderId
  203. });
  204. } else {
  205. uni.navigateTo({
  206. url: '/pagesMedia/pickVideo?tenantCode=' + that.orderData.tenantCode + '&orderId=' + that.orderData.orderId
  207. });
  208. }
  209. }
  210. },
  211. }
  212. }
  213. </script>
  214. <style lang="less" scoped>
  215. .order-row {
  216. width: 100%;
  217. float: left;
  218. margin: 0 0 15px 0;
  219. background: #FFFFFF;
  220. border-radius: 10px;
  221. .shop-info {
  222. width: 100%;
  223. height: 48px;
  224. float: left;
  225. box-sizing: border-box;
  226. padding: 13px 15px 12px 15px;
  227. border-bottom: 1px solid #EEEEEE;
  228. line-height: 22px;
  229. .iconwode {
  230. font-size: 22px;
  231. color: #333333;
  232. }
  233. .shop-name {
  234. font-size: 15px;
  235. font-family: PingFang SC;
  236. color: #333333;
  237. margin: 0 8px 0 10px;
  238. }
  239. .iconshangjia {
  240. font-size: 12px;
  241. color: #999999;
  242. }
  243. .order-type {
  244. float: right;
  245. font-size: 15px;
  246. font-family: PingFang SC;
  247. color: #52A63A;
  248. }
  249. }
  250. .goods-list {
  251. width: 100%;
  252. float: left;
  253. box-sizing: border-box;
  254. padding: 10px 15px 0 15px;
  255. .goods-row {
  256. width: 100%;
  257. height: 90px;
  258. float: left;
  259. display: flex;
  260. margin-bottom: 10px;
  261. .goods-img {
  262. width: 90px;
  263. height: 90px;
  264. border-radius: 5px;
  265. object-fit: cover;
  266. }
  267. .goods-info {
  268. width: calc(100% - 106px);
  269. height: 90px;
  270. margin-left: 16px;
  271. .goods-name {
  272. width: 100%;
  273. height: 36px;
  274. float: left;
  275. font-size: 14px;
  276. font-family: PingFang SC;
  277. color: #333333;
  278. line-height: 18px;
  279. overflow: hidden;
  280. text-overflow: ellipsis;
  281. display: -webkit-box;
  282. -webkit-line-clamp: 2;
  283. -webkit-box-orient: vertical;
  284. word-wrap: break-word;
  285. }
  286. .goods-type {
  287. height: 20px;
  288. float: left;
  289. background: #F0F0F0;
  290. border-radius: 4px;
  291. padding: 0 8px;
  292. margin: 6px 0;
  293. font-size: 10px;
  294. font-family: PingFang SC;
  295. color: #666666;
  296. line-height: 20px;
  297. }
  298. .goods-price-number {
  299. width: 100%;
  300. height: 20px;
  301. float: left;
  302. line-height: 20px;
  303. font-family: PingFang SC;
  304. color: #333333;
  305. .goods-unit {
  306. font-size: 12px;
  307. }
  308. .goods-price {
  309. font-size: 15px;
  310. margin-right: 6px;
  311. }
  312. .goods-number {
  313. font-size: 12px;
  314. }
  315. }
  316. }
  317. }
  318. }
  319. .pay-info {
  320. width: 100%;
  321. float: left;
  322. box-sizing: border-box;
  323. padding: 20px 15px 16px 15px;
  324. font-size: 12px;
  325. font-family: PingFang SC;
  326. color: #333333;
  327. line-height: 16px;
  328. text-align: right;
  329. }
  330. .handle-box {
  331. width: calc(100% - 30px);
  332. height: 51px;
  333. float: left;
  334. margin: 0 15px;
  335. box-sizing: border-box;
  336. padding: 10px 0;
  337. border-top: 1px solid #EEEEEE;
  338. text-align: right;
  339. .handle-button {
  340. height: 30px;
  341. margin-left: 8px;
  342. margin-bottom: 10px;
  343. line-height: 28px;
  344. text-align: center;
  345. box-sizing: border-box;
  346. display: inline-block;
  347. border-radius: 15px;
  348. /deep/button {
  349. padding: 0 12px;
  350. border: 1px solid #BFBFBF !important;
  351. background-color: #FFFFFF !important;
  352. color: #333333 !important;
  353. }
  354. }
  355. }
  356. }
  357. .uni-popup-dialog {
  358. width: 80vw;
  359. border-radius: 15px;
  360. background-color: #fff;
  361. position: fixed;
  362. margin-left: 10vw;
  363. top: 34vh;
  364. z-index: 11;
  365. }
  366. .uni-dialog-title {
  367. /* #ifndef APP-NVUE */
  368. display: flex;
  369. /* #endif */
  370. flex-direction: row;
  371. justify-content: center;
  372. padding-top: 15px;
  373. padding-bottom: 5px;
  374. }
  375. .uni-dialog-title-text {
  376. font-size: 16px;
  377. font-weight: 500;
  378. }
  379. .uni-dialog-content {
  380. /* #ifndef APP-NVUE */
  381. display: flex;
  382. /* #endif */
  383. flex-direction: row;
  384. justify-content: center;
  385. align-items: center;
  386. padding: 5px 15px 15px 15px;
  387. text-align: center;
  388. }
  389. .uni-dialog-content-text {
  390. font-size: 14px;
  391. color: #6e6e6e;
  392. }
  393. .uni-dialog-button-group {
  394. /* #ifndef APP-NVUE */
  395. display: flex;
  396. /* #endif */
  397. flex-direction: row;
  398. border-top-color: #f5f5f5;
  399. border-top-style: solid;
  400. border-top-width: 1px;
  401. }
  402. .uni-dialog-button {
  403. /* #ifndef APP-NVUE */
  404. display: flex;
  405. /* #endif */
  406. background: rgba(0, 0, 0, 0);
  407. border: none;
  408. flex: 1;
  409. flex-direction: row;
  410. justify-content: center;
  411. align-items: center;
  412. height: 45px;
  413. }
  414. .uni-border-left {
  415. border-left-color: #f0f0f0;
  416. border-left-style: solid;
  417. border-left-width: 0px;
  418. }
  419. .uni-dialog-button-text {
  420. font-size: 14px;
  421. }
  422. .uni-button-color {
  423. color: #007aff;
  424. }
  425. .uni-dialog-input {
  426. flex: 1;
  427. font-size: 14px;
  428. }
  429. .uni-popup__success {
  430. color: #4cd964;
  431. }
  432. .uni-popup__warn {
  433. color: #f0ad4e;
  434. }
  435. .uni-popup__error {
  436. color: #dd524d;
  437. }
  438. .uni-popup__info {
  439. color: #909399;
  440. }
  441. .qx_bg {
  442. width: 100vw;
  443. height: 100vh;
  444. background: rgba(0, 0, 0, 0.25);
  445. position: fixed;
  446. top: 0px;
  447. left: 0px;
  448. z-index: 10;
  449. }
  450. </style>