pay.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <view class="content">
  3. <view class="">
  4. <view>
  5. <!-- 地址栏 -->
  6. <view v-if="takeType==tykeTypeGloabl.delivery" class="bg-white" @click="$jump('/pagesD/pages/address/address')">
  7. <view class="add-address-box u-flex u-flex-1" v-if="$isEmpty(address)">
  8. <view class="box-bg u-p-30 u-flex-1 u-flex u-row-between">
  9. <text class="select-notice">请选择收货地址</text>
  10. <text class="cuIcon-right" style="color: #bfbfbf;"></text>
  11. </view>
  12. </view>
  13. <view class="add-address-box u-p-20" v-else>
  14. <view class="flex">
  15. <view class="center margin-right-20">
  16. <view class="cuIcon cu-btn round bg-base xl " style="width: 80rpx;height: 80rpx;">
  17. <text>{{ address.consignee.substring(0,1)}}</text>
  18. </view>
  19. </view>
  20. <view class="" style="width: 90%;">
  21. <view class="top u-flex">
  22. <text class="name">{{ address.consignee }}</text>
  23. <text class="phone">{{ address.phone }}</text>
  24. <text class="tag" v-show="address.isDefault == 1">默认</text>
  25. </view>
  26. <view class="detail u-flex u-row-between" style="width: 100%;">
  27. <view class="address text-cut-1" style="width: 90%;">
  28. {{ address.provinceName }}{{ address.cityName }}{{ address.areaName }}{{ address.address }}
  29. </view>
  30. <text class="cuIcon-right margin-left-20" style="color: #bfbfbf;"></text>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="card" style="justify-content: flex-start;">
  37. <text class="cuIcon-shop center text-base" style="font-size: 34rpx;"></text>
  38. <text class="text-lg margin-left-10">{{vuex_orderInfo.store.shopName}}</text>
  39. </view>
  40. <view class="card text-df" @click="takeTypeShow=true">
  41. <text class="text-gray">取餐方式</text>
  42. <view class="">
  43. <text >{{takeType}}</text>
  44. <text class="cuIcon-right"></text>
  45. </view>
  46. </view>
  47. <view v-if="takeType==tykeTypeGloabl.dine_in" class="card text-df">
  48. <text class="text-gray">取餐时间</text>
  49. <view class="">
  50. <text >立即用餐</text>
  51. <text class="cuIcon-right"></text>
  52. </view>
  53. </view>
  54. <view v-if="takeType==tykeTypeGloabl.package" class="card text-df" @click="timeShow=true">
  55. <view class="">
  56. <text class="text-gray">自取时间</text>
  57. <view class='cu-tag light sm round margin-left-10 bg-orange'>可预约</view>
  58. </view>
  59. <view class="">
  60. <text >请选择自取时间</text>
  61. <text class="cuIcon-right"></text>
  62. </view>
  63. </view>
  64. <view class="card text-df" style="border: none;">
  65. <text class="text-gray">联系电话</text>
  66. <view class="">
  67. <text >{{vuex_phone}}</text>
  68. <text class="cuIcon-right"></text>
  69. </view>
  70. </view>
  71. </view>
  72. <view style="margin-top: 20rpx;">
  73. <view v-for="(item,index) in cart" :key="index" class="cart">
  74. <view class="flex" style="width: 70%;">
  75. <image :src="item.image" mode=""></image>
  76. <view class="item-content">
  77. <text class="text-cut-1">{{item.name}}</text>
  78. <text class="text-cut-1">{{item.propertyStr ? item.propertyStr : item.name}}</text>
  79. </view>
  80. </view>
  81. <view class="item-data">
  82. <view class="">
  83. <text class="text-sm">x</text>
  84. <text class="text-lg" style="margin-left: 6rpx;">{{item.number}}</text>
  85. </view>
  86. <text class="text-price text-lg">{{item.realPrice / 100}}</text>
  87. </view>
  88. </view>
  89. <!-- 商家配送 -->
  90. <block v-if="takeType==tykeTypeGloabl.delivery">
  91. <view class="card text-df">
  92. <text class="text-gray">包装费</text>
  93. <text class="text-price">1</text>
  94. </view>
  95. <view class="card text-df">
  96. <text class="text-gray">配送费</text>
  97. <text class="text-price">1</text>
  98. </view>
  99. </block>
  100. <!-- 到店自取 -->
  101. <block v-if="takeType==tykeTypeGloabl.package">
  102. <view class="card text-df">
  103. <text class="text-gray">包装费</text>
  104. <text class="text-price">1</text>
  105. </view>
  106. </block>
  107. <view class="card" style="justify-content: flex-end;flex-direction: column;text-align: right;">
  108. <view class="">
  109. <text>总计:</text>
  110. <text class="text-price text-bold text-xl">{{total / 100}}</text>
  111. </view>
  112. <view class="text-base text-sm margin-top-20">
  113. * 以实际付款为准
  114. </view>
  115. </view>
  116. </view>
  117. <view class="card margin-top-20">
  118. <text>备注</text>
  119. <view style="width: 80%;" class="flex justify-end" @click="goRemark">
  120. <text class="text-gray" v-if="!remark">点击填写备注</text>
  121. <text v-else class="text-cut-1 text-gray">{{remark}}</text>
  122. <text class="cuIcon-right margin-left-10 center"></text>
  123. </view>
  124. </view>
  125. </view>
  126. <!-- 付款栏 begin -->
  127. <view class="" style="height: 140rpx;"></view>
  128. <view class="footer-fixed pay-bar" style="z-index: 99;">
  129. <view class="center" style="justify-content: flex-start;margin-left: 40rpx;">
  130. <text>总计:</text>
  131. <text class="text-price text-bold text-xl">{{total / 100}}</text>
  132. </view>
  133. <view class="bg-base center text-lg" style="width: 25%;">
  134. 付款
  135. </view>
  136. </view>
  137. <!-- 付款栏 end -->
  138. <!-- 取餐方式 -->
  139. <u-picker @confirm="pickConfirm" confirm-color="#FF9447" mode="selector" v-model="takeTypeShow" :range="takeTypeList"></u-picker>
  140. <!-- 自取时间 -->
  141. <h-time-alert
  142. title="自取时间"
  143. :rangeStartTime="vuex_orderInfo.store.businessStartTime"
  144. :rangeEndTime="vuex_orderInfo.store.businessEndTime"
  145. intervalTime="30"
  146. dayStartIntTime="15"
  147. rangeDay="1"
  148. :isNow="true"
  149. :isShow="timeShow"
  150. @closeAlert="handelClose">
  151. </h-time-alert>
  152. </view>
  153. </template>
  154. <script>
  155. import global from "@/assets/http/global.js"
  156. import hTimeAlert from "../../comps/h-time-alert.vue"
  157. export default {
  158. components:{
  159. hTimeAlert
  160. },
  161. data() {
  162. return {
  163. shopId:'',
  164. cartKey:'',
  165. cart:[],
  166. remark:'',
  167. //取餐方式
  168. takeType:'',
  169. tykeTypeGloabl:global.takeType,
  170. takeTypeList:[],
  171. takeTypeShow:false,
  172. //自取时间
  173. timeShow:false,
  174. //配送地址
  175. address:{}
  176. };
  177. },
  178. onLoad() {
  179. this.init()
  180. uni.$on('REMARK',(remark)=>{
  181. this.remark=remark
  182. })
  183. uni.$on('ADDRESS',(address)=>{
  184. console.log(address);
  185. this.address=address
  186. })
  187. },
  188. computed:{
  189. total() {
  190. const sum = this.cart.reduce((pre, item) => {
  191. return pre + item.number * item.realPrice
  192. }, 0)
  193. //商家配送
  194. if (this.takeType==this.$global.takeType.delivery) {
  195. return sum + (this.vuex_orderInfo.store.packingPrice)
  196. + (this.vuex_orderInfo.store.sendingPrice)
  197. }
  198. //到店自取
  199. if (this.takeType==this.$global.takeType.package) {
  200. return sum + (this.vuex_orderInfo.store.packingPrice)
  201. }
  202. return sum
  203. },
  204. },
  205. methods:{
  206. init(){
  207. this.address=this.vuex_orderInfo.address
  208. this.takeType=this.vuex_orderInfo.takeType
  209. this.takeTypeList=this.$global.takeTypeList
  210. this.cart = this.vuex_orderInfo.cart
  211. this.shopId=this.vuex_orderInfo.shopId
  212. this.cartKey=this.$global.cart_prefix + this.vuex_shopId
  213. },
  214. goRemark(){
  215. uni.navigateTo({
  216. url:"remark?data="+this.remark
  217. })
  218. },
  219. pickConfirm(e){
  220. let index=e[0]
  221. this.takeType=this.takeTypeList[index]
  222. },
  223. handelClose(data) {
  224. this.timeShow = false;
  225. console.log(data);
  226. }
  227. }
  228. };
  229. </script>
  230. <style lang="scss" scoped>
  231. .content{
  232. margin: 20rpx;
  233. }
  234. .card{
  235. padding: 30rpx;
  236. background-color: #FFFFFF;
  237. border-bottom: 1rpx solid #f1f1f1;
  238. display: flex;
  239. justify-content: space-between;
  240. }
  241. .cart{
  242. border-bottom: 1rpx solid #f1f1f1;
  243. display: flex;
  244. background-color: #FFFFFF;
  245. padding: 15rpx;
  246. image{
  247. width: 120rpx;
  248. height: 120rpx;
  249. }
  250. .item-content{
  251. width: calc(100% - 120rpx - 15rpx);
  252. display: flex;
  253. flex-direction: column;
  254. justify-content: space-between;
  255. margin-left: 15rpx;
  256. text:first-child{
  257. font-size: 32rpx;
  258. padding-top: 10rpx;
  259. }
  260. text:last-child{
  261. font-size: 26rpx;
  262. color: #999;
  263. font-weight: 400;
  264. padding-bottom: 10rpx;
  265. }
  266. }
  267. .item-data{
  268. display: flex;
  269. align-items: center;
  270. width: 30%;
  271. justify-content: space-between;
  272. margin-right: 20rpx;
  273. }
  274. }
  275. .cart:last-child{
  276. border: none;
  277. }
  278. .pay-bar{
  279. height: 110rpx;
  280. background-color: #FFFFFF;
  281. display: flex;
  282. justify-content: space-between;
  283. }
  284. .add-address-box {
  285. min-height: 100rpx;
  286. background: url('http://file.shopro.top/imgs/order/order_address_line.png') no-repeat;
  287. background-size: 100% auto;
  288. background-position: bottom center;
  289. .select-notice {
  290. font-weight: 400;
  291. color: rgba(153, 153, 153, 1);
  292. line-height: 40rpx;
  293. }
  294. .name,
  295. .phone {
  296. font-size: 30rpx;
  297. font-weight: 500;
  298. }
  299. .phone {
  300. margin: 0 20rpx;
  301. }
  302. .tag {
  303. background: rgba(233, 191, 113, 0.2);
  304. border-radius: 6rpx;
  305. padding: 0 16rpx;
  306. line-height: 38rpx;
  307. color: #a8700d;
  308. font-size: 22rpx;
  309. }
  310. .detail {
  311. .address {
  312. margin-top: 25rpx;
  313. width: 543rpx;
  314. font-size: 26rpx;
  315. font-weight: 400;
  316. color: rgba(153, 153, 153, 1);
  317. line-height: 40rpx;
  318. }
  319. }
  320. }
  321. </style>