sellerDetaileButton.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template name="button">
  2. <view class="button-template" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  3. <!-- 底部按钮 -->
  4. <view class="button-content">
  5. <view class="btn btn-cancel" v-if="secondHandOrderFlag!=1 && !rechargeGoods" @click.stop="btnConfirm('again',order)">再来一单</view>
  6. <view class="btn btn-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel',order)">取消订单</view>
  7. <!-- <view class="btn btn-cancel" v-if="btnState.isDelete" @click.stop="btnConfirm('delete',order)">删除订单</view> -->
  8. <template>
  9. <view class="btn btn-share" v-if="btnState.isPay" @click.stop="onShareCode(1)">
  10. <view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
  11. 分享支付
  12. </view>
  13. <view class="btn btn-share" v-else @click.stop="onShareCode(2)">
  14. <view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
  15. 分享订单
  16. </view>
  17. </template>
  18. <view class="btn btn-color" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm',order)">确认订单</view>
  19. <view class="btn btn-query" v-if="btnState.isQuery && order.secondHandOrderFlag!=1" @click.stop="btnConfirm('query',order)">查看物流</view>
  20. <view class="btn btn-color" v-if="btnState.isPay && ableUserMoney > 0 && !rechargeGoods" @click.stop="btnConfirm('balance',order)">余额抵扣</view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default{
  26. name:'button',
  27. props:{
  28. status:{
  29. type:Number
  30. },
  31. order: {
  32. type:Object
  33. },
  34. ableUserMoney:{
  35. type:Number
  36. },
  37. rechargeGoods:{
  38. type:Boolean
  39. },
  40. shareCode:{
  41. type:String
  42. },
  43. serviceProviderId:{
  44. type:Number
  45. },
  46. secondHandOrderFlag:{
  47. type:String
  48. }
  49. },
  50. watch:{
  51. status:{
  52. handler:function(val){
  53. this.initData(val)
  54. },
  55. deep:true//对象内部的属性监听,也叫深度监听
  56. }
  57. },
  58. data() {
  59. return{
  60. btnState:this.initStatus(),
  61. isIphoneX:this.$store.state.isIphoneX,
  62. invoiceStatus:false,
  63. mapStateArr:[
  64. {label:'isQuery',val:[4,5,12,13,33,22,23,32,77],status: true},
  65. {label:'isDelete',val:[6],status: true},
  66. {label:'isCancel',val:[0,111],status: true},
  67. {label:'isConfirm',val:[0],status: true},
  68. {label:'isPay',val:[11,12,13,21,22,23,111],status: true},
  69. ]
  70. }
  71. },
  72. created(){
  73. console.log(this.rechargeGoods)
  74. this.initData(this.status)
  75. },
  76. computed: {
  77. },
  78. methods:{
  79. initData(resVal) {
  80. /**
  81. * @分享按钮统一显示
  82. * @按钮根据状态显示
  83. * @(4、5、7、12、22、23、32)显示[查看物流]按钮,其他隐藏
  84. * @(6)显示[删除订单],其他隐藏
  85. * @(0、111)显示[取消订单],其他隐藏
  86. * @(21,31)只显示分享
  87. * @(13,33)显示[确认收货]和[查看物流]
  88. */
  89. this.btnState = this.initStatus()
  90. this.mapStateArr.forEach(el => {
  91. el.val.forEach(value => {
  92. if(resVal === value){
  93. this.btnState[el.label] = el.status
  94. //console.log(this.btnState[el.label]);
  95. }
  96. })
  97. })
  98. },
  99. initStatus(){
  100. let btnState= {
  101. isQuery: false,
  102. isDelete: false,
  103. isCancel: false,
  104. isConfirm: false,
  105. isPay: false,
  106. }
  107. return btnState
  108. },
  109. getShareCode(code){
  110. this.shareCode = code
  111. },
  112. onShareCode(type){
  113. if(this.order.onlinePayFlag!= 1){
  114. this.PayService.PayOrderCheckoutCounter({orderId:this.order.orderId}).then(response =>{
  115. let data = response.data.order
  116. this.invoiceStatus = data.invoiceStatus
  117. //判断线上线下显示
  118. if(this.invoiceStatus){
  119. this.$util.modal('提示','由于商品发票属性的限制,本订单不能进行线上支付,请让客户选择线下转账方式付款','继续分享','知道了',true,() =>{
  120. this.$parent.isShareModal = true
  121. })
  122. }else{
  123. this.$parent.isShareModal = true
  124. this.$parent.isShareType = type
  125. }
  126. }).catch(error =>{
  127. this.$util.msg(error.msg,2000)
  128. })
  129. }else{
  130. this.$parent.isShareModal = true
  131. }
  132. // this.$emit('shareConfirm')
  133. },
  134. btnConfirm(type,order){
  135. let data = {
  136. type:type,
  137. orderId:order.orderId,
  138. order:order
  139. }
  140. this.$emit('buttonConfirm',data)
  141. },
  142. }
  143. }
  144. </script>
  145. <style lang="scss">
  146. .button-template{
  147. width: 100%;
  148. height: auto;
  149. position: fixed;
  150. bottom: 0;
  151. left: 0;
  152. background: #FFFFFF;
  153. .button-content{
  154. padding:0 24rpx;
  155. height: auto;
  156. float: right;
  157. position: relative;
  158. margin: 20rpx 0;
  159. .share-code{
  160. width: 200rpx;
  161. height: 64rpx;
  162. line-height: 64rpx;
  163. color: #2A45FF;
  164. text-align: left;
  165. position: absolute;
  166. font-size: $font-size-28;
  167. font-weight: bold;
  168. left: 24rpx;
  169. top: 24rpx;
  170. }
  171. .btn{
  172. width: 160rpx;
  173. height: 64rpx;
  174. // margin:22rpx;
  175. line-height: 64rpx;
  176. font-size:$font-size-26;
  177. color: #FFFFFF;
  178. text-align: center;
  179. border-radius: 34rpx;
  180. float: right;
  181. }
  182. .btn-color{
  183. background: #f94b4b;
  184. // margin: 20rpx 0 20rpx 20rpx;
  185. .tips{
  186. width: 160rpx;
  187. height: 34rpx;
  188. padding: 10rpx 10rpx;
  189. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  190. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  191. border-radius: 8rpx;
  192. position: absolute;
  193. color: #FFFFFF;
  194. line-height: 34rpx;
  195. font-size: $font-size-24;
  196. text-align: left;
  197. right: 24rpx;
  198. top: -45rpx;
  199. &:before{
  200. content: "";
  201. width: 25rpx;
  202. height: 25rpx;
  203. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  204. position: absolute;
  205. bottom: -8rpx;
  206. right: 30rpx;
  207. z-index: -1;
  208. transform:rotate(45deg);
  209. }
  210. }
  211. }
  212. .btn-cancel{
  213. background:#FFFFFF;
  214. color: #666666;
  215. float: left;
  216. // margin: 22rpx 0;
  217. margin-right: 15rpx;
  218. border: 2rpx solid #999999;
  219. }
  220. .btn-delete{
  221. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  222. }
  223. .btn-query{
  224. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  225. }
  226. .btn-confirm{
  227. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  228. }
  229. .btn-share{
  230. background:#FFFFFF;
  231. color: #666666;
  232. float: left;
  233. // margin: 22rpx 0;
  234. margin-right: 15rpx;
  235. border: 2rpx solid #999999;
  236. position: relative;
  237. .tips{
  238. width: 160rpx;
  239. height: 34rpx;
  240. padding: 10rpx 10rpx;
  241. background:#E15616;
  242. border-radius: 8rpx;
  243. position: absolute;
  244. color: #FFFFFF;
  245. line-height: 34rpx;
  246. font-size: $font-size-24;
  247. text-align: left;
  248. right: 0;
  249. top: -69rpx;
  250. &:before{
  251. content: "";
  252. width: 25rpx;
  253. height: 25rpx;
  254. background:#E15616;
  255. position: absolute;
  256. bottom: -8rpx;
  257. left: 30rpx;
  258. z-index: -1;
  259. transform:rotate(45deg);
  260. }
  261. }
  262. }
  263. }
  264. }
  265. </style>