checkOut.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="page-content">
  3. <view class="content">
  4. <u-field
  5. class="field-item"
  6. :value="store.name"
  7. disabled
  8. input-align="right"
  9. label="收取门店"
  10. >
  11. </u-field>
  12. <u-field
  13. v-model="remarks"
  14. label="备注"
  15. input-align="right"
  16. auto-height
  17. :maxlength="10"
  18. placeholder="请填写备注(最多10个字符)"
  19. >
  20. </u-field>
  21. <view class="num-cont">
  22. <text class="u-required">支付数量</text>
  23. <view class="num-input">
  24. <u-input v-model="number" input-align="right" type="number" placeholder="请输入数量" />
  25. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="pay-btn">
  30. <view class="total">
  31. <text>{{number||0}}</text>
  32. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  33. </view>
  34. <u-button @click="handlePay" type="error" >确认支付</u-button>
  35. </view>
  36. <!-- 确认支付弹窗 -->
  37. <u-popup mode="center" closeable @close="closeModal" v-model="showPayModal" width="600rpx" >
  38. <view class="slot-content">
  39. <view>请输入支付密码</view>
  40. <view class="text-cont">
  41. <view>
  42. <text>收取门店:</text>
  43. <text>{{store.name||'--'}}</text>
  44. </view>
  45. <view class="num-text">
  46. <text>支付数量:</text>
  47. <view>
  48. <text class="num-big">{{number}}</text>
  49. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  50. </view>
  51. </view>
  52. <view>
  53. <text>备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</text>
  54. <text>{{remarks||'--'}}</text>
  55. </view>
  56. </view>
  57. <view class="footer">
  58. <input v-model="password"
  59. type="password"
  60. placeholder="请输入支付密码"
  61. :maxlength="30"
  62. @confirm="confirm"
  63. />
  64. </view>
  65. <view class="fot-btn">
  66. <u-button @click="confirm" type="error" >确认支付</u-button>
  67. </view>
  68. </view>
  69. </u-popup>
  70. <!-- 提示用户设置支付密码 -->
  71. <u-modal v-model="showSetPswModal"
  72. content="请先设置支付密码,才能使用乐豆"
  73. show-cancel-button
  74. confirm-text="去设置"
  75. cancel-text="暂时放弃"
  76. @confirm="toSetPwd"
  77. @cancel="showSetPswModal=false"
  78. ></u-modal>
  79. </view>
  80. </template>
  81. <script>
  82. import { sellerReceive,sellerFindByPartnerNo } from '@/api/user.js'
  83. import { existPayPwd } from '@/api/order.js'
  84. export default{
  85. data() {
  86. return {
  87. showSetPswModal: false,
  88. store: null, // 门店信息
  89. remarks: '', // 备注
  90. number: '', // 支付数量
  91. showPayModal: false, // 支付弹窗
  92. password: '', // 支付密码
  93. partnerNo: '' // 销售商编号
  94. }
  95. },
  96. onLoad(opts) {
  97. console.log(opts)
  98. this.partnerNo = opts.scene
  99. // 查询销售商信息
  100. sellerFindByPartnerNo({officialPartnerNo: this.partnerNo}).then(res => {
  101. if(res.status == 200){
  102. this.store = res.data
  103. }
  104. })
  105. },
  106. methods: {
  107. // 跳转到设置支付密码页
  108. toSetPwd () {
  109. uni.navigateTo({
  110. url:"/pages/userCenter/userInfo/smsVerification"
  111. })
  112. },
  113. // 确认支付
  114. handlePay() {
  115. if (!this.number) {
  116. uni.showToast({
  117. title: '请输入支付数量',
  118. icon: 'none'
  119. })
  120. } else {
  121. existPayPwd().then(res => {
  122. console.log(res,'rrrrrr')
  123. if(res.status == 200) {
  124. // 设置过支付密码,输入密码
  125. if(res.data) {
  126. this.showPayModal = true
  127. } else {
  128. // 没设置过支付密码,提示设置密码
  129. this.showSetPswModal = true
  130. }
  131. }
  132. })
  133. }
  134. },
  135. // 关闭弹窗
  136. closeModal() {
  137. this.showPayModal = false
  138. this.password = ''
  139. },
  140. // 输入密码完成 支付
  141. confirm(e) {
  142. if(this.password == ''){
  143. uni.showToast({
  144. title: '请输入支付密码',
  145. icon: 'none'
  146. })
  147. return
  148. }
  149. let data = {
  150. "payPassword": this.password,
  151. "changeNum": this.number,
  152. "remarks": this.remarks,
  153. "officialPartnerNo": this.partnerNo
  154. }
  155. sellerReceive(data).then(res => {
  156. console.log(res)
  157. if(res.status == 200){
  158. uni.navigateTo({
  159. url: '/pages/checkOut/checkFinish?num='+this.number
  160. })
  161. } else {
  162. uni.showToast({
  163. icon: 'none',
  164. title: res.message
  165. })
  166. }
  167. })
  168. }
  169. },
  170. }
  171. </script>
  172. <style lang="less">
  173. page{
  174. height: 100%;
  175. }
  176. .page-content{
  177. width: 100%;
  178. height: 100%;
  179. padding: 20upx;
  180. background-color: #f8f8f8;
  181. .content{
  182. background-color: #fff;
  183. }
  184. .num-cont{
  185. width: 100%;
  186. padding: 16upx;
  187. display: flex;
  188. align-items: center;
  189. justify-content: space-between;
  190. .num-input{
  191. display: flex;
  192. align-items: center;
  193. justify-content: center;
  194. >u-input {
  195. width: 300upx;
  196. }
  197. }
  198. }
  199. .pay-btn{
  200. padding: 0 30upx;
  201. .total {
  202. display: flex;
  203. align-items: center;
  204. justify-content: center;
  205. font-size: 48upx;
  206. font-weight: 600;
  207. color: red;
  208. padding: 60upx 0;
  209. }
  210. }
  211. }
  212. .slot-content{
  213. padding: 30upx 0;
  214. font-size: 32upx;
  215. display: flex;
  216. flex-direction: column;
  217. align-items: center;
  218. justify-content: space-between;
  219. .text-cont{
  220. width: 100%;
  221. margin-top: 20upx;
  222. border-bottom: 1px solid #F8F8F8;
  223. >view {
  224. padding: 10upx 40upx;
  225. display: flex;
  226. >text{
  227. &:last-child {
  228. flex: 1;
  229. padding-left: 30upx;
  230. }
  231. }
  232. .num-big{
  233. font-size: 36upx;
  234. color: red;
  235. padding-left: 30upx;
  236. font-weight: 600;
  237. }
  238. }
  239. .num-text{
  240. align-items: center;
  241. >view {
  242. display: flex;
  243. align-items: center;
  244. }
  245. }
  246. }
  247. .footer{
  248. width: 80%;
  249. border-bottom: 1px solid #b1b1b1;
  250. >input {
  251. text-align: center;
  252. padding: 10upx 0;
  253. }
  254. }
  255. .fot-btn{
  256. margin-top: 30upx;
  257. }
  258. }
  259. </style>