waitOrderDetail.vue 11 KB

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