maintainSubmit.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <view class="box">
  3. <view class="cont">
  4. <view class="itemBox flex">
  5. <image class="itemIMg" v-if="itemDefault.mainImgUrl" :src="itemDefault.mainImgUrl" mode=""></image>
  6. <image class="itemIMg" v-else src="../../static/timg/noimg.png" mode=""></image>
  7. <view class="itemRight">
  8. <view class="itemName">{{itemDefault.goodsname}}</view>
  9. <view class="buyType">{{itemDefault.title}}</view>
  10. <view class="priceBox">
  11. <view class="price">¥{{itemDefault.money}}</view>
  12. <view class="itemNum">X{{itemDefault.goodsnum}}</view>
  13. </view>
  14. <view class="itemnotes">注:该商品购买后不支持线上退款</view>
  15. </view>
  16. </view>
  17. <view class="mealBox">
  18. <view class="fwlcTitle">套餐内容</view>
  19. </view>
  20. <view class="goodsBox">
  21. <view class="goodsline flex" style="border-bottom: 1px solid #EEEEEE;">
  22. <view class="goodsLeft">商品总价</view>
  23. <view class="goodRight">¥{{totalPrice}}</view>
  24. </view>
  25. <view class="goodsline flex" >
  26. <view class="goodsLeft"></view>
  27. <view class="goodRight" style="font-size: 26rpx;font-weight: 500;">合计 <span style="color: #EC0F0A;"> ¥{{totalPrice}}</span></view>
  28. </view>
  29. </view>
  30. <view class="goodsBox">
  31. <view class="goodsline flex" style="border-bottom: 1px solid #EEEEEE;">
  32. <view class="goodsLeft">支付方式</view>
  33. <view class="goodRight">线上支付</view>
  34. </view>
  35. <view class="goodsline flex" >
  36. <view class="goodsLeft">使用方式</view>
  37. <view class="goodRight" >到店使用</view>
  38. </view>
  39. </view>
  40. </view>
  41. <view style="height: 150rpx;"></view>
  42. <view class="bottom">
  43. <view class="bleft">
  44. <span>合计</span>
  45. <span>¥</span>
  46. <span style="font-weight: 500;font-size: 34rpx;color: #EC0F0A;">{{totalPrice}}</span>
  47. </view>
  48. <view class="Btn" @click="submitFn">提交订单</view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. components: {
  55. },
  56. data() {
  57. return {
  58. themeColor:'',
  59. ext:'',
  60. goodsnum:1,
  61. itemDefault:'',
  62. totalPrice:'',
  63. sheetDetail:[],
  64. userInfo:'',
  65. carInfo:'',
  66. }
  67. },
  68. onLoad(opt) {
  69. this.ext = this.$common.getExtStoreId();
  70. this.themeColor = uni.getStorageSync("themeColor");
  71. this.itemDefault=uni.getStorageSync("itemDefault");
  72. this.totalPrice=this.itemDefault.goodsnum*this.itemDefault.money
  73. this.totalPrice=this.totalPrice.toFixed(2)
  74. var obj={
  75. itemId:this.itemDefault.itemId,
  76. itemName:this.itemDefault.goodsname,
  77. itemQty:this.itemDefault.goodsnum,
  78. salePrice:this.itemDefault.money,
  79. totalPrice:this.totalPrice,
  80. packageItemID:this.itemDefault.id,
  81. }
  82. this.sheetDetail.push(obj)
  83. this.carInfo=this.$store.state.carInfo;
  84. this.userInfo=uni.getStorageSync("wxOpenData");
  85. console.log(this.userInfo)
  86. },
  87. onShow() {
  88. },
  89. methods: {
  90. submitFn(){
  91. var params={
  92. sheetType:7,
  93. sheetContent:this.itemDefault.goodsname,
  94. customerName:this.userInfo.loginInfo.customerInfo.customerName,
  95. mobilePhone:this.userInfo.loginInfo.customerInfo.mobilePhone,
  96. plateNumber:this.carInfo.plateNumber,
  97. carModel:this.carInfo.carModel,
  98. totalMoney:this.totalPrice,
  99. sheetDetail:JSON.stringify(this.sheetDetail),
  100. groupType:0,
  101. comment:'',
  102. shareId:'',
  103. shopId:this.userInfo.loginInfo.customerInfo.shopID,
  104. }
  105. uni.showLoading({
  106. title: '加载中'
  107. })
  108. this.$http('openMallOrder/submitOrder', params,'POST').then(res => {
  109. uni.hideLoading();
  110. if(res.code==0){
  111. this.orderData=res.data
  112. this.unifiedPay(res.data)
  113. }else{
  114. uni.showToast({
  115. title: res.msg,
  116. icon: 'none',
  117. duration: 3000
  118. });
  119. }
  120. })
  121. },
  122. unifiedPay(res){
  123. this.$http('openMallOrder/unifiedPay', {
  124. sheetId:res.id
  125. },'POST').then(res => {
  126. this.isgo=true;
  127. if(res.code==0){
  128. this.requestPayment(res.data)
  129. }else{
  130. uni.showToast({
  131. title: res.msg,
  132. icon: 'none',
  133. duration: 3000
  134. });
  135. }
  136. })
  137. },
  138. requestPayment(res){
  139. var payInfo=res;
  140. //console.log(payInfo)
  141. //console.log(String(Date.now()))
  142. var that=this;
  143. uni.requestPayment({
  144. provider: 'wxpay',
  145. //timeStamp: String(Date.now()),
  146. timeStamp: payInfo.timeStamp,
  147. nonceStr: payInfo.nonceStr,
  148. package:payInfo.package,
  149. signType: payInfo.signType,
  150. paySign: payInfo.paySign,
  151. appid:payInfo.appId,
  152. success: function (res) {
  153. console.log('success:' + JSON.stringify(res));
  154. uni.showToast({
  155. title: '支付成功',
  156. icon:'none',
  157. duration: 2000
  158. });
  159. uni.navigateTo({
  160. url:'paySuccess?type=1'
  161. })
  162. },
  163. fail: function (err) {
  164. console.log(err)
  165. uni.showToast({
  166. title: '支付失败',
  167. icon:'none',
  168. duration: 2000
  169. });
  170. uni.navigateTo({
  171. url:'paySuccess?type=2'
  172. })
  173. }
  174. });
  175. },
  176. }
  177. }
  178. </script>
  179. <style scoped lang="less">
  180. .box {
  181. width: 100vw;
  182. min-height: 100vh;
  183. background: #F4F4F4;
  184. }
  185. .cont{
  186. padding: 20rpx 24rpx;
  187. }
  188. .itemBox{
  189. background: #FFFFFF;
  190. border-radius: 16rpx;padding: 24rpx;
  191. }
  192. .itemIMg{
  193. width: 180rpx;
  194. height: 180rpx;border-radius: 10rpx;
  195. }
  196. .flex{
  197. display: flex;
  198. }
  199. .itemRight{
  200. width: 450rpx;padding-left: 24rpx;
  201. }
  202. .itemName{
  203. font-weight: 500;
  204. font-size: 28rpx;
  205. color: #222222;
  206. line-height: 40rpx;
  207. }
  208. .buyType{
  209. width: 106rpx;text-align: center;
  210. height: 32rpx;line-height: 32rpx;
  211. border-radius: 5rpx;
  212. border: 1px solid #FF0035;font-size: 22rpx;
  213. color: #FF0035;
  214. margin-top: 10rpx;
  215. }
  216. .priceBox{
  217. display: flex;justify-content: space-between;padding-top: 10rpx;
  218. }
  219. .price{
  220. font-weight: 500;
  221. font-size: 36rpx;
  222. color: #222222;
  223. line-height: 50rpx;
  224. }
  225. .itemNum{
  226. font-size: 34rpx;line-height: 50rpx;
  227. color: #686868;
  228. }
  229. .itemnotes{
  230. font-size: 24rpx;padding-top: 12rpx;
  231. color: #FFC107;
  232. }
  233. .mealBox{
  234. background: #FFFFFF;
  235. padding: 20rpx 24rpx;
  236. margin-top: 20rpx;
  237. }
  238. .fwlcTitle{
  239. color: #333333;font-size: 30rpx;font-weight: 500;
  240. }
  241. .mealTop{
  242. display: flex;
  243. justify-content: space-between;
  244. height: 72rpx;
  245. line-height: 72rpx;
  246. font-weight: 500;
  247. font-size: 26rpx;
  248. color: #222222;
  249. font-size: 26rpx;
  250. padding: 0 20rpx;
  251. }
  252. .mealNum{
  253. text-align: center;
  254. width: 120rpx;
  255. }
  256. .mealexpire{
  257. text-align: center; width: 120rpx;
  258. }
  259. .mealName{
  260. width: 460rpx;
  261. }
  262. .mealTop2{
  263. display: flex;
  264. justify-content: space-between;
  265. height: 72rpx;
  266. line-height: 72rpx;
  267. font-weight: 500;
  268. font-size: 26rpx;
  269. color: #222222;
  270. font-size: 26rpx;
  271. padding: 0 20rpx;
  272. background: #FFF6DB;
  273. }
  274. .mealXj{
  275. background: #FFFCF3;
  276. }
  277. .xjLine{
  278. display: flex;
  279. font-weight: 500;
  280. font-size: 26rpx;
  281. color: #222222;
  282. padding: 20rpx 20rpx;
  283. }
  284. .xjyd{
  285. width: 8rpx;
  286. height: 8rpx;
  287. background: #FABF1B;
  288. border-radius: 50rpx;
  289. margin-top: 12rpx;
  290. margin-right: 10rpx;
  291. }
  292. .mealMs{
  293. background: #FFFFFF;
  294. padding: 20rpx;
  295. font-weight: 400;
  296. font-size: 24rpx;
  297. color: #9A9A9A;
  298. line-height: 38rpx;
  299. }
  300. .goodsBox{
  301. padding: 10rpx 18rpx;font-size: 26rpx;
  302. color: #222222;background: #FFFFFF;margin-top: 20rpx;
  303. border-radius: 16rpx;
  304. }
  305. .goodsline{
  306. justify-content: space-between;
  307. padding: 18rpx 0;
  308. }
  309. .bottom{
  310. background: #FFFFFF;
  311. display: flex;
  312. justify-content: space-between;
  313. position: fixed;
  314. width: 100%;
  315. padding:30rpx 0;
  316. /* padding-bottom: constant(safe-area-inset-bottom);
  317. padding-bottom: env(safe-area-inset-bottom); */
  318. left: 0;bottom: 0;
  319. }
  320. .bleft{
  321. font-weight: 500;
  322. font-size: 26rpx;
  323. color: #222222;
  324. line-height: 86rpx;
  325. padding-left: 50rpx;
  326. }
  327. .Btn{
  328. width: 223rpx;text-align: center;
  329. height: 86rpx;line-height: 86rpx;
  330. background: #FCD903;
  331. border-radius: 43rpx;
  332. font-size: 32rpx;
  333. color: #110B01;
  334. margin-right: 36rpx;
  335. }
  336. </style>