orderOK.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view class="order__ok">
  3. <view class="order__ok-top">
  4. <image class="order__ok-img" :src="selectedInfo.productImages"></image>
  5. <view class="order__ok-text">
  6. <view class="text-title">{{selectedInfo.productName}}</view>
  7. <view class="text-content">{{selectedInfo.productDesc}}</view>
  8. </view>
  9. </view>
  10. <view class="order__ok-spec">
  11. <view class="content-info">
  12. <view class="item-left">商品规格</view>
  13. <view class="item-right">
  14. <view v-for="item in selectedInfo.productAttr" :key="item.key">
  15. <!-- {{item.shopSpec}}-{{item.selectData.map((m) => m.name).join(" ")}} -->
  16. <view v-if="item.selectData && item.selectData.length > 0">
  17. {{item.shopSpec}}-{{item.selectData.map((m) => m.name).join(" ")}}
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="content-info">
  23. <view class="item-left">商品数量</view>
  24. <view class="item-right">
  25. <view>
  26. {{selectedInfo.tradeCount}}
  27. </view>
  28. </view>
  29. </view>
  30. <view class="content-info">
  31. <view class="item-left">交易方式</view>
  32. <view class="item-right">
  33. <view>
  34. {{selectedInfo.tradeType=='1'?'借用':'购买 '}}
  35. </view>
  36. </view>
  37. </view>
  38. <view class="content-info">
  39. <view class="item-left">物流方式</view>
  40. <view class="item-right">
  41. <view>
  42. {{selectedInfo.tradeType=='1'?'寄付':'到付 '}}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- <view class="order__ok-address" v-for="item in 1" :key="item"> -->
  48. <view class="order__ok-address">
  49. <view class="order__ok-title">配送信息</view>
  50. <view class="address-content">
  51. <view class="content-info">
  52. <view class="item-left">收货人</view>
  53. <view class="item-right">{{selectedInfo.contactsName}}</view>
  54. </view>
  55. <view class="content-info">
  56. <view class="item-left">收货人手机号</view>
  57. <view class="item-right">{{selectedInfo.contactsPhone}}</view>
  58. </view>
  59. <view class="content-info">
  60. <view class="item-left">收货地址</view>
  61. <view class="item-right">{{selectedInfo.address}}{{selectedInfo.receiveAddress}}</view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="footer"></view>
  66. <view class="btn">
  67. <u-button type="primary" text="立即下单" @click="submit"></u-button>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import {
  73. getOrderCreate,
  74. } from '@/api/goods.js'
  75. export default {
  76. onLoad(options) {
  77. this.id = options.id;
  78. const app = getApp();
  79. let selectedInfo = JSON.parse(JSON.stringify(app.globalData.selectedInfo));
  80. app.globalData.selectedInfo = null
  81. this.selectedInfo = selectedInfo
  82. console.log('this.selectedInfo', this.selectedInfo);
  83. },
  84. data() {
  85. return {
  86. id: '',
  87. selectedInfo: {},
  88. };
  89. },
  90. methods: {
  91. async submit() {
  92. const res = {
  93. productId: this.id,
  94. provinceId: this.selectedInfo.provinceId,
  95. areaId: this.selectedInfo.areaId,
  96. cityId: this.selectedInfo.cityId,
  97. contactsName: this.selectedInfo.contactsName,
  98. contactsPhone: this.selectedInfo.contactsPhone,
  99. expressType: this.selectedInfo.expressType,
  100. productAttr: JSON.stringify(this.selectedInfo.productAttr),
  101. productName: this.selectedInfo.productName,
  102. receiveAddress: this.selectedInfo.receiveAddress,
  103. tradeCount: this.selectedInfo.tradeCount,
  104. tradeType: this.selectedInfo.tradeType,
  105. }
  106. const res1 = await getOrderCreate(res)
  107. console.log(res1);
  108. const orderId = res1.data
  109. uni.navigateTo({
  110. url: `/pages/goods/orderOK/index?id=${orderId}`
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .order__ok {
  118. padding: 20px 16px;
  119. width: 100%;
  120. min-height: 100%;
  121. background-color: #fff;
  122. box-sizing: border-box;
  123. .order__ok-top {
  124. display: flex;
  125. //align-items: center;
  126. justify-content: space-between;
  127. width: 100%;
  128. .order__ok-img {
  129. width: 90px;
  130. height: 90px;
  131. border-radius: 8px;
  132. }
  133. .order__ok-text {
  134. width: calc(100% - 102px);
  135. // margin-left: 12px;
  136. margin-top: 4px;
  137. .text-title {
  138. color: #333;
  139. font-size: 18px;
  140. font-weight: 700;
  141. overflow: hidden;
  142. white-space: nowrap;
  143. text-overflow: ellipsis;
  144. // width: 100%;
  145. line-height: 27px;
  146. margin-bottom: 4px;
  147. }
  148. .text-content {
  149. color: #868990;
  150. font-size: 13px;
  151. height: 40px;
  152. line-height: 20px;
  153. // width: 100%;
  154. display: -webkit-box;
  155. /* 将对象作为弹性伸缩盒子模型显示 */
  156. -webkit-box-orient: vertical;
  157. /* 设置或检索伸缩盒对象的子元素的排列方式 */
  158. overflow: hidden;
  159. text-overflow: ellipsis;
  160. -webkit-line-clamp: 2;
  161. /* 显示的行数 */
  162. }
  163. }
  164. }
  165. .order__ok-spec {
  166. margin: 16px 0;
  167. background: rgba(245, 248, 253, 0.78);
  168. padding: 16px 12px;
  169. }
  170. .content-info {
  171. display: flex;
  172. align-items: flex-start; //顶部对齐
  173. justify-content: space-between;
  174. margin-bottom: 8px;
  175. &:last-child {
  176. margin-bottom: 0;
  177. }
  178. .item-left {
  179. color: #868990;
  180. font-size: 14px;
  181. font-weight: 500;
  182. width: 110px;
  183. }
  184. .item-right {
  185. color: #333;
  186. text-align: right;
  187. font-size: 15px;
  188. font-weight: 400;
  189. width: calc(100% - 110px);
  190. }
  191. }
  192. .order__ok-address {
  193. .order__ok-title {
  194. color: #333;
  195. font-size: 15px;
  196. font-weight: 500;
  197. margin-bottom: 10px;
  198. }
  199. .address-content {
  200. background: rgba(245, 248, 253, 0.78);
  201. padding: 16px 12px;
  202. }
  203. }
  204. .btn {
  205. background-color: #fff;
  206. height: 112px;
  207. width: 100%;
  208. text-align: center;
  209. padding: 10px 30px 20px;
  210. box-sizing: border-box;
  211. position: fixed;
  212. bottom: 0px;
  213. left: 0;
  214. // background-color: red;
  215. }
  216. }
  217. .footer {
  218. height: 140px;
  219. }
  220. ::v-deep .u-button {
  221. height: 50px !important;
  222. }
  223. </style>