IntegraPay.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <view class="container">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <view class="topStatus u-flex-center-sa u-plr30" :style="{top:tabTop+'px'}" v-if="sureDataAll.is_able_select_self_take">
  5. <text class="u-1A1A1A u-font30 " :class="status==1?'active':''" @click="changeStatus(1)">快递配送</text>
  6. <text class="u-1A1A1A u-font30" :class="status==2?'active':''" @click="changeStatus(2)" >上门自提</text>
  7. </view>
  8. <view class="carbox" :class="sureDataAll.is_able_select_self_take?'changeTabtwo':''">
  9. <view class="addressBox">
  10. <view class="" v-if="status==1">
  11. <ldaddress :value="sureDataAll.receipt" :link='true'></ldaddress>
  12. </view>
  13. <view class="goHome" v-if="status==2&&sureDataAll.is_able_select_self_take">
  14. <view class="u-flex-center u-p30 u-border-one">
  15. <image class="u-avatar104 u-mr25" :src="sureDataAll.self_take_shop.logo" mode=""></image>
  16. <view class="u-flex1">
  17. <view class="u-1A1A1A u-font28 u-bold ">{{sureDataAll.self_take_shop.shop_name}}</view>
  18. <view class="smallAddress u-mt10">
  19. <text class="iconfont u-font30 u-mr10 " style="color: #0F8947;">&#xe611;</text>
  20. <text class="u-font24 u-bold u-999">{{sureDataAll.self_take_shop.province_name}}{{sureDataAll.self_take_shop.city_name}}{{sureDataAll.self_take_shop.area_name}}{{sureDataAll.self_take_shop.address}}</text>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="u-flex-center u-p30">
  25. <view class="u-mr45 u-font28 u-999 u-flex-center">
  26. <text class="u-333 u-bold">提货人:</text>
  27. <input style="width: 150rpx;" type="text" value="" @input="userName" maxlength="8" placeholder="提货人姓名" placeholder-style="font-size:30rpx;" />
  28. </view>
  29. <view class="u-font28 u-999 u-flex-center">
  30. <text class="u-mr10 iconfont u-02331F u-font30">&#xe64e;</text>
  31. <input style="width: 260rpx;" type="number" value="" maxlength="11" @input="userMobile" placeholder="提货人手机号"placeholder-style="font-size:30rpx;" />
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="" v-for="(pitem,index) in sureDataAll.shop_orders" :key='pitem.source_shop_id'>
  37. <view class="shopList u-mt10" >
  38. <ldshop :shopStatus='shopStatus' :value="pitem.source_shop_name"></ldshop>
  39. <view v-for="item in pitem.items" :key='item.goods_id'>
  40. <ldgoods :value="item" :zhe="false" :isInter='true'></ldgoods>
  41. </view>
  42. </view>
  43. <!-- list -->
  44. <view class="listText u-mt10">
  45. <!-- <view class="u-border-one u-p30 u-flex-center-sb">
  46. <view class="u-font28 u-181818">
  47. <text>商品金额</text>
  48. </view>
  49. <view class="u-font30 u-999">
  50. ¥ {{pitem.original_goods_amount}}
  51. </view>
  52. </view> -->
  53. <view class="u-border-one u-p30 u-flex-center-sb">
  54. <view class="u-font28 u-181818">
  55. <text>运费</text>
  56. </view>
  57. <view class="u-font30 u-999" >
  58. {{pitem.total_freight?'+¥'+pitem.total_freight+'元':'免运费'}}
  59. </view>
  60. </view>
  61. <!-- <view class="u-border-one-one u-p30 u-flex-center-sb">
  62. <view class="u-font28 u-181818">
  63. <text>店铺会员折扣({{pitem.user_role_name}})</text>
  64. </view>
  65. <view class="u-font30 u-999">
  66. -¥ {{pitem.discount_amount}}
  67. </view>
  68. </view> -->
  69. <view class="u-border-one u-p30 u-flex-center-sb" v-if="pitem.first_order_activity">
  70. <view class="u-font28 u-181818">
  71. <text>首单优惠</text>
  72. <text class="u-font24 u-999">(满{{pitem.first_order_activity.full}}减{{pitem.first_order_activity.reduction}})</text>
  73. </view>
  74. <view class="u-font30 u-999">
  75. -¥ {{pitem.first_order_reduced}}
  76. </view>
  77. </view>
  78. <view class="u-border-one u-p30 u-flex-center-sb">
  79. <view class="u-font28 u-181818">
  80. <text>支付</text>
  81. </view>
  82. <view class="u-flex-center-sb">
  83. <view class="u-flex-center-sb" v-if="pitem.total_point>0">
  84. <text class="u-font24 ">积分:</text>
  85. <view class="u-font30 u-FF0000 u-bold ">
  86. {{pitem.total_point}}
  87. </view></view><view class="u-flex-center-sb u-ml30" v-if="pitem.total_amount>0">
  88. <text >金额:</text>
  89. <view class="u-font30 u-FF0000 u-bold" >
  90. <rich-text :nodes="$mUtil.priceBigSmall(pitem.total_amount)" ></rich-text>
  91. </view></view>
  92. </view>
  93. </view>
  94. </view>
  95. <!-- 备注 -->
  96. <view class="listText u-p30 u-mt10">
  97. <view class="u-font28 u-181818">购买备注</view>
  98. <textarea class="textarea u-mt10 u-font28 u-333" @input="textareaText($event,index)" value="" placeholder="选填,给商家留言"/>
  99. </view>
  100. </view>
  101. </view>
  102. <!-- 底部 -->
  103. <view class="botfixed u-flex-center-sb">
  104. <view class="leftAll u-flex-center">
  105. <view class="u-flex-center">
  106. <text class="u-mr20 u-font30 u-666">共{{totaltNum}}件</text>
  107. <!-- <text class="u-font28 u-333 ">合计:</text>
  108. <view class="u-FF0000 u-bold">
  109. <rich-text :nodes="$mUtil.priceBigSmall(sureDataAll.total_money)" ></rich-text>
  110. </view> -->
  111. </view>
  112. </view>
  113. <view class="rightP u-flex-center" @click="submitOrder">
  114. <view class="u-btn btnWidth u-ml30">提交订单</view>
  115. </view>
  116. </view>
  117. <!--页面加载动画-->
  118. <ldLoading isFullScreen :active="loading"></ldLoading>
  119. </view>
  120. </template>
  121. <script>
  122. var app = getApp()
  123. import ldaddress from '../../../components/ld-address/ld-address.vue'
  124. import ldshop from '../../../components/ld-shop/ld-shop.vue'
  125. import ldgoods from '../../../components/ld-goods/ld-goods.vue'
  126. export default{
  127. components:{
  128. ldaddress,
  129. ldshop,
  130. ldgoods
  131. },
  132. data(){
  133. return{
  134. shopStatus:false,
  135. totaltNum:0,
  136. tabTop:0,
  137. price:20,
  138. loading:false,
  139. status:1,//快递方式标志
  140. config: {
  141. back: true, //false是tolbar页面 是则不写
  142. title: '确认订单',
  143. color: '#1a1a1a',
  144. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  145. backgroundColor: [1, "#fff"],
  146. statusBarFontColor: '#fff'
  147. },
  148. sureDataAll:{},
  149. shopDiscounts:{},
  150. self_take:{},
  151. dataJson:{},
  152. sureData:{},
  153. addressChose:false,
  154. imgUrl: this.$mConfig.staticUrl
  155. }
  156. },
  157. onLoad(options) {
  158. this.loading = true;
  159. this.tabTop=app.globalData.barHeight+44;
  160. let dataJson = uni.getStorageSync('dataJson')
  161. // let sureData = uni.getStorageSync('sureData')
  162. // this.getByShop(sureDataAll.)
  163. if(dataJson){
  164. this.dataJson = dataJson
  165. }
  166. },
  167. onShow(){
  168. let orderreminder =uni.getStorageSync("orderreminder")
  169. if(orderreminder){
  170. this.$mUtil.toast("已生成待付款订单")
  171. uni.removeStorageSync("orderreminder")
  172. }
  173. let dataJson = uni.getStorageSync('dataJson')
  174. if(dataJson&&!this.addressChose){
  175. this.loading = true;
  176. this.$http.post(`/order/build`, dataJson).then(res => {
  177. if (res && res.code == 200) {
  178. this.loading = false;
  179. uni.setStorageSync('sureData', res.data)
  180. if(res.data){
  181. this.sureDataAll = res.data
  182. let totaltNum=0
  183. res.data.shop_orders.forEach(res=>{
  184. totaltNum+=res.goods_num
  185. })
  186. this.sureData = res.data
  187. this.totaltNum = totaltNum
  188. }
  189. }
  190. }).catch(e=>{
  191. setTimeout(()=>{
  192. uni.navigateBack()
  193. },1500)
  194. })
  195. }
  196. },
  197. methods:{
  198. //提交订单
  199. submitOrder(){
  200. if(this.status==1){//快速配送
  201. this.dataJson.self_take=null
  202. if(this.dataJson.receipt_id==null&&!this.sureDataAll.receipt.id){
  203. this.$mUtil.toast('请填写收货地址')
  204. return false
  205. }
  206. this.orderCreated();
  207. }else{//自提
  208. if(!this.self_take.receiver){
  209. this.$mUtil.toast('请填写提货人姓名')
  210. return false
  211. }
  212. if(!this.self_take.mobile){
  213. this.$mUtil.toast('请填写提货人手机号')
  214. return false
  215. }
  216. if(!(this.self_take.mobile.match(this.$mConfig.telRegex))){
  217. this.$mUtil.toast('请输入正确手机号')
  218. return false
  219. }
  220. this.dataJson.self_take=this.self_take
  221. this.orderCreated()
  222. }
  223. // this.orderCreated()
  224. },
  225. orderCreated(){
  226. this.$http.post('/order/create',this.dataJson)
  227. .then(res => {
  228. this.loading=false
  229. if(!res.data.payStatus){
  230. uni.navigateTo({
  231. url: "/pages/web-view/Apps?path=" + res.data.payUrl
  232. })
  233. }else{
  234. uni.redirectTo({
  235. url: `/pages/order/orderList/orderList`
  236. })
  237. }
  238. // if(res&&res.code==200){
  239. // let target = res.data
  240. // if(target.payment_status==5){
  241. // uni.reLaunch({
  242. // url:`/pages/order/orderList/orderList?orderType=${this.sureDataAll.area_feature==3?3:0}`
  243. // })
  244. // return false
  245. // }else{
  246. // uni.navigateTo({
  247. // url:'../../order/pay?id='+target.id+'&total_amount='+target.total_amount+'&expired_pay_time='+target.expired_pay_time
  248. // })
  249. // }
  250. // }
  251. })
  252. },
  253. userName(e){
  254. if(this.status==2){
  255. this.self_take.receiver = e.detail.value
  256. }
  257. },
  258. userMobile(e){
  259. if(this.status==2){
  260. this.self_take.mobile = e.detail.value
  261. }
  262. },
  263. textareaText(e,index){
  264. this.dataJson.shop_orders.map((v,i)=>{
  265. if(i==index){
  266. v.user_remark=e.detail.value
  267. }
  268. })
  269. },
  270. //店铺优惠查询
  271. getByShop(id){
  272. this.$http.get('/marketing/firstOrder/getByShop/'+id,)
  273. .then(res => {
  274. if(res&&res.code==200){
  275. this.shopDiscounts=res.data
  276. }
  277. })
  278. },
  279. //选完地址回选
  280. otherFun(object){
  281. this.addressChose =true
  282. if(!!object){
  283. let dataJson = uni.getStorageSync('dataJson')
  284. dataJson.receipt_id = object.addressid
  285. this.dataJson = dataJson
  286. this.postData(dataJson)
  287. }
  288. },
  289. postData(dataJson){
  290. this.$http.post(`/order/build`,dataJson).then(res=>{
  291. if(res&&res.code==200){
  292. uni.setStorageSync('sureData',res.data)
  293. this.sureDataAll = res.data
  294. let totaltNum=0
  295. res.data.shop_orders.forEach(res=>{
  296. totaltNum+=res.goods_num
  297. })
  298. this.sureData = res.data
  299. this.totaltNum = totaltNum
  300. }
  301. })
  302. },
  303. changeStatus(val){
  304. this.status = val
  305. if(val==1){
  306. this.dataJson.shipment_mode=0
  307. }else{
  308. this.dataJson.shipment_mode=1
  309. }
  310. this.postData(this.dataJson)
  311. },
  312. }
  313. }
  314. </script>
  315. <style lang="scss">
  316. page{
  317. background-color: #f5f5f5;
  318. }
  319. .textarea{
  320. width: 100%;
  321. height: 234rpx;
  322. border: 1px solid #ededed;
  323. padding: 22rpx 20rpx;
  324. background-color: #fafafa;
  325. border-radius: 20rpx;
  326. box-sizing: border-box;
  327. }
  328. .phone {
  329. margin-right: 10rpx;
  330. width: 25rpx;
  331. height: 25rpx;
  332. }
  333. .topStatus{
  334. height: 100rpx;
  335. background-color: #fff;
  336. position: fixed;
  337. z-index: 9;
  338. width: 100%;
  339. box-sizing: border-box;
  340. text{
  341. line-height: 100rpx;
  342. position: relative;
  343. }
  344. .active{
  345. font-weight: bold;
  346. color: #FA6138;
  347. }
  348. .active:after{
  349. width: 100%;
  350. height: 2px;
  351. background-color: #FA6138;
  352. content: '';
  353. position: absolute;
  354. bottom: 0;
  355. left: 0;
  356. }
  357. }
  358. .courierAddress{
  359. background-color: #fff;
  360. padding: 36rpx 30rpx;
  361. }
  362. .goHome,.listText{
  363. background-color: #fff;
  364. }
  365. .btnview{
  366. width: 300rpx;
  367. margin: 30rpx auto 0;
  368. }
  369. .carbox{
  370. padding: 0rpx 0 160rpx 0;
  371. .shopList{
  372. background-color: #fff;
  373. padding: 30rpx 30rpx 0;
  374. }
  375. }
  376. .changeTabtwo{
  377. padding: 130rpx 0 160rpx 0;
  378. }
  379. .rightText{
  380. justify-content: space-between;
  381. height: 200rpx;
  382. }
  383. .bottext,.botPrice{
  384. width: 100%;
  385. }
  386. .bottext{
  387. margin-top: 36rpx;
  388. }
  389. .rightAddRes{
  390. width: 172rpx;
  391. height: 50rpx;
  392. border-radius: 8rpx;
  393. border: 1px solid #E5E5E5;
  394. .centertext{
  395. text-align: center;
  396. }
  397. .btnTag{
  398. width: 50rpx;
  399. height: 50rpx;
  400. line-height: 50rpx;
  401. text-align: center;
  402. background-color: #dedede;
  403. font-size: 46rpx;
  404. color: #888;
  405. }
  406. }
  407. .btnWidth{
  408. width: 340rpx;
  409. background: #FA6138;
  410. }
  411. .botfixed{
  412. position: fixed;
  413. background-color: #fff;
  414. width: 100%;
  415. height: 138rpx;
  416. bottom: 0;
  417. left: 0;
  418. z-index: 9;
  419. padding: 0 30rpx;
  420. box-sizing: border-box;
  421. }
  422. </style>