orderItem.vue 11 KB

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