waitOrderDetail.vue 9.8 KB

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