waitOrderDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <template>
  2. <view class="order-pages">
  3. <view class="order-info">
  4. <!-- 订单状态 -->
  5. <view class="order-status">
  6. <view class="status-title flex align_center justify_center">
  7. <view class="t-icon icon t-icon-icon_service"></view>
  8. {{orderInfo.orderStatusDictValue}}
  9. </view>
  10. <view class="status-care">
  11. 预约时间:{{orderInfo.reserveTime}}
  12. </view>
  13. </view>
  14. <!-- 回收品类明细 -->
  15. <view class="item-info">
  16. <view class="item-title">
  17. <view>回收品类明细</view>
  18. <view class="care">(切换分类可输入不同回收物的价格和重量)</view>
  19. </view>
  20. <view class="item flex">
  21. <view :class="['item-type', curType == item.code ? 'active' : '']" v-for="(item,index) in typeData" :key="item.id" @click="getRow(item.code,index)">
  22. {{item.dispName}}
  23. </view>
  24. <!-- <view class="item-type">
  25. 纸质类
  26. </view> -->
  27. </view>
  28. <view class="table">
  29. <view>单价(元/kg)</view>
  30. <view>重量(kg)</view>
  31. <view>合计金额(元)</view>
  32. </view>
  33. <view v-if="list.length && list[curIndex].typeList.length" v-for="item in list[curIndex].typeList" :key="item.id" class="item flex justify_between align_center">
  34. <view class="flex align_center">
  35. <text>{{item.name}}</text>
  36. <u-input :custom-style="inputLeftStyle" input-align="center" :clearable="false" v-model="item.customerPrice" placeholder="" type="number" />
  37. </view>
  38. <view class="flex flex_1 align_center">
  39. <u-input input-align="center" :clearable="false" v-model="item.rubbishWeight" placeholder="请输入重量" type="number" />
  40. </view>
  41. <view class="flex_1 flex align_center justify_center">{{item.customerPrice*item.rubbishWeight}}</view>
  42. </view>
  43. </view>
  44. <!-- 金额 -->
  45. <view class="item-info">
  46. <view class="item flex justify_between">
  47. <text>应付金额</text>
  48. <text>{{originalAmount}} 元</text>
  49. </view>
  50. <view class="item flex justify_between">
  51. <text>支付方式</text>
  52. <v-select class="flex_1" ref="payType" placeholder="请选择支付方式" @itemChange="chooseType" code="ORDER_RESERVE_PAY_TYPE" style="width: 100%"></v-select>
  53. <u-icon name="arrow-right" color="#9DA8B5" size="28"></u-icon>
  54. </view>
  55. </view>
  56. <!-- 服务信息 -->
  57. <view class="info-main flex flex_column">
  58. <view class="flex flex_1 align_center">
  59. <view class="new-left">
  60. {{orderInfo.contactAddress}}
  61. </view>
  62. </view>
  63. <view class="time flex align_center justify_between">
  64. <text>{{orderInfo.contactName}}</text>
  65. <view class="flex align_center">
  66. <view class="t-icon phone t-icon-icon_phone"></view>
  67. <text>{{orderInfo.contactMobile}}</text>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="footer">
  73. <u-button @click="submit" :loading="loading" class="flex_1" type="primary">提交</u-button>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import moment from 'moment'
  79. import { orderDetailFind, orderSubmit } from '@/api/order.js'
  80. import { getLookUpDatas } from '@/api/data.js'
  81. import { reservePriceFind } from '@/api/index.js'
  82. import vSelect from '@/components/select/v-select.vue'
  83. export default {
  84. components: {
  85. vSelect
  86. },
  87. data() {
  88. return {
  89. orderInfo: {},
  90. totalPrice: 0, // 支付合计
  91. orderReserveNo: '', // 订单号
  92. inputLeftStyle: {
  93. Width: '120rpx',
  94. borderBottom: '1px solid #707070',
  95. padding: '0rpx 10rpx',
  96. color: '#191919'
  97. },
  98. curType: '', // 当前类型
  99. curIndex: 0, // 当前类型index
  100. typeData: [], // 垃圾类型数据
  101. list: [],
  102. payType: '', // 支付方式
  103. loading: false
  104. }
  105. },
  106. onLoad(options) {
  107. if (options.orderNo) {
  108. console.log(options.orderNo)
  109. this.orderReserveNo = options.orderNo
  110. this.getOrderDetail()
  111. this.getRubbishType()
  112. }
  113. // 开启分享
  114. uni.showShareMenu({
  115. withShareTicket: true,
  116. menus: ['shareAppMessage', 'shareTimeline']
  117. })
  118. },
  119. computed: {
  120. // 支付总金额
  121. originalAmount() {
  122. let total = 0
  123. if(this.list.length){
  124. this.list.map(item =>{
  125. item.typeList.map(k =>{
  126. total = total + (k.customerPrice*k.rubbishWeight)
  127. })
  128. })
  129. }
  130. return total
  131. }
  132. },
  133. methods: {
  134. // 获取订单详情
  135. getOrderDetail() {
  136. uni.showLoading({
  137. title: '加载中...'
  138. })
  139. orderDetailFind({
  140. orderReserveNo: this.orderReserveNo
  141. }).then(res => {
  142. console.log(res,'rrrrrrrr')
  143. if (res.status == 200) {
  144. this.orderInfo = res.data
  145. this.orderInfo.reserveTime = moment(this.orderInfo.confirmDate).format('YYYY-MM-DD') + this.orderInfo.reserveTimeType
  146. }
  147. uni.hideLoading()
  148. })
  149. },
  150. // 获取垃圾类型数据
  151. getRubbishType() {
  152. this.list = []
  153. getLookUpDatas({type:'RESERVE_RUBBISH_TYPE'}).then(res=>{
  154. console.log(res,'------rrrrrr')
  155. if(res.status == 200) {
  156. this.typeData = res.data || []
  157. this.typeData.map(k =>{
  158. let p = {
  159. typeCode: k.code,
  160. typeList: []
  161. }
  162. console.log(p,'pppppp')
  163. this.list.push(p)
  164. })
  165. console.log(this.list,'this.list----------')
  166. this.curType = this.typeData.length ? this.typeData[0].code : ''
  167. this.curIndex = 0
  168. this.getRow()
  169. } else {
  170. this.typeData = []
  171. }
  172. })
  173. },
  174. // 查询列表
  175. getRow(code,num) {
  176. this.curType = code || this.curType
  177. this.curIndex = num || 0
  178. if(this.list[this.curIndex].typeList.length) return
  179. reservePriceFind({code:this.curType}).then(res => {
  180. if (res.status == 200) {
  181. let data = res.data
  182. data.forEach(item =>{
  183. item.rubbishWeight = ''
  184. item.totalAmount = ''
  185. })
  186. this.$nextTick(()=>{
  187. this.list[this.curIndex].typeList = data
  188. console.log(this.list[this.curIndex].typeList,this.curIndex,'----------lllll22222222')
  189. })
  190. } else {
  191. this.list[this.curIndex].typeList = []
  192. this.total = 0
  193. this.noDataText = res.message
  194. }
  195. })
  196. },
  197. // 选择支付方式
  198. chooseType(code) {
  199. this.payType = code
  200. console.log(this.payType,'this.payType')
  201. },
  202. // 提交
  203. submit() {
  204. // uni.redirectTo({
  205. // url: '/pages/order/finish?money=' + 12
  206. // })
  207. // return
  208. let arr = []
  209. this.list.map(item =>{
  210. item.typeList.map(k =>{
  211. if(k.rubbishWeight !=='') {
  212. let p = {
  213. rubbishType: item.typeCode, //垃圾大类型
  214. rubbishTypeItem: k.code, // 垃圾细分类型
  215. rubbishWeight: k.rubbishWeight, // 垃圾重量(克)
  216. rubbishPrice: k.rubbishPrice, // 单价
  217. totalAmount: k.rubbishWeight* k.rubbishPrice // 总价金额
  218. }
  219. arr.push(p)
  220. }
  221. })
  222. })
  223. if(arr.length==0) {
  224. uni.showToast({
  225. title: '请先输入回收品类的重量!',
  226. icon: 'none'
  227. })
  228. return
  229. }
  230. if (!this.payType) {
  231. uni.showToast({
  232. title: '请选择支付方式!',
  233. icon: 'none'
  234. })
  235. return
  236. }
  237. let params = {
  238. "payType": this.payType, //支付方式
  239. originalAmount: this.originalAmount, // 支付总金额
  240. contactName: this.orderInfo.contactName, //联系人姓名
  241. contactMobile: this.orderInfo.contactMobile, //联系人手机号
  242. contactAddress: this.orderInfo.contactAddress,//联系人地址
  243. orderReserveNo: this.orderReserveNo,
  244. orderReserveItemEntityList: arr
  245. }
  246. this.loading = true
  247. orderSubmit(params).then(res=>{
  248. if(res.status == 200) {
  249. uni.showToast({
  250. title: res.message,
  251. icon: 'none'
  252. })
  253. uni.redirectTo({
  254. url: '/pages/order/finish?money=' + res.data
  255. })
  256. }
  257. this.loading = false
  258. })
  259. }
  260. },
  261. }
  262. </script>
  263. <style lang="scss">
  264. .order-pages {
  265. width: 100%;
  266. height: 100vh;
  267. display: flex;
  268. flex-direction: column;
  269. background-color: #F5F5F5;
  270. .order-info {
  271. width: 100%;
  272. flex: 1;
  273. overflow-y: scroll;
  274. // 订单内容
  275. .info-main{
  276. background: #ffffff;
  277. padding: 10upx 32upx;
  278. margin: 20upx 32upx;
  279. border-radius: 24upx;
  280. box-shadow: 1px 1px 3px #EEEEEE;
  281. font-size: 28upx;
  282. background-image: url(../../static/order_bg_stor.png);
  283. background-repeat: no-repeat;
  284. height: 260rpx;
  285. .new-left{
  286. width: 360rpx;
  287. font-size: 36rpx;
  288. color: #191919;
  289. font-weight: 600;
  290. line-height: 44rpx;
  291. margin-top: 30rpx;
  292. }
  293. .time{
  294. padding: 20rpx 0;
  295. font-size: 32rpx;
  296. color: #7C7D7E;
  297. margin-top: 20rpx;
  298. view:last-child{
  299. font-size: 28rpx;
  300. color: #4C4C4C;
  301. margin-left: 6rpx;
  302. }
  303. }
  304. }
  305. // 状态
  306. .order-status {
  307. padding: 30upx 0;
  308. text-align: center;
  309. .status-title {
  310. font-size: 42upx;
  311. color: #191919;
  312. .icon{
  313. width: 48rpx;
  314. height: 48rpx;
  315. margin-right: 10rpx;
  316. }
  317. }
  318. .status-care {
  319. font-size: 28upx;
  320. margin-top: 10upx;
  321. color: #191919;
  322. >text {
  323. color: red;
  324. }
  325. }
  326. }
  327. // 订单信息列
  328. .item-info{
  329. border-radius: 24rpx;
  330. margin: 0rpx 32rpx 20rpx;
  331. padding: 0rpx 32rpx;
  332. background-color: #fff;
  333. .item-title{
  334. font-size: 32rpx;
  335. color: #181818;
  336. padding-top: 28rpx;
  337. .care{
  338. font-size: 24rpx;
  339. color: #FF2C5C;
  340. margin-top: 10rpx;
  341. }
  342. }
  343. .table{
  344. padding: 20rpx 0;
  345. display: flex;
  346. font-size: 28rpx;
  347. view{
  348. width: 33%;
  349. text-align: center;
  350. }
  351. }
  352. .item{
  353. padding: 28rpx 0;
  354. font-size: 32rpx;
  355. border-bottom: 1px solid #EBEBEB;
  356. :first-child{
  357. color: #7C7D7E;
  358. }
  359. :last-child-child{
  360. color: #222222;
  361. }
  362. &:last-child{
  363. border-bottom: none;
  364. }
  365. .input-left{
  366. padding: 6rpx;
  367. border-bottom: 1px solid #707070;
  368. }
  369. .item-type{
  370. padding: 0 20rpx;
  371. height: 56rpx;
  372. border: 1px solid #979797;
  373. opacity: 1;
  374. border-radius: 28rpx;
  375. font-size: 24rpx;
  376. color: #999999;
  377. text-align: center;
  378. line-height: 56rpx;
  379. margin-right: 20rpx;
  380. }
  381. .item-type.active{
  382. background-color: #4F88F7;
  383. border: none;
  384. color: #fff;
  385. }
  386. }
  387. }
  388. .price-text {
  389. font-size: 20upx;
  390. margin-left: 10upx;
  391. }
  392. .price-num {
  393. font-size: 32upx;
  394. color: red;
  395. font-weight: 600;
  396. margin-right: 6rpx;
  397. }
  398. .u-cell {
  399. padding: 10rpx 32rpx;
  400. }
  401. }
  402. .footer {
  403. padding: 20rpx 32rpx;
  404. display: flex;
  405. background-color: #fff;
  406. }
  407. }
  408. </style>