waitOrderDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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. totalWeight() {
  134. let total = 0
  135. if(this.list.length){
  136. this.list.map(item =>{
  137. item.typeList.map(k =>{
  138. total = total + k.rubbishWeight
  139. })
  140. })
  141. }
  142. return total
  143. }
  144. },
  145. methods: {
  146. // 获取订单详情
  147. getOrderDetail() {
  148. uni.showLoading({
  149. title: '加载中...'
  150. })
  151. orderDetailFind({
  152. orderReserveNo: this.orderReserveNo
  153. }).then(res => {
  154. console.log(res,'rrrrrrrr')
  155. if (res.status == 200) {
  156. this.orderInfo = res.data
  157. this.orderInfo.reserveTime = moment(this.orderInfo.confirmDate).format('YYYY-MM-DD') + this.orderInfo.reserveTimeTypeDictValue
  158. }
  159. uni.hideLoading()
  160. })
  161. },
  162. // 获取垃圾类型数据
  163. getRubbishType() {
  164. this.list = []
  165. getLookUpDatas({type:'RESERVE_RUBBISH_TYPE'}).then(res=>{
  166. console.log(res,'------rrrrrr')
  167. if(res.status == 200) {
  168. this.typeData = res.data || []
  169. this.typeData.map(k =>{
  170. let p = {
  171. typeCode: k.code,
  172. typeList: []
  173. }
  174. console.log(p,'pppppp')
  175. this.list.push(p)
  176. })
  177. console.log(this.list,'this.list----------')
  178. this.curType = this.typeData.length ? this.typeData[0].code : ''
  179. this.curIndex = 0
  180. this.getRow()
  181. } else {
  182. this.typeData = []
  183. }
  184. })
  185. },
  186. // 查询列表
  187. getRow(code,num) {
  188. this.curType = code || this.curType
  189. this.curIndex = num || 0
  190. if(this.list[this.curIndex].typeList.length) return
  191. reservePriceFind({code:this.curType}).then(res => {
  192. if (res.status == 200) {
  193. let data = res.data
  194. data.forEach(item =>{
  195. item.rubbishWeight = ''
  196. item.totalAmount = ''
  197. })
  198. this.$nextTick(()=>{
  199. this.list[this.curIndex].typeList = data
  200. console.log(this.list[this.curIndex].typeList,this.curIndex,'----------lllll22222222')
  201. })
  202. } else {
  203. this.list[this.curIndex].typeList = []
  204. this.total = 0
  205. this.noDataText = res.message
  206. }
  207. })
  208. },
  209. // 选择支付方式
  210. chooseType(code) {
  211. this.payType = code
  212. console.log(this.payType,'this.payType')
  213. },
  214. // 提交
  215. submit() {
  216. // uni.redirectTo({
  217. // url: '/pages/order/finish?money=' + 12
  218. // })
  219. // return
  220. let arr = []
  221. this.list.map(item =>{
  222. item.typeList.map(k =>{
  223. if(k.rubbishWeight !=='') {
  224. let p = {
  225. rubbishType: item.typeCode, //垃圾大类型
  226. rubbishTypeItem: k.code, // 垃圾细分类型
  227. rubbishWeight: k.rubbishWeight*1000, // 垃圾重量(克)
  228. rubbishPrice: k.customerPrice, // 单价
  229. totalAmount: k.rubbishWeight* k.customerPrice // 总价金额
  230. }
  231. arr.push(p)
  232. }
  233. })
  234. })
  235. if(arr.length==0) {
  236. uni.showToast({
  237. title: '请先输入回收品类的重量!',
  238. icon: 'none'
  239. })
  240. return
  241. }
  242. if (!this.payType) {
  243. uni.showToast({
  244. title: '请选择支付方式!',
  245. icon: 'none'
  246. })
  247. return
  248. }
  249. let params = {
  250. "payType": this.payType, //支付方式
  251. originalAmount: this.originalAmount, // 支付总金额
  252. totalWeight: this.totalWeight*1000, // 总重量(g)
  253. contactName: this.orderInfo.contactName, //联系人姓名
  254. contactMobile: this.orderInfo.contactMobile, //联系人手机号
  255. contactAddress: this.orderInfo.contactAddress,//联系人地址
  256. orderReserveNo: this.orderReserveNo,
  257. orderReserveItemEntityList: arr
  258. }
  259. this.loading = true
  260. orderSubmit(params).then(res=>{
  261. if(res.status == 200) {
  262. uni.showToast({
  263. title: res.message,
  264. icon: 'none'
  265. })
  266. uni.redirectTo({
  267. url: '/pages/order/finish?money=' + res.data
  268. })
  269. }
  270. this.loading = false
  271. })
  272. }
  273. },
  274. }
  275. </script>
  276. <style lang="scss">
  277. .order-pages {
  278. width: 100%;
  279. height: 100vh;
  280. display: flex;
  281. flex-direction: column;
  282. background-color: #F5F5F5;
  283. .order-info {
  284. width: 100%;
  285. flex: 1;
  286. overflow-y: scroll;
  287. // 订单内容
  288. .info-main{
  289. background: #ffffff;
  290. padding: 10upx 32upx;
  291. margin: 20upx 32upx;
  292. border-radius: 24upx;
  293. box-shadow: 1px 1px 3px #EEEEEE;
  294. font-size: 28upx;
  295. background-image: url(../../static/order_bg_stor.png);
  296. background-repeat: no-repeat;
  297. height: 260rpx;
  298. .new-left{
  299. width: 360rpx;
  300. font-size: 36rpx;
  301. color: #191919;
  302. font-weight: 600;
  303. line-height: 44rpx;
  304. margin-top: 30rpx;
  305. }
  306. .time{
  307. padding: 20rpx 0;
  308. font-size: 32rpx;
  309. color: #7C7D7E;
  310. margin-top: 20rpx;
  311. view:last-child{
  312. font-size: 28rpx;
  313. color: #4C4C4C;
  314. margin-left: 6rpx;
  315. }
  316. }
  317. }
  318. // 状态
  319. .order-status {
  320. padding: 30upx 0;
  321. text-align: center;
  322. .status-title {
  323. font-size: 42upx;
  324. color: #191919;
  325. .icon{
  326. width: 48rpx;
  327. height: 48rpx;
  328. margin-right: 10rpx;
  329. }
  330. }
  331. .status-care {
  332. font-size: 28upx;
  333. margin-top: 10upx;
  334. color: #191919;
  335. >text {
  336. color: red;
  337. }
  338. }
  339. }
  340. // 订单信息列
  341. .item-info{
  342. border-radius: 24rpx;
  343. margin: 0rpx 32rpx 20rpx;
  344. padding: 0rpx 32rpx;
  345. background-color: #fff;
  346. .item-title{
  347. font-size: 32rpx;
  348. color: #181818;
  349. padding-top: 28rpx;
  350. .care{
  351. font-size: 24rpx;
  352. color: #FF2C5C;
  353. margin-top: 10rpx;
  354. }
  355. }
  356. .table{
  357. padding: 20rpx 0;
  358. display: flex;
  359. font-size: 28rpx;
  360. view{
  361. width: 33%;
  362. text-align: center;
  363. }
  364. }
  365. .item{
  366. padding: 28rpx 0;
  367. font-size: 32rpx;
  368. border-bottom: 1px solid #EBEBEB;
  369. :first-child{
  370. color: #7C7D7E;
  371. }
  372. :last-child-child{
  373. color: #222222;
  374. }
  375. &:last-child{
  376. border-bottom: none;
  377. }
  378. .input-left{
  379. padding: 6rpx;
  380. border-bottom: 1px solid #707070;
  381. }
  382. .item-type{
  383. padding: 0 20rpx;
  384. height: 56rpx;
  385. border: 1px solid #979797;
  386. opacity: 1;
  387. border-radius: 28rpx;
  388. font-size: 24rpx;
  389. color: #999999;
  390. text-align: center;
  391. line-height: 56rpx;
  392. margin-right: 20rpx;
  393. }
  394. .item-type.active{
  395. background-color: #4F88F7;
  396. border: none;
  397. color: #fff;
  398. }
  399. }
  400. }
  401. .price-text {
  402. font-size: 20upx;
  403. margin-left: 10upx;
  404. }
  405. .price-num {
  406. font-size: 32upx;
  407. color: red;
  408. font-weight: 600;
  409. margin-right: 6rpx;
  410. }
  411. .u-cell {
  412. padding: 10rpx 32rpx;
  413. }
  414. }
  415. .footer {
  416. padding: 20rpx 32rpx;
  417. display: flex;
  418. background-color: #fff;
  419. }
  420. }
  421. </style>