create-recharge-order.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="container order clearfix" :style="{ paddingBottom: isIphoneX ? '170rpx' : '134rpx' }">
  3. <view class="product-info">
  4. <view class="product-logo"> <image :src="productInfo.mainImage" mode=""></image> </view>
  5. <view class="product-cent">
  6. <view class="product-name">商品编码:{{ productInfo.productCode }}</view>
  7. <view class="product-note">规格:{{ productInfo.unit }}</view> <view class="product-nums">X1</view>
  8. </view>
  9. </view>
  10. <view class="created-info">
  11. <view class="created-item">
  12. <view class="label">商品名称:</view>
  13. <input
  14. class="input"
  15. type="text"
  16. v-model="params.name"
  17. placeholder="必填,最多不超过40个汉字"
  18. maxlength="40"
  19. />
  20. </view>
  21. <view class="created-item">
  22. <view class="label">商品价格:</view>
  23. <input class="input" type="number" v-model="params.price" placeholder="必填" maxlength="20" />
  24. </view>
  25. <view class="created-item">
  26. <view class="label">备注:</view>
  27. <input
  28. class="input"
  29. type="text"
  30. v-model="params.note"
  31. placeholder="选填,最多不超过50个汉字"
  32. maxlength="50"
  33. />
  34. </view>
  35. <view class="created-item">
  36. <view class="label-total"
  37. >合计:<text class="red">¥{{ params.price | NumFormat }}</text>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="footer" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
  42. <view class="footer-le">
  43. <view class="footer-count"> <text>共1件商品</text> </view>
  44. <view class="footer-price">
  45. <view class="sum"
  46. >总价:<text class="price">¥{{ params.price | NumFormat }}</text></view
  47. >
  48. </view>
  49. </view>
  50. <view class="footer-submit" @click.stop="orderSubmitMit"> <view class="btn">提交订单</view> </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. data() {
  57. return {
  58. isIphoneX: this.$store.state.isIphoneX,
  59. productInfo: {},
  60. userId: 0,
  61. params: {
  62. name: '',
  63. price: '',
  64. note: '',
  65. clubId: 0,
  66. serviceProviderId: 0
  67. }
  68. }
  69. },
  70. onLoad() {
  71. this.initStorage()
  72. },
  73. filters: {
  74. NumFormat(value) {
  75. //处理金额
  76. return Number(value).toFixed(2)
  77. }
  78. },
  79. methods: {
  80. async initStorage() {
  81. const culbInfo = await this.$api.getComStorage('orderUserInfo')
  82. const userInfo = await this.$api.getStorage()
  83. this.userId = culbInfo.userId ? culbInfo.userId : 0
  84. this.params.clubId = culbInfo.clubId ? culbInfo.clubId : 0
  85. this.params.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  86. this.getInitCrearOrder()
  87. },
  88. getInitCrearOrder(option) {
  89. //协销购物车跳转确认订单初始化信息
  90. this.SellerService.SellerProductRechargeGoods({
  91. productId: 6060
  92. })
  93. .then(response => {
  94. this.productInfo = response.data
  95. console.log(this.productInfo)
  96. })
  97. .catch(error => {
  98. this.$util.msg(error.msg, 2000)
  99. })
  100. },
  101. orderSubmitMit() {
  102. //提交订单
  103. if (this.params.name == '') {
  104. this.$util.msg('请填写商品名称', 2000)
  105. return
  106. }
  107. if (this.params.price == '') {
  108. this.$util.msg('请填写商品价格', 2000)
  109. return
  110. }
  111. this.SellerService.SellerSubmitRechargeOrder(this.params)
  112. .then(response => {
  113. const data = response.data
  114. this.$util.msg('订单提交成功', 2000, true, 'success')
  115. setTimeout(() => {
  116. this.$api.redirectTo(
  117. `/pages/seller/order/order-details?type=cash&orderId=${data.orderId}&userId=${this.userId}`
  118. )
  119. }, 2000)
  120. })
  121. .catch(error => {
  122. this.$util.msg(error.msg, 2000)
  123. })
  124. }
  125. },
  126. onShow() {}
  127. }
  128. </script>
  129. <style lang="scss">
  130. page {
  131. height: auto;
  132. background: #f7f7f7;
  133. }
  134. .product-info {
  135. width: 100%;
  136. height: 228rpx;
  137. float: left;
  138. box-sizing: border-box;
  139. padding: 24rpx;
  140. background-color: #ffffff;
  141. .product-logo {
  142. width: 180rpx;
  143. height: 180rpx;
  144. border-radius: 8rpx;
  145. float: left;
  146. image {
  147. width: 180rpx;
  148. height: 180rpx;
  149. display: block;
  150. border-radius: 8rpx;
  151. }
  152. }
  153. .product-cent {
  154. width: 498rpx;
  155. height: 180rpx;
  156. float: right;
  157. .product-name {
  158. width: 100%;
  159. height: 50rpx;
  160. float: left;
  161. line-height: 50rpx;
  162. font-size: $font-size-28;
  163. color: #333333;
  164. text-align: left;
  165. }
  166. .product-note {
  167. width: 100%;
  168. height: 50rpx;
  169. float: left;
  170. line-height: 50rpx;
  171. font-size: $font-size-28;
  172. color: #999999;
  173. text-align: left;
  174. }
  175. .product-nums {
  176. width: 100%;
  177. height: 50rpx;
  178. float: left;
  179. line-height: 50rpx;
  180. font-size: $font-size-28;
  181. color: #333333;
  182. text-align: right;
  183. margin-top: 40rpx;
  184. }
  185. }
  186. }
  187. .created-info {
  188. width: 100%;
  189. height: auto;
  190. box-sizing: border-box;
  191. padding: 24rpx;
  192. background-color: #ffffff;
  193. float: left;
  194. .created-item {
  195. width: 100%;
  196. height: 64rpx;
  197. float: left;
  198. margin-bottom: 24rpx;
  199. .label {
  200. width: 148rpx;
  201. height: 64rpx;
  202. line-height: 64rpx;
  203. font-size: $font-size-28;
  204. text-align: left;
  205. color: #666666;
  206. float: left;
  207. }
  208. .input {
  209. width: 550rpx;
  210. height: 64rpx;
  211. box-sizing: border-box;
  212. border: 1px solid #e1e1e1;
  213. padding: 0 20rpx;
  214. line-height: 64rpx;
  215. font-size: $font-size-26;
  216. color: #666666;
  217. float: left;
  218. border-radius: 8rpx;
  219. }
  220. .label-total {
  221. text-align: right;
  222. font-size: $font-size-28;
  223. .red {
  224. color: #f94b4b;
  225. }
  226. }
  227. }
  228. }
  229. .footer {
  230. position: fixed;
  231. left: 0;
  232. bottom: 0;
  233. z-index: 995;
  234. display: flex;
  235. align-items: center;
  236. width: 100%;
  237. height: 110rpx;
  238. line-height: 110rpx;
  239. justify-content: space-between;
  240. font-size: $font-size-28;
  241. background-color: #ffffff;
  242. z-index: 998;
  243. color: $text-color;
  244. .footer-le {
  245. width: 570rpx;
  246. height: 100%;
  247. float: left;
  248. }
  249. .footer-count {
  250. float: left;
  251. padding-left: 24rpx;
  252. width: 190rpx;
  253. box-sizing: border-box;
  254. font-size: $font-size-26;
  255. }
  256. .footer-price {
  257. width: 370rpx;
  258. float: right;
  259. text-align: right;
  260. color: $text-color;
  261. padding: 10rpx 20rpx 10rpx 0;
  262. box-sizing: border-box;
  263. .sum {
  264. width: 100%;
  265. height: 90rpx;
  266. line-height: 90rpx;
  267. float: left;
  268. .price {
  269. font-size: $font-size-32;
  270. color: #ff2a2a;
  271. }
  272. }
  273. }
  274. .footer-submit {
  275. display: flex;
  276. align-items: center;
  277. justify-content: center;
  278. width: 180rpx;
  279. height: 100%;
  280. box-sizing: border-box;
  281. padding: 15rpx 5rpx;
  282. .btn {
  283. width: 100%;
  284. height: 100%;
  285. color: #ffffff;
  286. background: linear-gradient(135deg, rgba(242, 143, 49, 1) 0%, rgba(225, 86, 22, 1) 100%);
  287. font-size: $font-size-26;
  288. text-align: center;
  289. line-height: 80rpx;
  290. border-radius: 40rpx;
  291. }
  292. }
  293. }
  294. </style>