orderItem.vue 12 KB

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