orderDetail.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <view class="warpbox">
  3. <view class="itembox">
  4. <view class="item_title">{{i18n['商品清单']}}</view>
  5. <view class="part_warp">
  6. <view class="part_item" v-for="(item,index) in partInfo" :key="index">
  7. <view class="partname">{{item.parts.name}}</view>
  8. <view class="partnum">{{i18n['编号']}}:{{item.parts.num}}</view>
  9. <view class="partinfo">
  10. <view class="parttext">{{i18n['单价']}}:¥{{item.parts.price}}</view>
  11. <view class="parttext">{{i18n['数量']}}:{{item.num}}</view>
  12. <view class="parttext">{{i18n['小计']}}:¥{{item.num * Number(item.parts.price)}}</view>
  13. </view>
  14. </view>
  15. <view class="part_total_money">{{i18n['合计']}}:¥{{totalMoney}}</view>
  16. </view>
  17. </view>
  18. <view class="itembox">
  19. <view class="item_title">{{i18n['描述信息']}}</view>
  20. <view class="fllow_area">
  21. <view class="area_head key">{{i18n['描述信息']}}</view>
  22. <textarea v-model="desc" class="textself" :placeholder="'('+i18n['必填']+')'+i18n['请输入描述信息']" placeholder-style="color:#999" />
  23. </view>
  24. </view>
  25. <view class="itembox">
  26. <view class="item_title">{{i18n['客户信息']}}</view>
  27. <view class="fllow_form">
  28. <view class="label key">{{i18n['公司名称']}}</view>
  29. <view class="form_right">
  30. <input type="text" :class="company ? 'valueActive' : '' " placeholder-style="color:#999999;font-size:24rpx" class="righttext" v-model="company"
  31. :placeholder="i18n['请输入公司名称']" />
  32. </view>
  33. </view>
  34. <view class="fllow_form">
  35. <view class="label key">{{i18n['联系人']}}</view>
  36. <view class="form_right">
  37. <input type="text" :class="name ? 'valueActive' : '' " placeholder-style="color:#999999;font-size:24rpx" class="righttext" v-model="name"
  38. :placeholder="i18n['请输入联系人姓名']" />
  39. </view>
  40. </view>
  41. <view class="fllow_form">
  42. <view class="label key">{{i18n['电话']}}</view>
  43. <view class="form_right">
  44. <input type="text" :class="mobile ? 'valueActive' : '' " placeholder-style="color:#999999;font-size:24rpx" class="righttext" v-model="mobile"
  45. :placeholder="i18n['请输入联系人手机号']" />
  46. </view>
  47. </view>
  48. <view class="info_warp">
  49. <view class="info_label">{{i18n['地址']}}</view>
  50. <view class="info_right">
  51. <view class="right_top">
  52. <pick-regions @getRegion="handleGetRegion">
  53. <view class="uni-input" :class="{valueActive:addrcity}">{{addrcity ? addrcity : i18n['请选择区域']}}</view>
  54. </pick-regions>
  55. </view>
  56. <view class="right_bot">
  57. <input type="text" v-model="addr" placeholder-style="color:#999999" :placeholder="i18n['请填写详细地址']" class="rightinput">
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="button"@click="submit">{{i18n['提交订单']}}</view>
  63. <view style="height:100rpx;"></view>
  64. </view>
  65. </template>
  66. <script>
  67. import { netCartListnum, netSubOrder } from '@/api/api.js'
  68. import pickRegions from '@/components/pick-regions/pick-regions.vue'
  69. export default{
  70. components:{
  71. pickRegions
  72. },
  73. data() {
  74. return{
  75. ids:'',
  76. company:'',
  77. name:'',
  78. mobile:'',
  79. desc:'',
  80. addrcity:'',
  81. addr:'',
  82. partInfo:[],
  83. totalMoney:0
  84. }
  85. },
  86. computed:{
  87. i18n() {
  88. return this.$t("shopmall")
  89. }
  90. },
  91. onLoad(options) {
  92. this.ids = options.ids
  93. //获取 购物车 下单配件
  94. this.getPartInfo()
  95. },
  96. onShow() {
  97. uni.setNavigationBarTitle({
  98. title: this.i18n['订单详情']
  99. })
  100. },
  101. methods:{
  102. getPartInfo() {
  103. netCartListnum({ids:this.ids,limit:100}).then(res=>{
  104. this.partInfo = res.data.data
  105. this.handleMoney()
  106. })
  107. },
  108. handleMoney() {
  109. let data = this.partInfo
  110. let money = 0
  111. data.forEach(ele=>{
  112. money += ele.num * Number(ele.parts.price)
  113. })
  114. this.totalMoney = money
  115. },
  116. submit() {
  117. if(!this.desc) {
  118. uni.showToast({
  119. title:'请填写描述信息',
  120. icon:'none'
  121. })
  122. return
  123. }
  124. if(!this.company){
  125. uni.showToast({
  126. title:'请输入公司名称',
  127. icon:'none'
  128. })
  129. return
  130. }
  131. if(!this.name){
  132. uni.showToast({
  133. title:'请输入联系人',
  134. icon:'none'
  135. })
  136. return
  137. }
  138. if(!this.mobile){
  139. uni.showToast({
  140. title:'请输入联系人手机号',
  141. icon:'none'
  142. })
  143. return
  144. }
  145. if(!this.addrcity){
  146. uni.showToast({
  147. title:'请选择区域',
  148. icon:'none'
  149. })
  150. return
  151. }
  152. if(!this.addr){
  153. uni.showToast({
  154. title:'请填写详细地址',
  155. icon:'none'
  156. })
  157. return
  158. }
  159. let params = {
  160. ids:this.ids,
  161. desc:this.desc,
  162. name:this.name,
  163. company:this.company,
  164. mobile:this.mobile,
  165. addr:this.addr,
  166. addrcity:this.addrcity
  167. }
  168. netSubOrder(params).then(res=>{
  169. // #ifdef H5
  170. console.log(res.data)
  171. window.location.href = res.data
  172. // #endif
  173. })
  174. },
  175. // 获取选择的地区
  176. handleGetRegion(region){
  177. this.addrcity = region[0].name+region[1].name+region[2].name
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="scss" scoped>
  183. .itembox{
  184. width:690rpx;
  185. margin:0 auto 24rpx;
  186. background:#fff;
  187. border-radius: 20rpx;
  188. padding:24rpx;
  189. .item_title{
  190. padding-left:35rpx;
  191. padding-bottom:24rpx;
  192. border-bottom:1rpx solid #EDEDED;
  193. font-size:26rpx;
  194. color:#666666;
  195. position: relative;
  196. &::before{
  197. content:'';
  198. width:14rpx;
  199. height:35rpx;
  200. border-radius: 8rpx;
  201. background:#65ABF6;
  202. position: absolute;
  203. left:0;
  204. top:3rpx;
  205. }
  206. }
  207. }
  208. .fllow_area {
  209. background-color: #fff;
  210. padding: 24rpx;
  211. border-bottom: 1rpx solid #EAEAEA;
  212. .area_head {
  213. font-size: 24rpx;
  214. margin-bottom:15rpx;
  215. text {
  216. color: #f00;
  217. }
  218. }
  219. .textself {
  220. width: 600rpx;
  221. height: 230rpx;
  222. background: rgba(202, 202, 202, 0.2);
  223. box-sizing: border-box;
  224. padding: 24rpx;
  225. font-size: 24rpx;
  226. margin: 0 auto;
  227. border-radius: 20rpx;
  228. }
  229. }
  230. .ordertit{
  231. width: 750rpx;
  232. height: 60rpx;
  233. background: rgba(2, 135, 255, 0.1);
  234. padding:0 30rpx;
  235. font-size:26rpx;
  236. color:#0287FF;
  237. line-height: 60rpx;
  238. }
  239. .part_warp{
  240. .part_item{
  241. padding:30rpx 50rpx;
  242. border-bottom:1rpx solid #f5f5f5;
  243. .partname{
  244. font-size:28rpx;
  245. color:#333333;
  246. }
  247. .partnum{
  248. font-size:24rpx;
  249. color:#999999;
  250. margin:15rpx 0;
  251. }
  252. .partinfo{
  253. display: flex;
  254. justify-content: space-between;
  255. align-items: center;
  256. .parttext{
  257. font-size:24rpx;
  258. color:#999999;
  259. }
  260. }
  261. }
  262. .part_total_money{
  263. padding:20rpx 35rpx;
  264. text-align: right;
  265. font-size:28rpx;
  266. color:#65ABF6;
  267. }
  268. }
  269. .part_desc{
  270. border-top:10rpx solid #f5f5f5;
  271. padding:30rpx 50rpx;
  272. .desc_tit{
  273. font-size:28rpx;
  274. color:#333333;
  275. margin-bottom:20rpx;
  276. }
  277. .desc_text{
  278. .areabox{
  279. height:200rpx;
  280. width:100%;
  281. font-size:24rpx;
  282. color:#000;
  283. }
  284. }
  285. }
  286. .info_warp{
  287. padding:24rpx;
  288. display: flex;
  289. justify-content: flex-start;
  290. align-items: center;
  291. border-bottom:1rpx solid #f5f5f5;
  292. .info_label{
  293. flex-shrink: 0;
  294. font-size:24rpx;
  295. color:#333333;
  296. width:100rpx;
  297. margin-right:30rpx;
  298. }
  299. .selfinfo{
  300. width:470rpx;
  301. font-size:24rpx;
  302. }
  303. .info_right{
  304. flex:1;
  305. .right_top{
  306. padding-right:24rpx;
  307. padding-bottom:26rpx;
  308. border-bottom:1rpx solid #f5f5f5;
  309. .uni-input{
  310. font-size:24rpx;
  311. color:#999999;
  312. text-align: right;
  313. }
  314. }
  315. .right_bot{
  316. box-sizing: border-box;
  317. padding-top:26rpx;
  318. .rightinput{
  319. width:450rpx;
  320. font-size:24rpx;
  321. color:#333;
  322. text-align: right;
  323. }
  324. }
  325. }
  326. }
  327. .fllow_form {
  328. display: flex;
  329. justify-content: space-between;
  330. border-bottom: 1rpx solid #EDEDED;
  331. padding: 24rpx;
  332. .label {
  333. font-size: 24rpx;
  334. color:#666;
  335. text {
  336. color: red;
  337. }
  338. }
  339. .form_right {
  340. display: flex;
  341. justify-content: flex-end;
  342. align-items: center;
  343. color: #999;
  344. width: 450rpx;
  345. text-align: right;
  346. input{
  347. width: 450rpx;
  348. }
  349. .righttext {
  350. font-size: 24rpx;
  351. }
  352. }
  353. }
  354. </style>